#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_build:
	# make sure to remove all pre-built files, so that e.g.
	# .c files in xs/ are rebuilt from swig input files
	perl ./Build clean

	# after cleaning we get an error:
	# "Configuration seems to be out of date, please re-run 'perl Build.PL' again."
	# so let's do that was well
	dh_auto_configure

	# now we can finally build
	dh_auto_build

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