#!/usr/bin/make -f

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

.PHONY: $(DEBIAN_TARGETS)

# the list is put verbatim here as a workaround for lintian bug #638411
# lintian fails to interpolate the variable and reports missing required
# targets, leading to an automated reject
clean binary binary-arch binary-indep build build-arch build-indep:
	dh $@ --parallel

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

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 {} \;
