#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/ant.mk

JAVA_HOME            := /usr/lib/jvm/default-java
ANT_HOME             := /usr/share/ant
DEB_ANT_COMPILER     := modern
DEB_ANT_BUILD_TARGET := debiandist
DEB_BUILDDIR         := .
DEB_ANT_BUILDFILE    := build.xml
DEB_ANT_CLEAN_TARGET := clean

clean::
	-rm -Rf build doc test dist build.xml debian/stax2-api.patched.pom
	mh_clean

configure/libstax2-api-java::
	# Move build.xml to the root dir
	cp debian/build.xml build.xml

	# Patch the POM to include the correct version number
	cp debian/stax2-api.pom debian/stax2-api.patched.pom
	sed -i debian/stax2-api.patched.pom -e 's/@VERSION@/$(DEB_UPSTREAM_VERSION)/g'

install/libstax2-api-java::
	mh_install -plibstax2-api-java

get-orig-source:
	uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
