#!/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

%:
	dh $@

# libcloudproviders is not in Ubuntu main
override_dh_auto_configure:
	dh_auto_configure -- \
		-Dcloudproviders=$(if $(shell dpkg-vendor --derives-from Ubuntu && echo y),false,true) \
		-Ddocs=true \
		-Dselinux=$(if $(filter linux,$(DEB_HOST_ARCH_OS)),true,false) \
		-Dtests=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),none,all)

# Fixes blhc by doing this build step here with sufficient verbosity
# rather than during "meson test"
# https://mesonbuild.com/Release-notes-for-1-7-0.html#test-targets-no-longer-built-by-default
execute_after_dh_auto_build:
ifeq (,$(filter nocheck,$(DEB_BUILD_PROFILES)))
	dh_auto_build -- meson-test-prereq
endif

override_dh_auto_test:
	touch $(CURDIR)/debian/.debhelper/generated/_source/home/.gtk-bookmarks
	GTK_A11Y=none GVFS_REMOTE_VOLUME_MONITOR_IGNORE=1 dbus-run-session -- xvfb-run --auto-servernum \
	dh_auto_test -- --no-rebuild --wrapper $(CURDIR)/debian/run-with-gvfsd

# Skip. We only use dh_gnome for dh_translations for Ubuntu
override_dh_gnome:
