#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs

ifeq ($(DEB_HOST_ARCH_OS),linux)
ENABLE_SELINUX := -Dselinux=true
else
ENABLE_SELINUX := -Dselinux=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Ddocs=true \
		-Dextension=true \
		-Dpackagekit=true \
		-Dtests=all \
		$(ENABLE_SELINUX)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir -p -m0700 $(CURDIR)/debian/tmp-home/run
	touch $(CURDIR)/debian/tmp-home/.gtk-bookmarks
	env \
		HOME=$(CURDIR)/debian/tmp-home \
		dbus-run-session -- xvfb-run --auto-servernum dh_auto_test
	rm -fr debian/tmp-home
endif

override_dh_makeshlibs:
	dh_makeshlibs -- -c4
