#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

JAVA_HOME=/usr/lib/jvm/default-java
DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')

%:
	dh $@ --with javahelper --with python2

override_dh_auto_clean:
	dh_auto_clean
	rm -f metastudent.1

override_dh_auto_install:
	dh_auto_install
	find debian/metastudent -regex ".*/knn_weighted\|.*/CafaWrapper1\.pl\|.*/CafaWrapper2\.pl\|.*/CafaWrapper3\.pl\|.*/CafaWrapper3_new\.pl\|.*/exercise3\.pl\|.*/treehandler\.pl\|.*/validate\.pl" -exec chmod +x {} \;
	mv *.jar $(CURDIR)/debian/$(DEBPKGNAME)/usr/share/metastudent/
	# configuration files should reside in /etc
	mkdir -p $(CURDIR)/debian/$(DEBPKGNAME)/etc
	# accordint to manpage <sysconfdir>/metastudentrc overrides /usr/share/metastudent/metastudentrc.default
	cp -a $(CURDIR)/debian/$(DEBPKGNAME)/usr/share/metastudent/metastudentrc.default $(CURDIR)/debian/$(DEBPKGNAME)/etc/metastudentrc

# lkajan 20140106:
# The jars in d/metastudent.jlibs are for use by this package only, and should not end up in /usr/share/java.
override_jh_installlibs:
	exit 0;

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --destdir=../tarballs
