summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 36ff4bd2dd84992a0da1f5617cea79faf6a81df2 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/make -f

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

, = ,
S = $(EMPTY) $(EMPTY)
mk_cslist = $(subst $(S),$(,)$(S),$(foreach v,$(1),$(v)-$(2)))
jrel = $(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)

p_jre		= gcj-jre
p_jhl		= gcj-jre-headless
p_jdk		= gcj-jdk
jdk_build_dep	=
v_jre		=
v_jdk		= $(v_jre)
provides	= java java2 java5
dversion	= 2:1.5-$(jrel)
jvmdir		= java-gcj

p_doc		= openjdk-7-doc

include debian/java_defaults.mk

ifneq (,$(filter $(DEB_HOST_ARCH),$(java9_architectures)))
  p_jre         = openjdk-9-jre
  p_jhl         = openjdk-9-jre-headless
  p_jdk         = openjdk-9-jdk
  jdk_build_dep = openjdk-8-jdk
  v_jre         = $(S)(>= 9~b74-1)
  v_jdk         = $(v_jre)
  provides      = java java2 java5 java6 java7 java8 java9
  dversion      = 2:1.9-$(jrel)
  jvmdir        = java-1.9.0-openjdk$(if $(DEB_HOST_MULTIARCH),-$(DEB_HOST_ARCH))
  p_doc         = openjdk-9-doc
else ifneq (,$(filter $(DEB_HOST_ARCH),$(java8_architectures)))
  p_jre         = openjdk-8-jre
  p_jhl         = openjdk-8-jre-headless
  p_jdk         = openjdk-8-jdk
  jdk_build_dep = openjdk-7-jdk
  v_jre         = $(S)(>= 8~b132-1)
  v_jdk         = $(v_jre)
  provides      = java java2 java5 java6 java7 java8
  dversion      = 2:1.8-$(jrel)
  jvmdir        = java-1.8.0-openjdk$(if $(DEB_HOST_MULTIARCH),-$(DEB_HOST_ARCH))
  p_doc         = openjdk-8-doc
else ifneq (,$(filter $(DEB_HOST_ARCH),$(java7_architectures)))
  p_jre		= openjdk-7-jre
  p_jhl		= openjdk-7-jre-headless
  p_jdk		= openjdk-7-jdk
  jdk_build_dep	= gcj-jdk
  v_jre		= $(S)(>= 7~u3-2.1.1)
  v_jdk		= $(v_jre)
  provides	= java java2 java5 java6 java7
  dversion	= 2:1.7-$(jrel)
  jvmdir	= java-1.7.0-openjdk$(if $(DEB_HOST_MULTIARCH),-$(DEB_HOST_ARCH))
endif

jre_provides	= $(call mk_cslist,$(provides),runtime)
jhl_provides	= $(call mk_cslist,$(provides),runtime-headless)
jdk_provides	= $(call mk_cslist,$(provides),sdk)


%:
	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-jdk-doc
	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_link -pgcj-native-helper /usr/share/doc/default-jdk          /usr/share/doc/gcj-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)' \
		'-Vjdk:builddep=$(jdk_build_dep)' \
		'-Vjre:arch=$(DEB_HOST_ARCH)' \
		'-Vjre:version=$(v_jre)' \
		'-Vjdk:version=$(v_jdk)' \
		'-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