File: rules

package info (click to toggle)
orthanc-imagej 1.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 276 kB
  • sloc: java: 1,405; makefile: 30
file content (42 lines) | stat: -rwxr-xr-x 1,390 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/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