#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dnetwork_tests=false \
		-Dplugin_flatpak=$(if $(filter alpha hurd-i386 hurd-amd64,$(DEB_HOST_ARCH)),false,true) \
		-Dplugin_sysprof=$(if $(filter linux,$(DEB_HOST_ARCH_OS)),true,false) \
		-Dplugin_update_manager=false \
		-Dplugin_valgrind=$(if $(shell which valgrind),true,false)

# force debian/tmp installation for now until we ship
# more than one binary package, then this can be dropped...
override_dh_auto_install:
	dh_auto_install --destdir=$(CURDIR)/debian/tmp

override_dh_auto_test:
	dbus-run-session -- xvfb-run dh_auto_test

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/gnome-builder

override_dh_shlibdeps:
	dh_shlibdeps -ldebian/gnome-builder/usr/lib/$(DEB_HOST_MULTIARCH)/gnome-builder/

override_dh_girepository:
	dh_girepository -ldebian/tmp/usr/share/gnome-builder/gir-1.0 \
	  /usr/lib/$(DEB_HOST_MULTIARCH)/gnome-builder/ \
	  /usr/lib/$(DEB_HOST_MULTIARCH)/gnome-builder/girepository-1.0/

override_dh_python3:
# https://bugs.debian.org/838342
	dh_python3 -X.*/plugins/meson_templates/resources/.*
