#!/usr/bin/make -f
# -*- makefile -*-
# The get-orig-source was taken from:
# http://wiki.debian.org/SandroTosi/Svn_get-orig-source

SRC_PACKAGE = brailleutils
SRC_VERSION = 1.2~b
TARBALL = $(SRC_PACKAGE)_$(SRC_VERSION).orig.tar.gz
.PHONY: get-orig-source

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

%:
	dh $@ 

override_dh_auto_clean:
	-rm -rf ant-build/output/*

override_dh_auto_build:
	ant -DuseExternalJarsOnLinux=true

override_dh_auto_install:
	mkdir -p debian/libbrailleutils-java/usr/share/java
	cp ant-build/output/dist/*.jar debian/libbrailleutils-java/usr/share/java/


get-orig-source:
	rm -rf get-orig-source $(TARBALL)
	mkdir get-orig-source
	svn export https://brailleutils.googlecode.com/svn/tags/release_1.2_beta \
		get-orig-source/$(SRC_PACKAGE)-$(SRC_VERSION).orig
	# Remove $SRC/lib and $SRC/ant-build/resources, because it's not necessary in Debian, dependencies are in Debian itself available
	rm -rf get-orig-source/$(SRC_PACKAGE)-$(SRC_VERSION).orig/lib
	rm -rf get-orig-source/$(SRC_PACKAGE)-$(SRC_VERSION).orig/ant-build/resources
	GZIP='--best --no-name' tar czf $(TARBALL) -C get-orig-source $(SRC_PACKAGE)-$(SRC_VERSION).orig
	rm -rf get-orig-source
	mv $(TARBALL) ..

