#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--disable-silent-rules \
		--with-shell=/bin/sh \
                --libdir=/usr/lib \
		--mandir=/usr/share/man

override_dh_installdocs:
	dh_installdocs -A README.md

override_dh_auto_clean:
	[ ! -r Makefile ] || make distclean

override_dh_install:
	dh_install

override_dh_auto_test:
	# at the moment do nothing here
	# the packages needed for these tests are not yet in Debian

get-orig-source:
	set -e;\
	quilt pop -af || true ;\
	rm -Rf .pc ;\
	gbp import-orig --pristine-tar --uscan --no-merge --upstream-branch=upstream/latest;\
	utag=`git describe --exact-match heads/upstream/latest | sed -e 's#^upstream/##'` ;\
	ucommit=`git rev-parse --verify upstream/latest`;\
	git dpm record-new-upstream --rebase-patched --allow-changes-in-debian-branch ../cpdb-backend-cups_$$utag.orig.tar.gz $$ucommit ;\
	git dpm update-patches -m "Merge upstream-repacked $$utag version and refresh git-dpm patches"
