#!/usr/bin/make -f

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
export deb_systemdsystemunitdir = $(shell pkg-config --variable=systemdsystemunitdir systemd | sed s,^/,,)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--sbindir=/usr/sbin \
		--disable-static \
		--disable-dependency-tracking \
		--enable-pie \
		--enable-now \
		--enable-systemd \
		--enable-xml-docs \
		--enable-compat-dtd \
		--with-selinux-acls \
		--with-selinux-labels \
		--without-python

override_dh_install:
	# purge .la files
	find $(CURDIR)/debian/tmp -name "*.la" -type f -exec rm -f "{}" \;
	# move pam module to correct location
	mkdir -p $(CURDIR)/debian/tmp/lib/${DEB_HOST_MULTIARCH}
	mv $(CURDIR)/debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/security \
		$(CURDIR)/debian/tmp/lib/${DEB_HOST_MULTIARCH}/

	dh_install
