#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_TARGET_MULTIARCH ?= $(shell dpkg-architecture -qDEB_TARGET_MULTIARCH)
export MESON_BUILD_DIR=obj-$(DEB_HOST_GNU_TYPE)


%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure --verbose -- \
		-Dwl=true

execute_before_dh_install:
	rm -f debian/tmp/usr/share/enlightenment/COPYING
	gzip -9n debian/tmp/usr/share/enlightenment/doc/*.txt
	convert -resize 128x128 debian/tmp/usr/share/icons/hicolor/128x128/apps/emixer.png debian/tmp/usr/share/icons/hicolor/128x128/apps/emixer.png
	convert -resize 128x128 debian/tmp/usr/share/icons/hicolor/128x128/apps/enlightenment_fprint.png debian/tmp/usr/share/icons/hicolor/128x128/apps/enlightenment_fprint.png
	convert -resize 128x128 debian/tmp/usr/share/icons/hicolor/128x128/apps/enlightenment_paledit.png debian/tmp/usr/share/icons/hicolor/128x128/apps/enlightenment_paledit.png
	install -m 0644 -D debian/enlightenment-portals.conf debian/tmp/usr/share/xdg-desktop-portal/enlightenment-portals.conf

execute_after_dh_fixperms-arch:
	chmod 4755 debian/enlightenment/usr/lib/*/enlightenment/utils/enlightenment_sys \
		debian/enlightenment/usr/lib/*/enlightenment/utils/enlightenment_system \
		debian/enlightenment/usr/lib/*/enlightenment/utils/enlightenment_ckpasswd
