#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Ubuntu enables this by default, but it breaks module loading; https://launchpad.net/bugs/2040488
export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-btrfs \
		--enable-lvm2 \
		--enable-gtk-doc=$(if $(filter nodoc,$(DEB_BUILD_PROFILES)),no,yes) \
		--with-udevdir=/usr/lib/udev \
		--with-systemdsystemunitdir=/usr/lib/systemd/system

execute_after_dh_auto_install:
	# install Apport hook on Ubuntu
	if dpkg-vendor --is ubuntu; then \
	    install -m 644 -D debian/local/apport-hook.py debian/udisks2/usr/share/apport/package-hooks/udisks2.py; \
	fi

execute_before_dh_install:
	find debian/tmp -name '*.la' -print -delete
	find debian/tmp -name 'libudisks2_*.a' -print -delete

override_dh_installudev:
	dh_installudev -pudisks2 --name=insecure-fs --priority=70
