Diff openjdk-8.382_p05 with a openjdk-11.0.18_p10

/usr/portage/dev-java/openjdk/openjdk-11.0.18_p10.ebuild 2023-10-09 14:52:29.436368349 +0300
3 3

  
4 4
EAPI=7
5 5

  
6
inherit check-reqs eapi8-dosym flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
6
inherit eapi8-dosym check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
7 7

  
8 8
# don't change versioning scheme
9 9
# to find correct _p number, look at
......
13 13
# -ga tag is just for humans to easily identify General Availability release tag.
14 14
# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
15 15
# set build version properly
16
MY_PV="$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)"
17
SLOT="${PV%%[.+]*}"
16
MY_PV="${PV%_p*}-ga"
17
SLOT="${MY_PV%%[.+]*}"
18

  
19
# variable name format: <UPPERCASE_KEYWORD>_XPAK
20
PPC64_XPAK="11.0.13_p8" # big-endian bootstrap tarball
21
RISCV_XPAK="11.0.14_p9" # lp64d bootstrap tarball
22
X86_XPAK="11.0.13_p8"
23

  
24
# Usage: bootstrap_uri <keyword> <version> [extracond]
25
# Example: $(bootstrap_uri ppc64 17.0.1_p12 big-endian)
26
# Output: ppc64? ( big-endian? ( https://...17.0.1_p12-ppc64.tar.xz ) )
27
bootstrap_uri() {
28
	local baseuri="https://dev.gentoo.org/~arthurzam/distfiles/dev-java/${PN}/${PN}-bootstrap"
29
	local suff="tar.xz"
30
	local kw="${1:?${FUNCNAME[0]}: keyword not specified}"
31
	local ver="${2:?${FUNCNAME[0]}: version not specified}"
32
	local cond="${3-}"
33

  
34
	# here be dragons
35
	echo "${kw}? ( ${cond:+${cond}? (} ${baseuri}-${ver}-${kw}.${suff} ${cond:+) })"
36
}
18 37

  
19 38
DESCRIPTION="Open source implementation of the Java programming language"
20 39
HOMEPAGE="https://openjdk.org"
21
SRC_URI="https://github.com/openjdk/jdk${SLOT}u/archive/refs/tags/jdk${MY_PV}.tar.gz -> ${P}.tar.gz"
40
SRC_URI="
41
	https://github.com/${PN}/jdk${SLOT}u/archive/refs/tags/jdk-${MY_PV}.tar.gz
42
		-> ${P}.tar.gz
43
	!system-bootstrap? (
44
		$(bootstrap_uri ppc64 ${PPC64_XPAK} big-endian)
45
		$(bootstrap_uri riscv ${RISCV_XPAK})
46
		$(bootstrap_uri x86 ${X86_XPAK})
47
	)
