# Template file for 'enlightenment'
pkgname=enlightenment
version=0.19.0
revision=1
lib32disabled=yes
build_style=gnu-configure
configure_args="--enable-pam --disable-bluez4 $(vopt_enable systemd)"
hostmakedepends="pkg-config efl>=1.10"
makedepends="pam-devel pixman-devel elementary-devel>=1.11 $(vopt_if systemd systemd-devel)"
depends="evas_generic_loaders>=1.11 emotion_generic_players>=1.11 hicolor-icon-theme desktop-file-utils"
conf_files="/etc/enlightenment/sysactions.conf"
homepage="http://enlightenment.org"
short_desc="Enlightenment desktop"
maintainer="Juan RP <xtraeme@gmail.com>"
license="BSD"
distfiles="http://download.enlightenment.org/rel/apps/${pkgname}/${pkgname}-${version}.tar.bz2"
checksum=5fdd685ad2643a1e2fd8bc2b687923170c932e119b0f2d24cbb09b5867916d4b

# Package build options
build_options="systemd wayland"
build_options_default="wayland"

if [ "$build_option_wayland" ]; then
	configure_args+=" --disable-wl-desktop-shell --enable-wayland-egl --enable-wayland-clients"
	makedepends+=" libxkbcommon-devel MesaLib-devel wayland-devel"
else
	configure_args+=" --disable-wayland-egl"
fi

post_install() {
	if [ -z "$build_option_systemd" ]; then
		# Use our native tools to shutdown/suspend.
		sed -i 's/^action:.*halt.*/action: halt shutdown -h now/g' ${DESTDIR}/etc/${pkgname}/sysactions.conf
		sed -i 's/^action:.*reboot.*/action: reboot shutdown -r now/g' ${DESTDIR}/etc/${pkgname}/sysactions.conf
		sed -i 's/^action:.*suspend.*/action: suspend zzz/g' ${DESTDIR}/etc/${pkgname}/sysactions.conf
		sed -i 's/^action:.*hibernate.*/action: hibernate ZZZ/g' ${DESTDIR}/etc/${pkgname}/sysactions.conf
	fi
	vmkdir usr/share/licenses/${pkgname}
	install -m644 COPYING* ${DESTDIR}/usr/share/licenses/${pkgname}
	vinstall ${FILESDIR}/e-applications.menu 644 etc/xdg/menus
	rm -rf ${DESTDIR}/usr/share/${pkgname}/doc
}

enlightenment-devel_package() {
	depends="elementary-devel>=1.11"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
	}
}
