#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CONFIGURE_OPTS=--wrap-mode=default
DH_INSTALL_OPTS =

ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  CONFIGURE_OPTS += -Dtests=false
endif

ifneq (,$(filter nogir,$(DEB_BUILD_PROFILES)))
  CONFIGURE_OPTS += -Dintrospection=disabled
  CONFIGURE_OPTS += -Dvapi=false
  DH_INSTALL_OPTS += -Xusr/share/vala/vapi
endif

%:
	dh $@ --builddirectory=_build

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTS)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dbus-run-session meson test -C _build
endif

override_dh_install:
	dh_install $(DH_INSTALL_OPTS)

override_dh_auto_clean:
	dh_auto_clean
	find subprojects/ -type f -name '.meson-subproject-wrap-hash.txt' -delete
