#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export JAVA_HOME=/usr/lib/jvm/default-java
CURVER := $(shell dpkg-parsechangelog | grep ^Version | cut -d\  -f2 | cut -d- -f1 )

override_dh_auto_build:
	mh_patchpoms -plibhttpcore-java --debian-build --keep-pom-version
	# Some tests of httpcore-nio fail on debomatic,
	# while work fine in my cowbuilder.
	mvn-debian -Dmaven.test.skip=true package

override_dh_auto_install:
	dh_auto_install
	mh_installpoms -plibhttpcore-java
	mh_installjar -plibhttpcore-java -l httpcore/pom.xml httpcore/target/httpcore*.jar
	mh_installjar -plibhttpcore-java -l httpcore-nio/pom.xml httpcore-nio/target/httpcore*.jar
	# remember to add pom-osgi.xml to the .poms file
#	mh_installjar -plibhttpcore-java -l debian/pom-osgi.xml httpcore-osgi/target/httpcore*.jar

override_dh_clean:
	mh_unpatchpoms -plibhttpcore-java
	dh_clean
	mh_clean
	rm -rf httpcore*/target/

%:
	dh $@

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

