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

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/default.mk

sampledir:=$(CURDIR)/debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/examples

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --with-pmdir=/share/perl5

override_dh_installchangelogs:
	dh_installchangelogs src/perl/ChangeLog

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --repack --compression xz --destdir=../tarballs --no-symlink

override_dh_installexamples:
	dh_installexamples;
	mkdir -p $(sampledir)/testsuite;
	mkdir -p $(sampledir)/testdata;
	cp ./examples/* $(sampledir)/testdata/;
	find ./src/perl/ \( -name "*.pm" -o -name "*fill*" -o -name "test.t" \) -exec cp \{\} $(sampledir)/testsuite \;
	sed -i 's#examples#testdata#g' $(sampledir)/testsuite/test.t;
	sed -i 's#I\.\./perl/#I\.\./\.#g' $(sampledir)/testsuite/test.t;
	sed -i 's#\.\./perl/#/usr/bin/#g' $(sampledir)/testsuite/test.t;
