#!/usr/bin/make -f

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

PACKAGE              := $(DEB_SOURCE_PACKAGE)
VERSION              := $(DEB_UPSTREAM_VERSION)
MVN_VERSION          := $(shell echo $(VERSION) | sed 's/~/-/')
JAVA_HOME            := /usr/lib/jvm/default-java
DEB_ANT_BUILD_TARGET := jar javadoc
DEB_ANT_BUILDFILE    := debian/build.xml
DEB_JARS             := commons-httpclient commons-lang commons-cli commons-collections \
                        commons-vfs2 junit jsch oro bcprov bcpg
API_DOCS             := api

binary-post-install/$(PACKAGE)::
	mh_installpoms -p$(PACKAGE)
	mh_installjar -p$(PACKAGE) -l debian/pom.xml ivy.jar

binary-post-install/$(PACKAGE)-doc::
	dh_install -p$(PACKAGE)-doc $(API_DOCS) usr/share/doc/$(PACKAGE)

clean::
	-rm -rf debian/tmp
	mh_clean

get-orig-source:
	-uscan --force-download --rename

get-orig-pom:
	wget -O debian/pom.xml http://repository.sonatype.org/service/local/repositories/central/content/org/apache/ivy/ivy/$(MVN_VERSION)/ivy-$(MVN_VERSION).pom