48
	riscv? ( https://dev.gentoo.org/~arthurzam/distfiles/dev-java/openjdk/openjdk-11.0.18-riscv.patch.xz )
49
"
22 50

  
23 51
LICENSE="GPL-2-with-classpath-exception"
24
KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
25
IUSE="alsa debug cups doc examples headless-awt javafx +jbootstrap selinux source"
52
KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86"
53

  
54
IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap lto selinux source system-bootstrap systemtap"
55

  
56
REQUIRED_USE="
57
	javafx? ( alsa !headless-awt )
58
	!system-bootstrap? ( jbootstrap )
59
"
26 60

  
27 61
COMMON_DEPEND="
28 62
	media-libs/freetype:2=
29 63
	media-libs/giflib:0/7
64
	media-libs/harfbuzz:=
65
	media-libs/libpng:0=
66
	media-libs/lcms:2=
30 67
	sys-libs/zlib
68
	media-libs/libjpeg-turbo:0=
69
	systemtap? ( dev-util/systemtap )
31 70
"
71

  
32 72
# Many libs are required to build, but not to run, make is possible to remove
33 73
# by listing conditionally in RDEPEND unconditionally in DEPEND
34 74
RDEPEND="
......
38 78
		x11-libs/libX11
39 79
		x11-libs/libXext
40 80
		x11-libs/libXi
81
		x11-libs/libXrandr
41 82
		x11-libs/libXrender
42 83
		x11-libs/libXt
43 84
		x11-libs/libXtst
......
52 93
	app-arch/zip
53 94
	media-libs/alsa-lib
54 95
	net-print/cups
55
	virtual/pkgconfig
56 96
	x11-base/xorg-proto
57 97
	x11-libs/libX11
58 98
	x11-libs/libXext
59 99
	x11-libs/libXi
100
	x11-libs/libXrandr
60 101
	x11-libs/libXrender
61 102
	x11-libs/libXt
62 103
	x11-libs/libXtst
63
	|| (
64
		dev-java/openjdk-bin:${SLOT}
65
		dev-java/icedtea-bin:${SLOT}
66
		dev-java/openjdk:${SLOT}
67
		dev-java/icedtea:${SLOT}
104
	javafx? ( dev-java/openjfx:${SLOT}= )
105
	system-bootstrap? (
106
		|| (
107
			dev-java/openjdk-bin:${SLOT}[gentoo-vm(+)]
108
			dev-java/openjdk:${SLOT}[gentoo-vm(+)]
109
		)
68 110
	)
69 111
"
70 112

  
71
BDEPEND="
72
	virtual/pkgconfig
73
"
74

  
75
PDEPEND="javafx? ( dev-java/openjfx:${SLOT} )"
76

  
77
S="${WORKDIR}/jdk${SLOT}u-jdk${MY_PV}"
78

  
79
PATCHES=( "${FILESDIR}/openjdk-8-insantiate-arrayallocator.patch" )
113
S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV}"
80 114

  
81 115
# The space required to build varies wildly depending on USE flags,
82 116
# ranging from 2GB to 16GB. This function is certainly not exact but
......
84 118
openjdk_check_requirements() {
85 119
	local M
86 120
	M=2048
87
	M=$(( $(usex debug 3 1) * $M ))
88 121
	M=$(( $(usex jbootstrap 2 1) * $M ))
122
	M=$(( $(usex debug 3 1) * $M ))
89 123
	M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
90 124

  
91 125
	CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
......
100 134

  
101 135
pkg_setup() {
102 136
	openjdk_check_requirements
137
	java-vm-2_pkg_setup
138

  
139
	[[ ${MERGE_TYPE} == "binary" ]] && return
103 140

  
104
	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
141
	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
105 142
	JAVA_PKG_WANT_SOURCE="${SLOT}"
106 143
	JAVA_PKG_WANT_TARGET="${SLOT}"
107 144

  
108
	java-vm-2_pkg_setup
109
	java-pkg-2_pkg_setup
145
	if use system-bootstrap; then
146
		for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
147
			if [[ -d ${BROOT}/usr/lib/jvm/${vm} ]]; then
148
				java-pkg-2_pkg_setup
149
				return
150
			fi
151
		done
152
	fi
110 153
}
111 154

  
112 155
src_prepare() {
156
	use riscv && eapply "${WORKDIR}"/openjdk-11.0.18-riscv.patch
113 157
	default
114

  
115
	# new warnings in new gcc https://bugs.gentoo.org/685426
116
	sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
117
		hotspot/make/linux/makefiles/gcc.make || die
118

  
119 158
	chmod +x configure || die
120 159
}
121 160

  
122 161
src_configure() {
123
	# general build info found here:
124
	#https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
162
	if ! use system-bootstrap; then
163
		local xpakvar="${ARCH^^}_XPAK"
164
		export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
165
	fi
125 166

  
126 167
	# Work around stack alignment issue, bug #647954.
127 168
	use x86 && append-flags -mincoming-stack-boundary=2
128 169

  
129
	# Work around -fno-common ( GCC10 default ), bug #706638
170
	# Work around -fno-common ( GCC10 default ), bug #713180
130 171
	append-flags -fcommon
131 172

  
132 173
	# Strip some flags users may set, but should not. #818502
133 174
	filter-flags -fexceptions
134 175

  
135
	# Strip lto related flags, no support in this version.
176
	# Strip lto related flags, we rely on USE=lto and --with-jvm-features=link-time-opt
136 177
	# https://bugs.gentoo.org/833097
137 178
	# https://bugs.gentoo.org/833098
138 179
	filter-lto
139 180
	filter-flags -fdevirtualize-at-ltrans
140 181

  
141
	tc-export_build_env CC CXX PKG_CONFIG STRIP
182
	# Enabling full docs appears to break doc building. If not
183
	# explicitly disabled, the flag will get auto-enabled if pandoc and
184
	# graphviz are detected. pandoc has loads of dependencies anyway.
142 185

  
143 186
	local myconf=(
144
			--disable-ccache
145
			--disable-freetype-bundling
146
			--disable-precompiled-headers
147
			--enable-unlimited-crypto
148
			--with-boot-jdk="${JDK_HOME}"
149
			--with-extra-cflags="${CFLAGS}"
150
			--with-extra-cxxflags="${CXXFLAGS}"
151
			--with-extra-ldflags="${LDFLAGS}"
152
			--with-freetype-lib="$( $(tc-getPKG_CONFIG) --variable=libdir freetype2 )"
153
			--with-freetype-include="$( $(tc-getPKG_CONFIG) --variable=includedir freetype2)/freetype2"
154
			--with-giflib=system
155
			--with-jtreg=no
156
			--with-jobs=1
157
			--with-num-cores=1
158
			--with-update-version="$(ver_cut 2)"
159
			--with-build-number="b$(ver_cut 4)"
160
			--with-milestone="fcs" # magic variable that means "release version"
161
			--with-vendor-name="Gentoo"
162
			--with-vendor-url="https://gentoo.org"
163
			--with-vendor-bug-url="https://bugs.gentoo.org"
164
			--with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
165
			--with-zlib=system
166
			--with-native-debug-symbols=$(usex debug internal none)
167
			$(usex headless-awt --disable-headful '')
168
			$(tc-is-clang && echo "--with-toolchain-type=clang")
169
		)
187
		--disable-ccache
188
		--disable-precompiled-headers
189
		--enable-full-docs=no
190
		--with-boot-jdk="${JDK_HOME}"
191
		--with-extra-cflags="${CFLAGS}"
192
		--with-extra-cxxflags="${CXXFLAGS}"
193
		--with-extra-ldflags="${LDFLAGS}"
194
		--with-freetype="${XPAK_BOOTSTRAP:-system}"
195
		--with-giflib="${XPAK_BOOTSTRAP:-system}"
196
		--with-harfbuzz="${XPAK_BOOTSTRAP:-system}"
197
		--with-lcms="${XPAK_BOOTSTRAP:-system}"
198
		--with-libjpeg="${XPAK_BOOTSTRAP:-system}"
199
		--with-libpng="${XPAK_BOOTSTRAP:-system}"
200
		--with-native-debug-symbols=$(usex debug internal none)
201
		--with-vendor-name="Gentoo"
202
		--with-vendor-url="https://gentoo.org"
203
		--with-vendor-bug-url="https://bugs.gentoo.org"
204
		--with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
205
		--with-vendor-version-string="${PVR}"
206
		--with-version-pre=""
207
		--with-version-string="${PV%_p*}"
208
		--with-version-build="${PV#*_p}"
209
		--with-zlib="${XPAK_BOOTSTRAP:-system}"
210
		--enable-dtrace=$(usex systemtap yes no)
211
		--enable-headless-only=$(usex headless-awt yes no)
212
		$(tc-is-clang && echo "--with-toolchain-type=clang")
213
	)
214
	! use riscv && myconf+=( --with-jvm-features=shenandoahgc )
215

  
216
	use lto && myconf+=( --with-jvm-features=link-time-opt )
217

  
218
	if use javafx; then
219
		# this is not useful for users, just for upstream developers
220
		# build system compares mesa version in md file
221
		# https://bugs.gentoo.org/822612
222
		export LEGAL_EXCLUDES=mesa3d.md
223

  
224
		local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
225
		if [[ -r ${zip} ]]; then
226
			myconf+=( --with-import-modules="${zip}" )
227
		else
228
			die "${zip} not found or not readable"
229
		fi
230
	fi
231

  
232
	if use !system-bootstrap ; then
233
		addpredict /dev/random
234
		addpredict /proc/self/coredump_filter
235
	fi
170 236

  
171 237
	(
172
		unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC MAKE XARGS
238
		unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
173 239
		CFLAGS= CXXFLAGS= LDFLAGS= \
174 240
		CONFIG_SITE=/dev/null \
175
		CONFIG_SHELL="${BROOT}/bin/bash"
176 241
		econf "${myconf[@]}"
177 242
	)
178 243
}
......
188 253
		CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
189 254
		NICE= # Use PORTAGE_NICENESS, don't adjust further down
190 255
		$(usex doc docs '')
191
		$(usex jbootstrap bootcycle-images images)
256
		$(usex jbootstrap bootcycle-images product-images)
192 257
	)
