#!/usr/bin/make -f

ARCHLIB := $(shell perl -MConfig -e'print substr($$Config{vendorarch},1)')

%:
	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:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	# Gtk needs a X server to be imported, hence the need for xvfb-run
	xvfb-run -a dh_auto_test
endif
