1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit check-reqs eapi7-ver flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
8 # we need latest -ga tag from hg, but want to keep build number as well
9 # as _p component of the gentoo version string.
11 MY_PV=$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)
13 BASE_URI="https://hg.${PN}.java.net/jdk8u/jdk8u"
15 DESCRIPTION="Open source implementation of the Java programming language"
16 HOMEPAGE="https://openjdk.java.net"
18 ${BASE_URI}/archive/jdk${MY_PV}.tar.bz2 -> ${P}.tar.bz2
19 ${BASE_URI}/corba/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-corba-${PV}.tar.bz2
20 ${BASE_URI}/hotspot/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-hotspot-${PV}.tar.bz2
21 ${BASE_URI}/jaxp/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxp-${PV}.tar.bz2
22 ${BASE_URI}/jaxws/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxws-${PV}.tar.bz2
23 ${BASE_URI}/jdk/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jdk-${PV}.tar.bz2
24 ${BASE_URI}/langtools/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-langtools-${PV}.tar.bz2
25 ${BASE_URI}/nashorn/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-nashorn-${PV}.tar.bz2
30 KEYWORDS="~amd64 ~ppc64 ~x86"
31 IUSE="alsa debug cups doc examples headless-awt +jbootstrap nsplugin +pch selinux source webstart"
34 media-libs/freetype:2=
38 # Many libs are required to build, but not to run, make is possible to remove
39 # by listing conditionally in RDEPEND unconditionally in DEPEND
42 >=sys-apps/baselayout-java-0.1.0-r1
51 alsa? ( media-libs/alsa-lib )
52 cups? ( net-print/cups )
53 selinux? ( sec-policy/selinux-java )
69 dev-java/openjdk-bin:${SLOT}
70 dev-java/icedtea-bin:${SLOT}
71 dev-java/openjdk:${SLOT}
72 dev-java/icedtea:${SLOT}
77 webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
78 nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
81 S="${WORKDIR}/jdk${SLOT}u-jdk${MY_PV}"
83 # The space required to build varies wildly depending on USE flags,
84 # ranging from 2GB to 16GB. This function is certainly not exact but
85 # should be close enough to be useful.
86 openjdk_check_requirements() {
89 M=$(( $(usex debug 3 1) * $M ))
90 M=$(( $(usex jbootstrap 2 1) * $M ))
91 M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
93 CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
97 openjdk_check_requirements
98 has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}"
102 openjdk_check_requirements
104 JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
105 JAVA_PKG_WANT_SOURCE="${SLOT}"
106 JAVA_PKG_WANT_TARGET="${SLOT}"
114 chmod +x configure || die
116 for repo in corba hotspot jdk jaxp jaxws langtools nashorn; do
117 ln -s ../"${repo}-jdk${MY_PV}" "${repo}" || die
119 # new warnings in new gcc https://bugs.gentoo.org/685426
120 sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
121 hotspot/make/linux/makefiles/gcc.make || die
125 # general build info found here:
126 #https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
128 # Work around stack alignment issue, bug #647954.
129 use x86 && append-flags -mincoming-stack-boundary=2
131 # Work around -fno-common ( GCC10 default ), bug #706638
132 append-flags -fcommon
136 --enable-unlimited-crypto
137 --with-boot-jdk="${JDK_HOME}"
138 --with-extra-cflags="${CFLAGS}"
139 --with-extra-cxxflags="${CXXFLAGS}"
140 --with-extra-ldflags="${LDFLAGS}"
145 --with-update-version="$(ver_cut 2)"
146 --with-build-number="b$(ver_cut 4)"
147 --with-milestone="fcs" # magic variable that means "release version"
148 --with-vendor-name="Gentoo"
149 --with-vendor-url="https://gentoo.org"
150 --with-vendor-bug-url="https://bugs.gentoo.org"
151 --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
153 --with-native-debug-symbols=$(usex debug internal none)
154 $(usex headless-awt --disable-headful '')
157 # PaX breaks pch, bug #601016
158 if use pch && ! host-is-pax; then
159 myconf+=( --enable-precompiled-headers )
161 myconf+=( --disable-precompiled-headers )
165 unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
166 CFLAGS= CXXFLAGS= LDFLAGS= \
167 CONFIG_SITE=/dev/null \
174 JOBS=$(makeopts_jobs)
177 $(usex jbootstrap bootcycle-images images)
179 emake "${myemakeargs[@]}" -j1 #nowarn
183 local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
184 local ddest="${ED%/}/${dest#/}"
186 cd "${S}"/build/*-release/images/j2sdk-image || die
189 rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
192 # stupid build system does not remove that
193 if use headless-awt ; then
194 rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
195 {,jre/}bin/policytool bin/appletviewer || die
198 if ! use examples ; then
202 if ! use source ; then
207 cp -pPR * "${ddest}" || die
209 dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
211 java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
212 java-vm_set-pax-markings "${ddest}"
214 java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
218 dodoc -r "${S}"/build/*-release/docs/*
223 java-vm-2_pkg_postinst