Diff oracle-jdk-bin-1.8.0.202 with a oracle-jdk-bin-11.0.2

/usr/portage/dev-java/oracle-jdk-bin/oracle-jdk-bin-11.0.2.ebuild 2019-09-20 11:09:00.000000000 +0300
1
# Copyright 1999-2020 Gentoo Authors
1
# Copyright 1999-2019 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=6
5 5

  
6
inherit desktop eutils gnome2-utils java-vm-2 prefix versionator
6
inherit desktop gnome2-utils java-vm-2 prefix
7 7

  
8
KEYWORDS="-* amd64 ~arm ~arm64 x86 ~amd64-linux ~x86-linux ~x64-macos ~sparc64-solaris ~x64-solaris"
9

  
10
if [[ "$(get_version_component_range 4)" == 0 ]] ; then
11
	S_PV="$(get_version_component_range 1-3)"
12
else
13
	MY_PV_EXT="u$(get_version_component_range 4)"
14
	S_PV="$(get_version_component_range 1-4)"
15
fi
16

  
17
MY_PV="$(get_version_component_range 2)${MY_PV_EXT}"
8
KEYWORDS="-* ~amd64 ~x64-macos ~sparc64-solaris"
9
KEYWORDS="-* ~amd64"
18 10

  
19 11
declare -A ARCH_FILES
20
ARCH_FILES[amd64]="jdk-${MY_PV}-linux-x64.tar.gz"
21
ARCH_FILES[arm]="jdk-${MY_PV}-linux-arm32-vfp-hflt.tar.gz"
22
ARCH_FILES[arm64]="jdk-${MY_PV}-linux-arm64-vfp-hflt.tar.gz"
23
ARCH_FILES[x86]="jdk-${MY_PV}-linux-i586.tar.gz"
24
ARCH_FILES[x64-macos]="jdk-${MY_PV}-macosx-x64.dmg"
25
ARCH_FILES[sparc64-solaris]="jdk-${MY_PV}-solaris-sparcv9.tar.gz"
26
ARCH_FILES[x64-solaris]="jdk-${MY_PV}-solaris-x64.tar.gz"
12
ARCH_FILES[amd64]="jdk-${PV}_linux-x64_bin.tar.gz"
13
ARCH_FILES[sparc64-solaris]="jdk-${PV}_solaris-sparcv9_bin.tar.gz"
14
ARCH_FILES[x64-macos]="jdk-${PV}_osx-x64_bin.dmg"
27 15

  
28 16
for keyword in ${KEYWORDS//-\*} ; do
29
	case "${keyword#\~}" in
30
		*-linux) continue ;;
31
		x64-macos) demo="jdk-${MY_PV}-macosx-x86_64-demos.zip" ;;
