#!/usr/bin/make -f

# DH_VERBOSE := 1

%:
	dh $@ --with javahelper

override_dh_auto_clean:
	dh_auto_clean
	$(RM) goby-distribution/test-data
	-rm -rf test-results/

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Create a symlink to the directory with test data for tests run from the
	# goby-distribution directory.
	ln -s ../test-data goby-distribution/test-data
	# The test-results directory should exist because test classes will write inside.
	if [ ! -e test-results ]; then mkdir test-results/; fi
	# Putting the JRI location in the path, as indicated in GobyRengine.java.
	# Also indicating R_HOME, as found in http://rforge.net/JRI/.
	export LD_LIBRARY_PATH="$$LD_LIBRARY_PATH:/usr/lib/R/site-library/rJava/jri" && \
	        export R_HOME="/usr/lib/R" && \
	        dh_auto_test --no-parallel
endif