#!/usr/bin/make -f

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

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386 kfreebsd-i386 kfreebsd-amd64))
	ADMIN_BACKEND=-Dadmin=false
else
	ADMIN_BACKEND=
endif

ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
        BLURAY_BACKEND = -Dbluray=false
endif

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

override_dh_auto_configure:
	dh_auto_configure -- \
		--libexecdir=/usr/lib/gvfs \
		-Ddeprecated_programs=true \
		-Dnfs=false \
		-Dman=true \
		$(ADMIN_BACKEND) \
		$(BLURAY_BACKEND)

override_dh_strip:
	dh_strip --dbgsym-migration='gvfs-dbg (<< 1.28.0-1~)'

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

override_dh_missing:
	dh_missing --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs --no-act

override_dh_auto_test:
	echo "Skipping testsuite as it's better run as an autopkgtest with machine isolation"