32
		*) demo=${ARCH_FILES[${keyword#\~}]/./-demos.} ;;
33
	esac
34

  
35
	SRC_URI+="
36
		${keyword#\~}? (
37
			${ARCH_FILES[${keyword#\~}]}
38
			examples? ( ${demo} )
39
		)"
17
	SRC_URI+=" ${keyword#\~}? ( ${ARCH_FILES[${keyword#\~}]} )"
40 18
done
41 19

  
42 20
DESCRIPTION="Oracle's Java SE Development Kit"
43 21
HOMEPAGE="http://www.oracle.com/technetwork/java/javase/"
44
LICENSE="Oracle-BCLA-JavaSE examples? ( BSD )"
45
SLOT="1.8"
46
IUSE="alsa commercial cups doc examples +fontconfig headless-awt javafx jce nsplugin selinux source visualvm"
47
REQUIRED_USE="javafx? ( alsa fontconfig )"
22
LICENSE="Oracle-BCLA-JavaSE"
23
SLOT="${PV%%.*}"
24
IUSE="alsa commercial cups doc +fontconfig +gentoo-vm gtk2 gtk3 headless-awt javafx nsplugin selinux source"
25
REQUIRED_USE="javafx? ( alsa fontconfig ^^ ( gtk2 gtk3 ) )"
48 26
RESTRICT="bindist fetch preserve-libs strip"
49 27
QA_PREBUILT="*"
50 28

  
......
68 46
			x11-libs/libXtst
69 47
		)
70 48
		javafx? (
49
			dev-libs/atk
71 50
			dev-libs/glib:2
72 51
			dev-libs/libxml2:2
73 52
			dev-libs/libxslt
74 53
			media-libs/freetype:2
75
			x11-libs/cairo
76
			x11-libs/gtk+:2
54
			x11-libs/gdk-pixbuf
77 55
			x11-libs/libX11
78 56
			x11-libs/libXtst
79 57
			x11-libs/libXxf86vm
80 58
			x11-libs/pango
81 59
			virtual/opengl
60

  
61
			gtk2? (
62
				x11-libs/cairo
63
				x11-libs/gtk+:2
64
			)
65
			gtk3? (
66
				x11-libs/cairo[glib]
67
				x11-libs/gtk+:3
68
			)
82 69
		)
83 70
	)
71
	!prefix? (
72
		dev-libs/elfutils
73
		sys-libs/glibc:*
74
	)
84 75
	alsa? ( media-libs/alsa-lib )
85 76
	cups? ( net-print/cups )
86 77
	doc? ( dev-java/java-sdk-docs:${SLOT} )
87 78
	fontconfig? ( media-libs/fontconfig:1.0 )
88
	!prefix? ( sys-libs/glibc:* )
89 79
	selinux? ( sec-policy/selinux-java )"
90 80

  
91
DEPEND="app-arch/zip
92
	examples? ( x64-macos? ( app-arch/unzip ) )"
93

  
94
S="${WORKDIR}/jdk$(replace_version_separator 3 _  ${S_PV})"
95

  
96 81
pkg_nofetch() {
97
	local a
98
	einfo "Please download these files and move them to your distfiles directory:"
99
	einfo
100
	for a in ${A} ; do
101
		[[ ! -f ${DISTDIR}/${a} ]] && einfo "  ${a}"
102
	done
82
	einfo "Please download ${ARCH_FILES[${ARCH}]} and move it to"
83
	einfo "your distfiles directory:"
103 84
	einfo
104
	einfo "  http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html"
85
	einfo "  https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html"
105 86
	einfo
106 87
	einfo "If the above mentioned URL does not point to the correct version anymore,"
107 88
	einfo "please download the file from Oracle's Java download archive:"
108 89
	einfo
109
	einfo "  http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html"
90
	einfo "  https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase11-5116896.html"
110 91
	einfo
111 92
}
112 93

  
113 94
src_unpack() {
114 95
	if use x64-macos ; then
96
		S="${WORKDIR}/Contents/Home"
115 97
		mkdir -p "${T}"/dmgmount || die
116
		hdiutil attach "${DISTDIR}"/jdk-${MY_PV}-macosx-x64.dmg \
117
			-mountpoint "${T}"/dmgmount || die
118
		local jdkgen=$(get_version_component_range 2)
119
		local uver=$(get_version_component_range 4)
98
		hdiutil attach "${DISTDIR}/${A}" -mountpoint "${T}"/dmgmount || die
120 99
		( cd "${T}" &&
121
		  xar -xf "${T}/dmgmount/JDK ${jdkgen} Update ${uver}.pkg" \
100
		  xar -xf "${T}/dmgmount/JDK ${PV}.pkg" \
122 101
		  jdk${PV//.}.pkg/Payload ) || die
123 102
		zcat "${T}"/jdk${PV//.}.pkg/Payload | cpio -idv || die
124 103
		hdiutil detach "${T}"/dmgmount || die
125
		mv Contents/Home "${S}" || die
104
	else
105
		S="${WORKDIR}/jdk-${PV}"
106
		default
126 107
	fi
127

  
128
	default
129
}
130

  
131
src_prepare() {
132
	default
133

  
134
	if [[ -n ${JAVA_PKG_STRICT} ]] ; then
135
		# Mark this binary early to run it now.
136
		pax-mark m ./bin/javap
137

  
138
		eqawarn "Ensure that this only calls trackJavaUsage(). If not, see bug #559936."
139
		eqawarn
140
		eqawarn "$(./bin/javap -J-Duser.home=${T} -c sun.misc.PostVMInitHook || die)"
141
	fi
142

  
143
	# Remove the hook that calls Oracle's evil usage tracker. Not just
144
	# because it's evil but because it breaks the sandbox during builds
145
	# and we can't find any other feasible way to disable it or make it
146
	# write somewhere else. See bug #559936 for details.
147
	zip -d jre/lib/rt.jar sun/misc/PostVMInitHook.class || die
148 108
}
149 109

  
150 110
src_install() {
......
152 112
	local ddest="${ED}${dest#/}"
153 113

  
154 114
	# Create files used as storage for system preferences.
155
	mkdir jre/.systemPrefs || die
156
	touch jre/.systemPrefs/.system.lock || die
157
	touch jre/.systemPrefs/.systemRootModFile || die
115
	mkdir .systemPrefs || die
116
	touch .systemPrefs/.system.lock || die
117
	touch .systemPrefs/.systemRootModFile || die
158 118

  
159 119
	if ! use alsa ; then
160
		rm -vf jre/lib/*/libjsoundalsa.* || die
120
		rm -vf lib/libjsoundalsa.* || die
161 121
	fi
162 122

  
163 123
	if ! use commercial ; then
164
		rm -vfr lib/missioncontrol jre/lib/jfr* || die
124
		rm -vfr jmods/*.jfr.* lib/jfr* \
125
			lib/missioncontrol || die
165 126
	fi
166 127

  
167 128
	if use headless-awt ; then
168
		rm -vf {,jre/}lib/*/lib*{[jx]awt,splashscreen}* \
169
		   {,jre/}bin/{javaws,policytool} \
170
		   bin/appletviewer || die
129
		rm -vf lib/lib*{[jx]awt,splashscreen}* \
130
		   bin/{appletviewer,javaws,policytool} || die
171 131
	fi
172 132

  
173 133
	if ! use javafx ; then
174
		rm -vf jre/lib/*/lib*{decora,fx,glass,prism}* \
175
		   jre/lib/*/libgstreamer-lite.* {,jre/}lib/{,ext/}*fx* \
176
		   bin/*javafx* bin/javapackager || die
134
		rm -vf lib/lib*{decora,fx,glass,prism}* \
135
		   lib/libgstreamer-lite.* lib/*fx* \
136
		   bin/javapackager jmods/javafx* || die
137
	else
138
		if ! use gtk2 ; then
139
			rm -vf lib/libglassgtk2.* || die
140
		elif ! use gtk3 ; then
141
			rm -vf lib/libglassgtk3.* || die
142
		fi
177 143
	fi
178 144

  
179 145
	if ! use nsplugin ; then
180
		rm -vf jre/lib/*/libnpjp2.* || die
146
		rm -vf lib/libnpjp2.* || die
181 147
	else
182
		local nsplugin=$(echo jre/lib/*/libnpjp2.*)
148
		local nsplugin=$(echo lib/libnpjp2.*)
183 149
		local nsplugin_link=${nsplugin##*/}
184 150
		nsplugin_link=${nsplugin_link/./-${PN}-${SLOT}.}
185 151
		dosym "${dest}/${nsplugin}" "/usr/$(get_libdir)/nsbrowser/plugins/${nsplugin_link}"
186 152
	fi
187 153

  
154
	if ! use source ; then
155
		rm -v lib/src.zip || die
156
	fi
157

  
188 158
	# Even though plugins linked against multiple ffmpeg versions are
189 159
	# provided, they generally lag behind what Gentoo has available.
190
	rm -vf jre/lib/*/libavplugin* || die
160
	rm -vf lib/libavplugin* || die
191 161

  
192
	# Prune all fontconfig files so that libfontconfig will be used.
193
	rm -v jre/lib/fontconfig.* || die
194

  
195
	# Packaged as dev-util/visualvm but some users prefer this version.
196
	use visualvm || find -name "*visualvm*" -exec rm -vfr {} + || die
162
#       # Prune all fontconfig files so that libfontconfig will be used.
163
#       rm -v lib/fontconfig.* || die
197 164

  
198 165
	# Install desktop file for the Java Control Panel. Using
199 166
	# ${PN}-${SLOT} to prevent file collision with JRE and other slots.
200
	if [[ -d jre/lib/desktop/icons ]] ; then
167
	if [[ -d lib/desktop/icons ]] ; then
201 168
		local icon
202
		pushd jre/lib/desktop/icons >/dev/null || die
169
		pushd lib/desktop/icons >/dev/null || die
203 170
		for icon in */*/apps/sun-jcontrol.png ; do
204 171
			insinto /usr/share/icons/"${icon%/*}"
205 172
			newins "${icon}" sun-jcontrol-${PN}-${SLOT}.png
......
212 179
			"Settings;Java;"
213 180
	fi
214 181

  
215
	dodoc COPYRIGHT
216 182
	dodir "${dest}"
217
	cp -pPR bin include jre lib man "${ddest}" || die
218

  
219
	if use examples && [[ ${A} = *-demos.* ]] ; then
220
		cp -pPR demo sample "${ddest}" || die
221
	fi
222

  
223
	ln -s policy/$(usex jce unlimited limited)/{US_export,local}_policy.jar \
224
		"${ddest}"/jre/lib/security/ || die
225

  
226
	if use source ; then
227
		cp -v src.zip "${ddest}" || die
228

  
229
		if use javafx ; then
230
			cp -v javafx-src.zip "${ddest}" || die
231
		fi
232
	fi
183
	cp -pPR bin conf include jmods lib "${ddest}" || die
233 184

  
234 185
	# Only install Gentoo-specific fontconfig if flag is disabled.
235 186
	# https://docs.oracle.com/javase/8/docs/technotes/guides/intl/fontconfig.html
236 187
	if ! use fontconfig ; then
237
		insinto "${dest}"/jre/lib/
188
		insinto "${dest}"/lib/
238 189
		doins "$(prefixify_ro "${FILESDIR}"/fontconfig.properties)"
239 190
	fi
240 191

  
......
243 194

  
244 195
	# See bug #207282.
245 196
	einfo "Creating the Class Data Sharing archives"
246
	case ${ARCH} in
247
		arm|ia64)
248
			${ddest}/bin/java -client -Xshare:dump || die
249
			;;
250
		x86)
251
			${ddest}/bin/java -client -Xshare:dump || die
252
			# limit heap size for large memory on x86 #467518
253
			# this is a workaround and shouldn't be needed.
254
			${ddest}/bin/java -server -Xms64m -Xmx64m -Xshare:dump || die
255
			;;
256
		*)
257
			${ddest}/bin/java -server -Xshare:dump || die
258
			;;
259
	esac
197
	# "${ddest}/bin/java" -server -Xshare:dump || die
198
	"${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
260 199

  
261 200
	# Remove empty dirs we might have copied.
262 201
	find "${D}" -type d -empty -exec rmdir -v {} + || die
......
266 205
		for lib in lib{decora_sse,glass,prism_{common,es2,sw}}.dylib ; do
267 206
			ebegin "Fixing self-reference of ${lib}"
268 207
			install_name_tool \
269
				-id "${EPREFIX}${dest}"/jre/lib/${lib} \
270
				"${ddest}"/jre/lib/${lib} || die
208
				-id "${EPREFIX}${dest}"/lib/${lib} \
209
				"${ddest}"/lib/${lib} || die
271 210
			eend $?
272 211
		done
273 212
	fi
274 213

  
275
	java-vm_install-env "${FILESDIR}"/${PN}.env.sh
214
	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-9.env.sh
276 215
	java-vm_revdep-mask
277 216
	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
278 217
}
......
289 228
		ewarn "You have disabled the javafx flag. Some modern desktop Java applications"
290 229
		ewarn "require this and they may fail with a confusing error message."
291 230
	fi
231

  
232
	if use gentoo-vm ; then
233
		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
234
		ewarn "recognised by the system. This will almost certainly break things."
235
	else
236
		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
237
		ewarn "will not be recognised by the system. For example, simply calling"
238
		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
239
		ewarn "fully supports Java 9. This JDK must therefore be invoked using its"
240
		ewarn "absolute location under ${EPREFIX}/opt/${P}."
241
	fi
292 242
}
293 243

  
294 244
pkg_postrm() {
Thank you!