1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # Build written by Andrew John Hughes (gnu_andrew@member.fsf.org)
6 # *********************************************************
7 # * IF YOU CHANGE THIS EBUILD, CHANGE ICEDTEA-6.* AS WELL *
8 # *********************************************************
13 inherit check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils prefix versionator xdg-utils
15 ICEDTEA_VER=$(get_version_component_range 1-3)
16 ICEDTEA_BRANCH=$(get_version_component_range 1-2)
17 ICEDTEA_PKG=icedtea-${ICEDTEA_VER}
18 ICEDTEA_PRE=$(get_version_component_range _)
20 CORBA_TARBALL="f59374a41938.tar.xz"
21 JAXP_TARBALL="f42bdc74d2f5.tar.xz"
22 JAXWS_TARBALL="4dee0def390a.tar.xz"
23 JDK_TARBALL="c2f574d16c2f.tar.xz"
24 LANGTOOLS_TARBALL="9cb3b18d9139.tar.xz"
25 OPENJDK_TARBALL="c0ec72b715dd.tar.xz"
26 NASHORN_TARBALL="04210bbb67cd.tar.xz"
27 HOTSPOT_TARBALL="f76744714698.tar.xz"
28 SHENANDOAH_TARBALL="9fcff2250bb4.tar.xz"
29 AARCH32_TARBALL="4107aea57664.tar.xz"
31 CACAO_TARBALL="cacao-c182f119eaad.tar.xz"
32 JAMVM_TARBALL="jamvm-ec18fb9e49e62dce16c5094ef1527eed619463aa.tar.gz"
34 CORBA_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-corba-${CORBA_TARBALL}"
35 JAXP_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jaxp-${JAXP_TARBALL}"
36 JAXWS_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jaxws-${JAXWS_TARBALL}"
37 JDK_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jdk-${JDK_TARBALL}"
38 LANGTOOLS_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-langtools-${LANGTOOLS_TARBALL}"
39 OPENJDK_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-openjdk-${OPENJDK_TARBALL}"
40 NASHORN_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-nashorn-${NASHORN_TARBALL}"
41 HOTSPOT_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-hotspot-${HOTSPOT_TARBALL}"
42 SHENANDOAH_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-shenandoah-${SHENANDOAH_TARBALL}"
43 AARCH32_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-aarch32-${AARCH32_TARBALL}"
45 CACAO_GENTOO_TARBALL="icedtea-${CACAO_TARBALL}"
46 JAMVM_GENTOO_TARBALL="icedtea-${JAMVM_TARBALL}"
48 DROP_URL="https://icedtea.classpath.org/download/drops"
49 ICEDTEA_URL="${DROP_URL}/icedtea${SLOT}/${ICEDTEA_VER}"
51 DESCRIPTION="A harness to build OpenJDK using Free Software build tools and dependencies"
52 HOMEPAGE="https://icedtea.classpath.org"
53 SRC_PKG="${ICEDTEA_PKG}.tar.xz"
55 https://icedtea.classpath.org/download/source/${SRC_PKG}
56 ${ICEDTEA_URL}/openjdk.tar.xz -> ${OPENJDK_GENTOO_TARBALL}
57 ${ICEDTEA_URL}/corba.tar.xz -> ${CORBA_GENTOO_TARBALL}
58 ${ICEDTEA_URL}/jaxp.tar.xz -> ${JAXP_GENTOO_TARBALL}
59 ${ICEDTEA_URL}/jaxws.tar.xz -> ${JAXWS_GENTOO_TARBALL}
60 ${ICEDTEA_URL}/jdk.tar.xz -> ${JDK_GENTOO_TARBALL}
61 ${ICEDTEA_URL}/hotspot.tar.xz -> ${HOTSPOT_GENTOO_TARBALL}
62 ${ICEDTEA_URL}/nashorn.tar.xz -> ${NASHORN_GENTOO_TARBALL}
63 ${ICEDTEA_URL}/langtools.tar.xz -> ${LANGTOOLS_GENTOO_TARBALL}
64 shenandoah? ( ${ICEDTEA_URL}/shenandoah.tar.xz -> ${SHENANDOAH_GENTOO_TARBALL} )
65 arm? ( ${ICEDTEA_URL}/aarch32.tar.xz -> ${AARCH32_GENTOO_TARBALL} )
66 ${DROP_URL}/cacao/${CACAO_TARBALL} -> ${CACAO_GENTOO_TARBALL}
67 ${DROP_URL}/jamvm/${JAMVM_TARBALL} -> ${JAMVM_GENTOO_TARBALL}"
69 LICENSE="Apache-1.1 Apache-2.0 GPL-1 GPL-2 GPL-2-with-linking-exception LGPL-2 MPL-1.0 MPL-1.1 public-domain W3C"
70 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
72 IUSE="+alsa cacao +cups doc examples +gtk headless-awt
73 jamvm +jbootstrap kerberos libressl nsplugin pax_kernel +pch
74 pulseaudio sctp selinux shenandoah smartcard +source +system-lcms test webstart zero"
76 RESTRICT="!test? ( test )"
77 REQUIRED_USE="gtk? ( !headless-awt )"
79 # Ideally the following were optional at build time.
81 >=media-libs/alsa-lib-1.0"
83 >=net-print/cups-1.2.12"
85 >=media-libs/giflib-4.1.6:0=
86 >=media-libs/libpng-1.2:0=
87 >=x11-libs/libX11-1.1.3
88 >=x11-libs/libXext-1.1.1
89 >=x11-libs/libXi-1.1.3
90 >=x11-libs/libXrender-0.9.4
91 >=x11-libs/libXtst-1.0.3
92 x11-libs/libXcomposite"
95 >=x11-libs/libXau-1.0.3
96 >=x11-libs/libXdmcp-1.0.2
97 >=x11-libs/libXinerama-1.0.2"
99 # The Javascript requirement is obsolete; OpenJDK 8+ has Nashorn
101 >=dev-libs/glib-2.26:2=
102 >=dev-util/systemtap-1
103 media-libs/fontconfig:1.0=
104 >=media-libs/freetype-2.5.3:2=
105 >=sys-libs/zlib-1.2.3
107 kerberos? ( virtual/krb5 )
108 sctp? ( net-misc/lksctp-tools )
109 smartcard? ( sys-apps/pcsc-lite )
110 system-lcms? ( >=media-libs/lcms-2.9:2= )"
112 # Gtk+ will move to COMMON_DEP in time; PR1982
113 # gsettings-desktop-schemas will be needed for native proxy support; PR1976
114 RDEPEND="${COMMON_DEP}
116 !dev-java/icedtea-web:7
117 >=gnome-base/gsettings-desktop-schemas-3.12.2
118 >=sys-apps/baselayout-java-0.1.0-r1
120 alsa? ( ${ALSA_COMMON_DEP} )
121 cups? ( ${CUPS_COMMON_DEP} )
123 >=dev-libs/atk-1.30.0
124 >=x11-libs/cairo-1.8.8
125 x11-libs/gdk-pixbuf:2
126 >=x11-libs/gtk+-2.8:2
127 >=x11-libs/pango-1.24.5
129 !headless-awt? ( ${X_COMMON_DEP} )
130 selinux? ( sec-policy/selinux-java )"
132 # ca-certificates, perl and openssl are used for the cacerts keystore generation
133 # perl is needed for running the SystemTap tests and the bootstrap javac
134 # lsb-release is used to obtain distro information for the version & crash dump output
135 # attr is needed for xattr.h which defines the extended attribute syscalls used by NIO2
136 # x11-libs/libXt is needed for headers only (Intrinsic.h, IntrinsicP.h, Shell.h, StringDefs.h)
137 # Ant is no longer needed under the new build system
138 DEPEND="${COMMON_DEP} ${ALSA_COMMON_DEP} ${CUPS_COMMON_DEP} ${X_COMMON_DEP} ${X_DEPEND}
140 dev-java/icedtea-bin:8
143 dev-java/openjdk-bin:8
148 app-misc/ca-certificates
150 !libressl? ( dev-libs/openssl:0 )
151 libressl? ( dev-libs/libressl:0 )
156 pax_kernel? ( sys-apps/elfix )"
158 PDEPEND="webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
159 nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
160 pulseaudio? ( dev-java/icedtea-sound )"
162 S="${WORKDIR}"/${ICEDTEA_PKG}
164 icedtea_check_requirements() {
165 local CHECKREQS_DISK_BUILD
168 CHECKREQS_DISK_BUILD="9000M"
170 CHECKREQS_DISK_BUILD="8500M"
173 check-reqs_pkg_${EBUILD_PHASE}
177 icedtea_check_requirements
181 icedtea_check_requirements
183 JAVA_PKG_WANT_BUILD_VM="
184 icedtea-8 icedtea-bin-8
185 openjdk-8 openjdk-bin-8"
186 JAVA_PKG_WANT_SOURCE="1.5"
187 JAVA_PKG_WANT_TARGET="1.5"
198 # For bootstrap builds as the sandbox control file might not yet exist.
199 addpredict /proc/self/coredump_filter #nowarn
201 # icedtea doesn't like some locales. #330433 #389717
202 export LANG="C" LC_ALL="C"
204 local cacao_config config hotspot_port hs_config jamvm_config use_cacao use_jamvm use_zero zero_config
205 local vm=$(java-pkg_get-current-vm)
207 # gcj-jdk ensures ecj is present.
208 if use jbootstrap || has "${vm}" gcj-jdk; then
209 use jbootstrap || einfo "bootstrap is necessary when building with ${vm}, ignoring USE=\"-jbootstrap\""
210 config+=" --enable-bootstrap"
212 config+=" --disable-bootstrap"
215 # Use Zero if requested
220 # Use JamVM if requested
225 # Use CACAO if requested
230 # Are we on a architecture with a HotSpot port?
231 # In-tree JIT ports are available for amd64, arm, arm64, ppc64 (be&le), SPARC and x86.
232 if { use amd64 || use arm || use arm64 || use ppc64 || use sparc || use x86; }; then
234 # Work around stack alignment issue, bug #647954.
235 use x86 && append-flags -mincoming-stack-boundary=2
238 # Always use HotSpot as the primary VM if available. #389521 #368669 #357633 ...
239 # Otherwise use Zero for now until alternate VMs are working
240 if test "x${hotspot_port}" != "xyes"; then
244 if use shenandoah; then
245 if { use amd64 || use arm64; }; then
246 hs_config="--with-hotspot-build=shenandoah"
247 hs_config+=" --with-hotspot-src-zip="${DISTDIR}/${SHENANDOAH_GENTOO_TARBALL}""
249 eerror "Shenandoah is only supported on arm64 and x86_64. Please re-build with USE="-shenandoah""
253 hs_config="--with-hotspot-src-zip="${DISTDIR}/${AARCH32_GENTOO_TARBALL}""
255 hs_config="--with-hotspot-src-zip="${DISTDIR}/${HOTSPOT_GENTOO_TARBALL}""
259 # Turn on JamVM if needed (non-HS archs) or requested
260 if test "x${use_jamvm}" = "xyes"; then
261 if test "x${hotspot_port}" = "xyes"; then
262 ewarn 'Enabling JamVM on an architecture with HotSpot support; issues may result.'
263 ewarn 'If so, please rebuild with USE="-jamvm"'
265 ewarn 'JamVM is known to still have issues with IcedTea 3.x; please rebuild with USE="-jamvm"'
266 jamvm_config="--enable-jamvm"
269 # Turn on CACAO if needed (non-HS archs) or requested
270 if test "x${use_cacao}" = "xyes"; then
271 if test "x${hotspot_port}" = "xyes"; then
272 ewarn 'Enabling CACAO on an architecture with HotSpot support; issues may result.'
273 ewarn 'If so, please rebuild with USE="-cacao"'
275 ewarn 'CACAO is known to still have issues with IcedTea 3.x; please rebuild with USE="-cacao"'
276 cacao_config="--enable-cacao"
279 # Turn on Zero if needed (non-HS/CACAO archs) or requested
280 if test "x${use_zero}" = "xyes"; then
281 if test "x${hotspot_port}" = "xyes"; then
282 ewarn 'Enabling Zero on an architecture with HotSpot support; performance will be significantly reduced.'
284 zero_config="--enable-zero"
287 # PaX breaks pch, bug #601016
288 if use pch && ! host-is-pax; then
289 config+=" --enable-precompiled-headers"
291 config+=" --disable-precompiled-headers"
294 config+=" --with-parallel-jobs=$(makeopts_jobs)"
296 unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS
299 --with-openjdk-src-zip="${DISTDIR}/${OPENJDK_GENTOO_TARBALL}" \
300 --with-corba-src-zip="${DISTDIR}/${CORBA_GENTOO_TARBALL}" \
301 --with-jaxp-src-zip="${DISTDIR}/${JAXP_GENTOO_TARBALL}" \
302 --with-jaxws-src-zip="${DISTDIR}/${JAXWS_GENTOO_TARBALL}" \
303 --with-jdk-src-zip="${DISTDIR}/${JDK_GENTOO_TARBALL}" \
304 --with-langtools-src-zip="${DISTDIR}/${LANGTOOLS_GENTOO_TARBALL}" \
305 --with-nashorn-src-zip="${DISTDIR}/${NASHORN_GENTOO_TARBALL}" \
306 --with-cacao-src-zip="${DISTDIR}/${CACAO_GENTOO_TARBALL}" \
307 --with-jamvm-src-zip="${DISTDIR}/${JAMVM_GENTOO_TARBALL}" \
308 --with-jdk-home="$(java-config -O)" \
309 --prefix="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}" \
310 --mandir="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}/man" \
311 --with-pkgversion="Gentoo ${PF}" \
313 --disable-downloading --disable-Werror --disable-tests \
314 --disable-systemtap-tests --enable-improved-font-rendering \
315 --enable-system-jpeg --enable-system-zlib \
316 $(use_enable headless-awt headless) \
317 $(use_enable !headless-awt system-gif) \
318 $(use_enable !headless-awt system-png) \
319 $(use_enable doc docs) \
320 $(use_enable kerberos system-kerberos) \
321 $(use_enable system-lcms) \
322 $(use_with pax_kernel pax "${EPREFIX}/usr/sbin/paxmark.sh") \
323 $(use_enable sctp system-sctp) \
324 $(use_enable smartcard system-pcsc) \
325 ${zero_config} ${cacao_config} ${jamvm_config} ${hs_config}
339 local dest="/usr/$(get_libdir)/icedtea${SLOT}"
340 local ddest="${ED}${dest#/}"
343 rm -v "${ddest}"/jre/lib/$(get_system_arch)/libjsoundalsa.* || die
346 if ! use examples; then
347 rm -r "${ddest}"/demo "${ddest}"/sample || die
350 if ! use source; then
351 rm -v "${ddest}"/src.zip || die
354 dosym ../../../usr/share/doc/"${PF}" usr/share/doc/"${PN}${SLOT}"
356 # Fix the permissions.
357 find "${ddest}" \! -type l \( -perm /111 -exec chmod 755 {} \; -o -exec chmod 644 {} \; \) || die
359 dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
361 java-vm_install-env "${FILESDIR}/icedtea.env.sh"
362 java-vm_sandbox-predict /proc/self/coredump_filter
366 xdg_icon_cache_update
367 java-vm-2_pkg_postinst
371 xdg_icon_cache_update