#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
PERLVER := $(shell perl -MConfig -e 'print $$Config{version}')
ARCHLIB := $(shell perl -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(PERLVER) -MConfig -e 'print substr($$Config{vendorarch},1)')

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_build:
	# Move the wx embedded code copy out of the way
	if [ -d wx ]; then rm -rf wx_disabled && mv wx wx_disabled; fi

	dh_auto_build

override_dh_auto_clean:
	dh_auto_clean

	# Move the wx embedded code copy back
	if [ -d wx_disabled ]; then rm -rf wx && mv wx_disabled wx; fi

override_dh_auto_install:
	dh_auto_install
	mkdir -p $(CURDIR)/debian/libwx-glcanvas-perl/usr/share/doc/libwx-glcanvas-perl
	mv $(CURDIR)/debian/libwx-glcanvas-perl/$(ARCHLIB)/Wx/DemoModules $(CURDIR)/debian/libwx-glcanvas-perl/usr/share/doc/libwx-glcanvas-perl/examples

override_dh_auto_test:
	# Gtk needs a X server to be imported, hence the need for xvfb-run
	xvfb-run -a dh_auto_test
