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

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

CURVER := $(shell dpkg-parsechangelog | grep ^Version | cut -d\  -f2 | cut -d- -f1 )

override_dh_auto_build:
	# 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 debian/pom.xml httpcore/target/httpcore*.jar
	mh_installjar -plibhttpcore-java -l debian/pom-nio.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:
	dh_clean
	rm -rf httpcore*/target/

%:
	dh $@

get-orig-pom:
	wget -O debian/pom.xml http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/httpcomponents/httpcore/$(CURVER)/httpcore-$(CURVER).pom
	wget -O debian/pom-nio.xml http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/httpcomponents/httpcore-nio/$(CURVER)/httpcore-nio-$(CURVER).pom
#	wget -O debian/pom-osgi.xml http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/httpcomponents/httpcore-osgi/$(CURVER)/httpcore-osgi$(CURVER).pom
