3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
6 |
|
inherit eapi8-dosym check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
|
7 |
|
|
8 |
|
# don't change versioning scheme
|
9 |
|
# to find correct _p number, look at
|
10 |
|
# https://github.com/openjdk/jdk${SLOT}u/tags
|
11 |
|
# you will see, for example, jdk-17.0.4.1-ga and jdk-17.0.4.1+1, both point
|
12 |
|
# to exact same commit sha. we should always use the full version.
|
13 |
|
# -ga tag is just for humans to easily identify General Availability release tag.
|
14 |
|
# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
|
15 |
|
# set build version properly
|
16 |
|
MY_PV="${PV%_p*}-ga"
|
17 |
|
SLOT="${MY_PV%%[.+]*}"
|
|
6 |
inherit check-reqs eapi8-dosym flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
|
18 |
7 |
|
19 |
8 |
# 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"
|
|
9 |
ARM64_XPAK="17.0.2_p8" # musl bootstrap install
|
|
10 |
PPC64_XPAK="17.0.1_p12" # big-endian bootstrap tarball
|
|
11 |
RISCV_XPAK="17.0.3_p7"
|
|
12 |
X86_XPAK="17.0.1_p12"
|
23 |
13 |
|
24 |
14 |
# Usage: bootstrap_uri <keyword> <version> [extracond]
|
25 |
15 |
# Example: $(bootstrap_uri ppc64 17.0.1_p12 big-endian)
|
... | ... | |
30 |
20 |
local kw="${1:?${FUNCNAME[0]}: keyword not specified}"
|
31 |
21 |
local ver="${2:?${FUNCNAME[0]}: version not specified}"
|
32 |
22 |
local cond="${3-}"
|
|
23 |
[[ ${cond} == elibc_musl* ]] && local musl=yes
|
33 |
24 |
|
34 |
25 |
# here be dragons
|
35 |
|
echo "${kw}? ( ${cond:+${cond}? (} ${baseuri}-${ver}-${kw}.${suff} ${cond:+) })"
|
|
26 |
echo "${kw}? ( ${cond:+${cond}? (} ${baseuri}-${ver}-${kw}${musl:+-musl}.${suff} ${cond:+) })"
|
36 |
27 |
}
|
37 |
28 |
|
|
29 |
# don't change versioning scheme
|
|
30 |
# to find correct _p number, look at
|
|
31 |
# https://github.com/openjdk/jdk${SLOT}u/tags
|
|
32 |
# you will see, for example, jdk-17.0.4.1-ga and jdk-17.0.4.1+1, both point
|
|
33 |
# to exact same commit sha. we should always use the full version.
|
|
34 |
# -ga tag is just for humans to easily identify General Availability release tag.
|
|
35 |
MY_PV="${PV%_p*}-ga"
|
|
36 |
SLOT="${MY_PV%%[.+]*}"
|
|
37 |
|
38 |
38 |
DESCRIPTION="Open source implementation of the Java programming language"
|
39 |
39 |
HOMEPAGE="https://openjdk.org"
|
40 |
40 |
SRC_URI="
|
41 |
41 |
https://github.com/${PN}/jdk${SLOT}u/archive/refs/tags/jdk-${MY_PV}.tar.gz
|
42 |
42 |
-> ${P}.tar.gz
|
43 |
43 |
!system-bootstrap? (
|
|
44 |
$(bootstrap_uri arm64 ${ARM64_XPAK} elibc_musl)
|
44 |
45 |
$(bootstrap_uri ppc64 ${PPC64_XPAK} big-endian)
|
45 |
|
$(bootstrap_uri riscv ${RISCV_XPAK})
|
46 |
46 |
$(bootstrap_uri x86 ${X86_XPAK})
|
|
47 |
$(bootstrap_uri riscv ${RISCV_XPAK})
|
47 |
48 |
)
|
48 |
|
riscv? ( https://dev.gentoo.org/~arthurzam/distfiles/dev-java/openjdk/openjdk-11.0.18-riscv.patch.xz )
|
|
49 |
riscv? ( https://dev.gentoo.org/~gyakovlev/distfiles/dev-java/openjdk/java17-riscv64.patch )
|
49 |
50 |
"
|
|
51 |
# riscv patch origin:
|
|
52 |
# https://raw.githubusercontent.com/felixonmars/archriscv-packages/master/java17-openjdk/java17-riscv64.patch
|
50 |
53 |
|
51 |
54 |
LICENSE="GPL-2-with-classpath-exception"
|
52 |
|
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
|
|
55 |
KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86"
|
53 |
56 |
|
54 |
57 |
IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap lto selinux source system-bootstrap systemtap"
|
55 |
58 |
|
... | ... | |
104 |
107 |
javafx? ( dev-java/openjfx:${SLOT}= )
|
105 |
108 |
system-bootstrap? (
|
106 |
109 |
|| (
|
107 |
|
dev-java/openjdk-bin:${SLOT}[gentoo-vm(+)]
|
108 |
|
dev-java/openjdk:${SLOT}[gentoo-vm(+)]
|
|
110 |
dev-java/openjdk-bin:${SLOT}
|
|
111 |
dev-java/openjdk:${SLOT}
|
109 |
112 |
)
|
110 |
113 |
)
|
111 |
114 |
"
|
112 |
115 |
|
113 |
|
S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV}"
|
|
116 |
S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV//+/-}"
|
114 |
117 |
|
115 |
118 |
# The space required to build varies wildly depending on USE flags,
|
116 |
119 |
# ranging from 2GB to 16GB. This function is certainly not exact but
|
... | ... | |
142 |
145 |
JAVA_PKG_WANT_SOURCE="${SLOT}"
|
143 |
146 |
JAVA_PKG_WANT_TARGET="${SLOT}"
|
144 |
147 |
|
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
|
|
148 |
# The nastiness below is necessary while the gentoo-vm USE flag is
|
|
149 |
# masked. First we call java-pkg-2_pkg_setup if it looks like the
|
|
150 |
# flag was unmasked against one of the possible build VMs. If not,
|
|
151 |
# we try finding one of them in their expected locations. This would
|
|
152 |
# have been slightly less messy if openjdk-bin had been installed to
|
|
153 |
# /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
|
|
154 |
# file but disable it so that it would not normally be selectable.
|
|
155 |
|
|
156 |
local vm
|
|
157 |
for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
|
|
158 |
if [[ -d ${BROOT}/usr/lib/jvm/${vm} ]]; then
|
|
159 |
java-pkg-2_pkg_setup
|
|
160 |
return
|
|
161 |
fi
|
|
162 |
done
|
153 |
163 |
}
|
154 |
164 |
|
155 |
165 |
src_prepare() {
|
156 |
|
use riscv && eapply "${WORKDIR}"/openjdk-11.0.18-riscv.patch
|
|
166 |
use riscv && eapply "${DISTDIR}"/java17-riscv64.patch
|
157 |
167 |
default
|
158 |
168 |
chmod +x configure || die
|
159 |
169 |
}
|
160 |
170 |
|
161 |
171 |
src_configure() {
|
162 |
|
if ! use system-bootstrap; then
|
|
172 |
if has_version dev-java/openjdk:${SLOT}; then
|
|
173 |
export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
|
|
174 |
elif use !system-bootstrap ; then
|
163 |
175 |
local xpakvar="${ARCH^^}_XPAK"
|
164 |
176 |
export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
|
|
177 |
else
|
|
178 |
JDK_HOME=$(best_version -b dev-java/openjdk-bin:${SLOT})
|
|
179 |
[[ -n ${JDK_HOME} ]] || die "Build VM not found!"
|
|
180 |
JDK_HOME=${JDK_HOME#*/}
|
|
181 |
JDK_HOME=${BROOT}/opt/${JDK_HOME%-r*}
|
|
182 |
export JDK_HOME
|
165 |
183 |
fi
|
166 |
184 |
|
167 |
|
# Work around stack alignment issue, bug #647954.
|
|
185 |
# Work around stack alignment issue, bug #647954. in case we ever have x86
|
168 |
186 |
use x86 && append-flags -mincoming-stack-boundary=2
|
169 |
187 |
|
170 |
188 |
# Work around -fno-common ( GCC10 default ), bug #713180
|
... | ... | |
186 |
204 |
local myconf=(
|
187 |
205 |
--disable-ccache
|
188 |
206 |
--disable-precompiled-headers
|
|
207 |
--disable-warnings-as-errors
|
189 |
208 |
--enable-full-docs=no
|
190 |
209 |
--with-boot-jdk="${JDK_HOME}"
|
191 |
210 |
--with-extra-cflags="${CFLAGS}"
|
... | ... | |
211 |
230 |
--enable-headless-only=$(usex headless-awt yes no)
|
212 |
231 |
$(tc-is-clang && echo "--with-toolchain-type=clang")
|
213 |
232 |
)
|
214 |
|
! use riscv && myconf+=( --with-jvm-features=shenandoahgc )
|
|
233 |
|
|
234 |
use riscv && myconf+=( --with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
|
215 |
235 |
|
216 |
236 |
use lto && myconf+=( --with-jvm-features=link-time-opt )
|
217 |
237 |
|
218 |
238 |
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 |
239 |
local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
|
225 |
240 |
if [[ -r ${zip} ]]; then
|
226 |
241 |
myconf+=( --with-import-modules="${zip}" )
|
... | ... | |
303 |
318 |
if use doc ; then
|
304 |
319 |
docinto html
|
305 |
320 |
dodoc -r "${S}"/build/*-release/images/docs/*
|
306 |
|
dosym8 -r /usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
|
|
321 |
dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
|
307 |
322 |
fi
|
308 |
323 |
}
|
309 |
324 |
|