#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)

BUILDHOME = $(shell perl -MDebian::Debhelper::Dh_Lib -e 'Debian::Debhelper::Dh_Lib::setup_home_and_xdg_dirs; print $$ENV{"HOME"};')

%:
	dh $@

override_dh_auto_test:
	HOME=$(BUILDHOME) git config --global user.name "Debian Perl Group"
	HOME=$(BUILDHOME) git config --global user.email "pkg-perl-maintainers@lists.alioth.debian.org"
	dh_auto_test

override_dh_auto_install:
	dh_auto_install
	# remove empty manpages
	find $(TMP)/usr/share/man/man1 $(TMP)/usr/share/man/man3 -type f -empty -delete
	# a template
	$(RM) $(TMP)/usr/share/man/man3/Minilla::Profile::Base.3pm

override_dh_installexamples:
	dh_installexamples
	sed -i '1s|^#!/usr/bin/env perl|#!/usr/bin/perl|' $(TMP)/usr/share/doc/$(PACKAGE)/examples/*
