#!/usr/bin/make -f

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

ifeq ($(filter sysprof,$(shell dh_listpackages)),)
gtk=-Dgtk=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dsysprofd=bundled \
		-Dsystemdunitdir=/usr/lib/systemd/system \
		$(gtk)

override_dh_makeshlibs:
	# The libraries in libsysprof-6-modules are to be loaded with
	# LD_PRELOAD, not linked
	dh_makeshlibs -Nlibsysprof-6-modules

override_dh_auto_test:
	dh_auto_test --  --timeout-multiplier 2

# mesa-utils is in Ubuntu "universe" and this feature isn't mandatory
override_dh_gencontrol:
ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
	dh_gencontrol -- \
		-Vsysprof:Suggests='mesa-utils'
else
	dh_gencontrol -- \
		-Vsysprof:Recommends='mesa-utils'
endif

override_dh_gnome_clean:
