#!/usr/bin/make -f

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

PACKAGE			   := $(DEB_SOURCE_PACKAGE)
VERSION			   := $(DEB_UPSTREAM_VERSION)
JAVA_HOME          := /usr/lib/jvm/java-6-openjdk
DEB_JARS  := ant-nodeps commons-beanutils commons-codec commons-collections3 \
             commons-digester commons-jxpath commons-lang commons-logging    \
	     servlet-api
DEB_ANT_BUILD_TARGET := jar javadoc
DEB_ANT_BUILDFILE    := build.xml
DEB_ANT_ARGS         := -Dpackage=$(PACKAGE) -DartifactId=$(PACKAGE) -Dversion=$(VERSION)
API_DOCS             := dist/docs/api

binary-post-install/lib$(PACKAGE)-java::
	mh_installpoms -plib$(PACKAGE)-java
	mh_installjar -plib$(PACKAGE)-java -l pom.xml target/$(PACKAGE)-$(VERSION).jar

binary-post-install/lib$(PACKAGE)-java-doc::
	dh_install -plib$(PACKAGE)-java-doc $(API_DOCS) usr/share/doc/lib$(PACKAGE)-java

clean::
	-rm -rf debian/tmp

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

