#! /usr/bin/make -f
%:
	dh $@ --buildsystem=phppear --with phppear

override_dh_auto_test:
	# without --process-isolation there is a weird race condition
	# causing the tests to fails GnuPG when can't use /run/user/$UID as
	# socket directory (for instance because it's not there) and uses
	# its homedir as fallback -- removing the GNUPGHOME between each
	# test seems to cause problems when it contains the agent socket
	phpunit --include-path Crypt_GPG-*/ Crypt_GPG-*/tests \
		--process-isolation --exclude-group write

execute_after_dh_install:
	# not needed with gpg >=2.1.13 (Crypt_GPG uses `--pinentry-mode loopback` instead)
	rm $(CURDIR)/debian/php-crypt-gpg/usr/bin/crypt-gpg-pinentry
	rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/php-crypt-gpg/usr/bin