summaryrefslogtreecommitdiff
path: root/debian/rules
blob: fc5ae01b1c0a1aa5ddc3d5b013c9792b3186428b (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

release = $(shell dpkg-parsechangelog | grep -E ^Version: | sed "s/Version: 0.//")

DEB_HOST_ARCH      ?= $(shell dpkg-architecture --query DEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture --query DEB_HOST_MULTIARCH)

include debian/java_defaults.mk

p_jre		= openjdk-$(java_default_version)-jre
p_jhl		= openjdk-$(java_default_version)-jre-headless
p_jdk		= openjdk-$(java_default_version)-jdk
p_doc		= openjdk-$(java_default_version)-doc
dversion	= 2:1.$(java_default_version)-$(release)
jvmdir		= java-1.$(java_default_version).0-openjdk$(if $(DEB_HOST_MULTIARCH),-$(DEB_HOST_ARCH))

ifeq (5, $(java_default_version))
  p_jre		= gcj-jre
  p_jhl		= gcj-jre-headless
  p_jdk		= gcj-jdk
  p_doc		= openjdk-8-doc
  jvmdir	= java-gcj
endif

jre_provides	= java-runtime, java2-runtime, $(shell seq --format java%.f-runtime --separator ', ' 5 $(java_default_version))
jhl_provides	= java-runtime-headless, java2-runtime-headless, $(shell seq --format java%.f-runtime-headless --separator ', ' 5 $(java_default_version))
jdk_provides	= java-sdk, java2-sdk, $(shell seq --format java%.f-sdk --separator ', ' 5 $(java_default_version))


%:
	dh $@

override_dh_link:
	dh_link

	# Link /usr/lib/jvm/default-java to the default JRE
	dh_link -pdefault-jre-headless usr/lib/jvm/$(jvmdir) usr/lib/jvm/default-java

	# Link to the JDK documentation
	dh_link -pdefault-jdk-doc /usr/share/doc/$(p_doc)/api usr/share/doc/default-jre-headless/api
	dh_link -pdefault-jdk-doc /usr/share/doc/$(p_doc)/api usr/share/doc/default-jdk-doc/api

override_dh_installdocs:
	dh_installdocs -i

	# Install the changelog and copyright once in default-jre-headless and use links for the other packages
	dh_installdocs -pdefault-jre-headless
	dh_link -pdefault-jre       /usr/share/doc/default-jre-headless /usr/share/doc/default-jre
	dh_link -pdefault-jdk       /usr/share/doc/default-jre          /usr/share/doc/default-jdk

	dh_installdocs -pdefault-jdk-doc
	dh_installdocs -pgcj-native-helper

override_dh_gencontrol:
	dh_gencontrol -i
ifneq (,$(p_jre))
	dh_gencontrol -a -- \
		-v$(dversion) \
		'-Vjre=$(p_jre)' \
		'-Vjhl=$(p_jhl)' \
		'-Vjdk=$(p_jdk)' \
		'-Vdoc=$(p_doc)' \
		'-Vjre:arch=$(DEB_HOST_ARCH)' \
		'-Vjre:provides=$(jre_provides)' \
		'-Vjhl:provides=$(jhl_provides)' \
		'-Vjdk:provides=$(jdk_provides)'
endif

override_dh_builddeb:
	dh_builddeb -i
ifneq (,$(p_jre))
	dh_builddeb -a
endif