1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 MULTILIB_COMPAT=( abi_x86_{32,64} )
7 KEYWORDS="-* amd64 x86"
9 inherit java-vm-2 multilib-build prefix toolchain-funcs
11 BASE_URI="https://dev.gentoo.org/~chewi/distfiles"
12 SRC_URI="doc? ( ${BASE_URI}/${PN}-doc-${PV}.tar.xz )
13 source? ( ${BASE_URI}/${PN}-src-${PV}.tar.xz )
14 multilib? ( amd64? ( abi_x86_32? ( ${BASE_URI}/${PN}-core-${PV}-x86.tar.xz ) ) )"
16 for abi in amd64 x86; do
19 ${BASE_URI}/${PN}-core-${PV}-${abi}.tar.xz
20 examples? ( ${BASE_URI}/${PN}-examples-${PV}-${abi}.tar.xz )
24 DESCRIPTION="A Gentoo-made binary build of the IcedTea JDK"
25 HOMEPAGE="http://icedtea.classpath.org"
26 LICENSE="GPL-2-with-classpath-exception"
29 IUSE="+alsa cjk +cups doc examples +gtk headless-awt multilib nsplugin nss pulseaudio selinux source +webstart"
30 REQUIRED_USE="gtk? ( !headless-awt ) nsplugin? ( !headless-awt )"
32 RESTRICT="preserve-libs strip"
35 RDEPEND=">=dev-libs/glib-2.42:2%
36 >=dev-libs/nss-3.16.1-r1%
38 >=media-libs/fontconfig-2.11:1.0%
39 >=media-libs/freetype-2.5.5:2%
40 >=media-libs/lcms-2.6:2%
41 >=sys-libs/zlib-1.2.8-r1%
43 alsa? ( >=media-libs/alsa-lib-1.0% )
44 cups? ( >=net-print/cups-2.0% )
46 >=dev-libs/atk-2.16.0%
47 >=x11-libs/cairo-1.14.2%
48 x11-libs/gdk-pixbuf:2%
49 >=x11-libs/gtk+-2.24:2%
50 >=x11-libs/pango-1.36%
53 >=media-libs/giflib-4.1.6-r1%
54 =media-libs/libpng-1.6*%
55 >=x11-libs/libX11-1.6%
56 >=x11-libs/libXcomposite-0.4%
57 >=x11-libs/libXext-1.3%
59 >=x11-libs/libXrender-0.9.8%
60 >=x11-libs/libXtst-1.2%
63 # gsettings-desktop-schemas is needed for native proxy support. #431972
64 RDEPEND=">=gnome-base/gsettings-desktop-schemas-3.12.2
66 >=sys-devel/gcc-4.9.3[multilib?]
67 >=sys-libs/glibc-2.22[multilib?]
69 media-fonts/arphicfonts
70 media-fonts/baekmuk-fonts
72 media-fonts/lohit-fonts
75 selinux? ( sec-policy/selinux-java )
76 multilib? ( ${RDEPEND//%/[${MULTILIB_USEDEP}]} )
77 !multilib? ( ${RDEPEND//%/} )"
79 DEPEND="!arm? ( dev-util/patchelf )"
81 PDEPEND="webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
82 nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
83 pulseaudio? ( dev-java/icedtea-sound )"
88 if [[ "$(tc-is-softfloat)" != "no" ]]; then
89 die "These binaries require a hardfloat system."
97 rm -v */jre/lib/*/libjsoundalsa.* || die
100 if use headless-awt; then
101 rm -vr */jre/lib/*/{xawt,libsplashscreen.*} \
102 */{,jre/}bin/policytool */bin/appletviewer || die
106 rm -v */jre/lib/*/libjavagtk.* || die
109 local lib=${P}-${ABI}/jre/lib
111 # NSS is already required because of SunEC. The nss flag in the
112 # icedtea package just comments or uncomments this line.
113 sed -i "/=sun\.security\.pkcs11\.SunPKCS11/s/^#*$(usex nss '/' '/#')/" \
114 ${lib}/security/java.security || die
116 if [[ -n "${EPREFIX}" ]]; then
117 # The binaries are built on a non-prefixed system so the
118 # fontconfig needs to have prefixes inserted.
119 rm ${lib}/fontconfig.Gentoo.bfc || die
120 hprefixify ${lib}/fontconfig.Gentoo.properties.src
121 mv ${lib}/fontconfig.Gentoo.properties{.src,} || die
124 # Fix the RPATHs, except on arm.
125 # https://bugs.gentoo.org/show_bug.cgi?id=543658#c3
126 # https://github.com/NixOS/patchelf/issues/8
128 ewarn "The RPATHs on these binaries are normally modified to avoid"
129 ewarn "conflicts with an icedtea installation built from source. This"
130 ewarn "is currently not possible on ARM so please refrain from"
131 ewarn "installing dev-java/icedtea on the same system."
133 local old="/usr/$(get_libdir)/icedtea${SLOT}"
134 local new="${EPREFIX}/opt/${P}"
137 for elf in $(find -type f -executable ! -name "*.cgi" || die); do
138 rpath=$(patchelf --print-rpath "${elf}" || die "patchelf ${elf}")
140 if [[ -n "${rpath}" ]]; then
141 patchelf --set-rpath "${rpath//${old}/${new}}" "${elf}" || die "patchelf ${elf}"
147 multilib_src_install() {
148 local dest="/opt/${P}-${ABI}"
149 dest="${dest/%-${DEFAULT_ABI}/}"
150 local ddest="${ED}${dest#/}"
153 if multilib_is_native_abi; then
154 dodoc ${P}-${ABI}/doc/{ASSEMBLY_EXCEPTION,AUTHORS,NEWS,README,THIRD_PARTY_README}
155 use doc && dodoc -r ${P}/doc/html
157 # doins doesn't preserve executable bits.
158 cp -pRP ${P}-${ABI}/{bin,include,jre,lib,man} "${ddest}" || die
160 if use examples; then
161 cp -pRP ${P}-${ABI}/{demo,sample} "${ddest}" || die
165 cp ${P}/src.zip "${ddest}" || die
168 # Use default VMHANDLE.
169 java-vm_install-env "${FILESDIR}/icedtea-bin.env.sh"
171 local x native=$(get_system_arch ${DEFAULT_ABI})
173 for x in {,/jre}/{bin,lib/$(get_system_arch)} /jre/lib/rt.jar; do
174 dodir "${dest}"${x%/*}
175 cp -pRP ${P}-${ABI}${x} "${ddest}"${x} || die
178 for x in ${P}-${DEFAULT_ABI}{,/jre}/lib/*; do
179 [[ ${x##*/} = ${native} ]] && continue
180 [[ -e "${ddest}"/${x#*/} ]] && continue
181 dosym "${EPREFIX}"/opt/${P}/${x#*/} "${dest}"/${x#*/}
184 # Use ABI-suffixed VMHANDLE.
185 VMHANDLE+="-${ABI}" java-vm_install-env "${FILESDIR}/icedtea-bin.env.sh"
188 # Both icedtea itself and the icedtea ebuild set PAX markings but we
189 # disable them for the icedtea-bin build because the line below will
190 # respect end-user settings when icedtea-bin is actually installed.
191 java-vm_set-pax-markings "${ddest}"
193 # Each invocation appends to the config.
194 java-vm_revdep-mask "${EPREFIX}${dest}"
198 if use multilib; then
199 multilib_foreach_abi multilib_src_install
204 java-vm_sandbox-predict /proc/self/coredump_filter