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

GTK4_ARCHES := amd64 arm64 armhf ppc64el riscv64 s390x loong64 ppc64

ifeq (,$(filter $(DEB_HOST_ARCH),$(GTK4_ARCHES)))
	ENABLE_SNIFFER = -Dsniffer=false -Dmanpages=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		$(ENABLE_SNIFFER) \
		-Dgtk_doc=$(if $(filter %-doc,$(shell dh_listpackages)),true,false)

# Make the tests non-fatal on kfreebsd-* as multicast requires to explicitly
# setup a route
ifneq (,$(filter $(DEB_HOST_ARCH),kfreebsd-amd64 kfreebsd-i386 hurd-i386))
override_dh_auto_test:
	dh_auto_test || true
endif
