#!/usr/bin/make -f JSON_SIMPLE_JAR = /usr/share/java/json-simple.jar JSON_SIMPLE_VERSION = $(shell dpkg -l libjson-simple-java | grep '^ii' | awk '{print $$3}') JSON_SIMPLE_3 = $(shell dpkg --compare-versions '$(JSON_SIMPLE_VERSION)' '>' '3.1.1-1~' && echo yes || echo no) ifeq (yes,$(JSON_SIMPLE_3)) JSON_SIMPLE_PACKAGE = com.github.cliftonlabs.json_simple JSON_EXCEPTION = JsonException else JSON_SIMPLE_PACKAGE = org.json.simple JSON_EXCEPTION = DeserializationException endif %: dh $@ --builddirectory=Build override_dh_auto_clean: dh_auto_clean find . -type f -name \*.java.json-simple \ -exec sh -c 'file={} && mv $$file $${file%.json-simple}' \; -print override_dh_auto_configure: dh_auto_configure -- -DCMAKE_JAVA_INCLUDE_PATH=${JSON_SIMPLE_JAR} override_dh_auto_build: find . -type f -name \*.java -exec grep -q 'import @JSON_SIMPLE_PACKAGE@' {} \; \ -exec sed -i.json-simple \ -e 's,@JSON_SIMPLE_PACKAGE@,$(JSON_SIMPLE_PACKAGE),' \ -e 's/@JSON_EXCEPTION@/$(JSON_EXCEPTION)/' \ {} \; -print dh_auto_build override_dh_auto_install: dh_auto_install # Create symbolic link next to the "Orthanc_Import.jar" plugin, so that ImageJ # can locate the "json-simple.jar" package to be used dh_link ${JSON_SIMPLE_JAR} usr/share/imagej/plugins/Orthanc_Import_json-simple.jar override_dh_installchangelogs: dh_installchangelogs -k NEWS