193 258
	emake "${myemakeargs[@]}" -j1 #nowarn
194 259
}
......
197 262
	local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
198 263
	local ddest="${ED}/${dest#/}"
199 264

  
200
	cd "${S}"/build/*-release/images/j2sdk-image || die
201

  
202
	if ! use alsa; then
203
		rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
204
	fi
265
	cd "${S}"/build/*-release/images/jdk || die
205 266

  
206
	# build system does not remove that
207
	if use headless-awt ; then
208
		rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
209
		{,jre/}bin/policytool bin/appletviewer || die
267
	# Create files used as storage for system preferences.
268
	mkdir .systemPrefs || die
269
	touch .systemPrefs/.system.lock || die
270
	touch .systemPrefs/.systemRootModFile || die
271

  
272
	# Oracle and IcedTea have libjsoundalsa.so depending on
273
	# libasound.so.2 but OpenJDK only has libjsound.so. Weird.
274
	if ! use alsa ; then
275
		rm -v lib/libjsound.* || die
210 276
	fi
211 277

  
212 278
	if ! use examples ; then
......
214 280
	fi
215 281

  
216 282
	if ! use source ; then
217
		rm -v src.zip || die
283
		rm -v lib/src.zip || die
218 284
	fi
219 285

  
286
	rm -v lib/security/cacerts || die
287

  
220 288
	dodir "${dest}"
221 289
	cp -pPR * "${ddest}" || die
222 290

  
223
	dosym8 -r /etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
291
	dosym8 -r /etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
224 292

  
225
	java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
293
	# must be done before running itself
226 294
	java-vm_set-pax-markings "${ddest}"
295

  
296
	einfo "Creating the Class Data Sharing archives and disabling usage tracking"
297
	"${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
298

  
299
	java-vm_install-env "${FILESDIR}"/${PN}.env.sh
227 300
	java-vm_revdep-mask
228 301
	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
229 302

  
230 303
	if use doc ; then
231 304
		docinto html
232
		dodoc -r "${S}"/build/*-release/docs/*
305
		dodoc -r "${S}"/build/*-release/images/docs/*
306
		dosym8 -r /usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
233 307
	fi
234 308
}
235 309

  
236 310
pkg_postinst() {
237 311
	java-vm-2_pkg_postinst
238
	einfo "JavaWebStart functionality provided by icedtea-web package"
239 312
}
Thank you!