#!/usr/bin/make -f
# debian/rules for biomaj
# Author: Olivier Sallou <olivier.sallou@irisa.fr>
# License: CeCILL

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

export ANT_HOME=/usr/share/ant
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")

%:
	dh $@ --with javahelper

override_dh_auto_build:
	echo ${JAVA_HOME}
	ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -f usr/share/biomaj/build.xml
	javac -source 1.5 -target 1.5 -d usr/share/biomaj/bin usr/share/biomaj/bin/Configurator.java

override_dh_install:
	dh_install
	mv debian/biomaj/etc/biomaj/db_properties/global.properties debian/biomaj/usr/share/biomaj/global.properties.tpl

override_dh_clean:
	dh_clean
	rm -rf usr/share/biomaj/build
	rm -rf usr/share/biomaj/dist
	rm -f usr/share/biomaj/lib/biomaj.jar
	rm -f usr/share/biomaj/bin/*.class

override_dh_fixperms:
	dh_fixperms
	chmod 600 debian/biomaj/usr/share/biomaj/global.properties.tpl
	chmod 644 debian/biomaj/usr/share/biomaj/sql/*.sql

