#!/usr/bin/make -f
# -*- gmakefile -*-

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --enable-maintainer-mode \
	  --with-gpgsm=/usr/bin/gpgsm --with-gpg-agent=/usr/bin/gpg-agent

override_dh_auto_test:
	mkdir -p debian/dot-gnupg
	chmod og-rx debian/dot-gnupg
	echo debug-disable-ticker >debian/dot-gnupg/scdaemon.conf
	GNUPGHOME=${CURDIR}/debian/dot-gnupg gpg-agent --daemon dh_auto_test
	rm -rf debian/dot-gnupg

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
	rm -f debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/scute.la
	mkdir -p debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/scute
	mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/scute.so \
		debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/scute/

# Do not add an ldconfig trigger.
override_dh_makeshlibs:
	dh_makeshlibs -n
