#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export LC_ALL=C.UTF-8

include /usr/share/dpkg/default.mk

# pipewire is not in Ubuntu main yet https://launchpad.net/bugs/1802533
ifeq ($(shell dpkg-vendor --query vendor),Ubuntu)
	CONFFLAGS += --disable-pipewire
else
	CONFFLAGS += --enable-pipewire
endif

# ITP #946605
ifeq ($(filter pkg.libportal.enable,$(DEB_BUILD_PROFILES)),)
CONFFLAGS += --disable-libportal
else
CONFFLAGS += --enable-libportal
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-docbook-docs \
		--enable-geoclue \
		--enable-installed-tests \
		$(CONFFLAGS)
		$(NULL)

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	G_MESSAGES_DEBUG=all \
	TEST_IN_CI=1 \
	dh_auto_test --no-parallel
endif
