#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)
ARCHLIB := $(shell perl -MConfig -e 'print $$Config{vendorarch}')

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- V=1

override_dh_auto_install:
	dh_auto_install
	# contentless manpage
	$(RM) -v $(TMP)/usr/share/man/man3/FFI::Platypus::ShareConfig.3pm
	# replace build path.
	# https://github.com/Perl5-FFI/FFI-Platypus/issues/110
	sed -i -e "s,$(CURDIR),/<<PKGBUILDDIR>>,g" $(TMP)/$(ARCHLIB)/auto/share/dist/FFI-Platypus/probe/probe.pl

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