#!/usr/bin/make -f
#vim: set noexpandtab sts=4 ts=4 sw=4 tw=80:
include /usr/share/dpkg/pkg-info.mk

JAVA_HOME=/usr/lib/jvm/default-java

ARTIFACT_ID = texhyphj
GROUP_ID = com.googlecode.texhyphj
ORIG_TAG = release-1.2
PACKAGE=libtexhyphj-java

%:
	dh $@ --with javahelper

override_dh_auto_clean:
	dh_auto_clean
	mh_clean

override_dh_auto_install:
	mh_installpom -p$(PACKAGE) --relocate=$(GROUP_ID):$(ARTIFACT_ID):3.x pom.xml
	mh_installjar -p$(PACKAGE) -n$(ARTIFACT_ID) --usj-version=3.x --java-lib \
		pom.xml ant-build/output/dist/texhyphj.jar

# repack original release to get a truly DFSG-free tarball; most files seem to
# be free, but are either binary or miss an explicit licencing stanza
get-orig-source:
	git clone --quiet https://github.com/joeha480/texhyphj;\
		cd texhyphj && git checkout --quiet $(ORIG_TAG) && cd ..; \
		mv texhyphj tmp; mv tmp/texhyphj .; rm -rf tmp; \
		rm -rf texhyphj/.git* texhyphj/.gradle texhyphj/gradle; \
		rm -rf texhyphj/src/test/resources/; \
		rm -rf texhyphj/lib; \
		tar cJf ../texhyphj_$(DEB_VERSION_UPSTREAM:+dfsg=)+dfsg.orig.tar.xz texhyphj; \
		rm -rf texhyphj
