#!/usr/bin/make -f

export DH_OPTIONS
include /usr/share/dpkg/default.mk

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

%:
	dh  $@ --buildsystem=gradle --with javahelper

override_dh_clean:
	if [ -e src/main/resources/log4j.xml ] ; then rm src/main/resources/log4j.xml ; fi
	if [ -e src/main/resources-icons ]; then \
	        rm -rf src/main/resources-icons ; \
	fi
	rm -rf .java
	dh_clean

override_dh_auto_configure:
	cp debian/log4j.xml src/main/resources/
	# Converting my home-made svg icons into png ones
	cd debian/icons && \
	        inkscape -o Home24.png Home24.svg && \
	        inkscape -o Refresh24.png Refresh24.svg && \
	        inkscape -o Stop16.png Stop16.svg && \
	        inkscape -o ZoomIn24.png ZoomIn24.svg && \
	        inkscape -o ZoomOut24.png ZoomOut24.svg && \
	        mkdir ../../src/main/resources-icons && \
	        mv *.png ../../src/main/resources-icons/

override_dh_auto_install:
	dh_auto_install
	# Installing the icon of the software.
	mkdir -p debian/$(DEB_SOURCE)/usr/share/icons/hicolor/64x64/apps/
	cp src/main/resources/org/broad/igv/ui/resources/IGV_64.png debian/$(DEB_SOURCE)/usr/share/icons/hicolor/64x64/apps/igv.png