#!/usr/bin/make -f

export DH_VERBOSE=1
export DH_OPTIONS

export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie

include /usr/share/dpkg/default.mk

%:
	dh  $@ --buildsystem=gradle --with javahelper,jh_maven_repo_helper

override_dh_auto_clean:
	dh_auto_clean
	-rm debian/pom-gkl.xml

override_dh_auto_configure:
	# As we provide a Debian-made POM file, we have to update the version number
	# that is inside each time the upstream version changes. This is done
	# automatically with this tiny hack.
	sed 's/@VERSION@/$(DEB_VERSION_UPSTREAM)/ ; s/\+dfsg[[:digit:]]*//' debian/pom-gkl.xml.in > debian/pom-gkl.xml
	dh_auto_configure

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Tests do not work with locales with a different decimal separator
	# (for example ',')
	LC_ALL=C LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}:$$(readlink -f build/native)" dh_auto_test
endif