#!/usr/bin/make -f

export QT_SELECT=5
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

override_dh_auto_configure:
# Read Git commit hash from Debian version (only works on Launchpad)
		head -n 1 debian/changelog | sed -nE "s|.*-([0-9a-f]{7})~[^~]*|\1|p" > cmake/GIT_COMMIT 

	dh_auto_configure -- -DUSE_SYSTEM_LIBAPPIMAGE=ON \
	-DCMAKE_BUILD_TYPE=Release \
	-DENABLE_UPDATE_HELPER=OFF \
	-DINSTALL_MAINTAINER_SCRIPTS=ON

override_dh_fixperms:
	dh_fixperms
	chmod +x $(CURDIR)/debian/appimagelauncher/usr/share/appimagelauncher/maintainer-scripts/post-install
	chmod +x $(CURDIR)/debian/appimagelauncher/usr/share/appimagelauncher/maintainer-scripts/post-uninstall

# No dbgsym packages:
override_dh_strip:
	@echo "not building dbgsym packages for MX Linux"
	dh_strip --no-automatic-dbgsym
