#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed

%:
	dh $@ --with gir,gnome --buildsystem=meson

ifeq ($(DEB_HOST_ARCH_OS),linux)
CONFFLAGS = \
	-Denable-networkmanager=yes \
	-Denable-systemd=yes
endif

override_dh_auto_configure:
	dh_auto_configure -- \
		--libdir=/usr/lib \
		--libexecdir=/usr/lib/gnome-shell \
		$(CONFFLAGS)

override_dh_install:
	find debian/tmp -name '*.la' -print -delete
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/gnome-shell/

override_dh_shlibdeps:
	# gnome-shell uses mutters private mutter-clutter-1.0.so etc.
	dh_shlibdeps -l"usr/lib/$(DEB_HOST_MULTIARCH)/mutter"

override_dh_strip:
	dh_strip --dbgsym-migration='gnome-shell-dbg (<< 3.20.2-2~)'

override_dh_auto_test:
ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
	xvfb-run dh_auto_test
else	
	-xvfb-run dh_auto_test
endif
endif
