#!/usr/bin/make -f

%:
	dh $@ --parallel -Scmake

override_dh_auto_configure:
	# Patched source FTBFS if this embedded code copy is present
	tar cf antlr.tar src/antlr testsuite/launchtest.c
	rm -rf src/antlr

	dh_auto_configure -Scmake -- \
	  -DPYTHONDIR=/usr \
	  -DPYTHONVERSION=2.7 \
	  -DDEB_BUILD_MULTIARCH=`dpkg-architecture -qDEB_BUILD_MULTIARCH` \
	  -DFFTW=YES \
	  -DPYTHON=YES \
	  -DWXWIDGETS=YES \
	  -DGRIB=YES \
	  -DUDUNITS=YES \
	  -DPSLIB=YES

override_dh_auto_install:
	dh_auto_install
	# See https://wiki.debian.org/RpathIssue
	chrpath --delete debian/gnudatalanguage/usr/bin/gdl

override_dh_auto_test:
	cd obj*/testsuite; $(CC) -o launchtest ../../testsuite/launchtest.c
	-xvfb-run dh_auto_test --parallel -Scmake

override_dh_auto_clean:
	if [ -f  antlr.tar ]; then tar xf antlr.tar; fi
	rm -f antlr.tar
	dh_auto_clean --parallel -Scmake

override_dh_compress:
	dh_compress -X.pro
