#!/usr/bin/make -f

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

DEBIAN_TARGETS := clean binary binary-arch binary-indep build build-arch build-indep

$(DEBIAN_TARGETS):
	dh $@ --parallel

override_dh_auto_test:
	xvfb-run -a dh_auto_test --max-parallel=1

override_dh_auto_install:
	dh_auto_install

	# fix permissions
	find $(TMP)/usr/lib/perl5/Wx -type f -perm /755 -print0 | xargs -r0 chmod -v 664

	# remove bogus man page
	rm -vf "$(TMP)/usr/share/man/man3/Wx::build::MakeMaker::Win32_MSVC.3pm"

override_dh_installexamples:
	dh_installexamples
	chmod 0644 $(TMP)/usr/share/doc/$(PACKAGE)/examples/README.txt
	find $(TMP)/usr/share/doc/$(PACKAGE)/examples -name '*.pl' -exec chmod 0755 {} \;

.PHONY: $(DEBIAN_TARGETS)
