1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit java-vm-2 eutils prefix versionator
9 # This URIs need to be updated when bumping!
10 JRE_URI="http://www.oracle.com/technetwork/java/javase/downloads/jre6downloads-1902815.html"
12 MY_PV="$(get_version_component_range 2)u$(get_version_component_range 4)"
13 S_PV="$(replace_version_separator 3 '_')"
15 X86_AT="jre-${MY_PV}-linux-i586.bin"
16 AMD64_AT="jre-${MY_PV}-linux-x64.bin"
17 IA64_AT="jre-${MY_PV}-linux-ia64.bin"
19 DESCRIPTION="Oracle's Java SE Runtime Environment"
20 HOMEPAGE="http://www.oracle.com/technetwork/java/javase/"
22 amd64? ( ${AMD64_AT} )
26 LICENSE="Oracle-BCLA-JavaSE"
29 IUSE="X alsa jce nsplugin pax_kernel selinux"
31 RESTRICT="fetch strip"
42 alsa? ( media-libs/alsa-lib )
43 jce? ( dev-java/sun-jce-bin:1.6 )
44 !prefix? ( sys-libs/glibc )
45 selinux? ( sec-policy/selinux-java )"
46 # scanelf won't create a PaX header, so depend on paxctl to avoid fallback
49 pax_kernel? ( sys-apps/paxctl )
50 selinux? ( sec-policy/selinux-java )"
52 S="${WORKDIR}/jre${S_PV}"
63 einfo "Due to Oracle no longer providing the distro-friendly DLJ bundles, the package"
64 einfo "has become fetch restricted again. Alternatives are switching to"
65 einfo "dev-java/icedtea-bin:6 or the source-based dev-java/icedtea:6"
67 einfo "Please download '${AT}' from:"
69 einfo "and move it to '${DISTDIR}'"
73 sh "${DISTDIR}"/${A} -noregister || die "Failed to unpack"
77 # This needs to be done before CDS - #215225
78 java-vm_set-pax-markings "${S}"
81 einfo "Creating the Class Data Sharing archives"
84 bin/java -client -Xshare:dump || die
87 bin/java -client -Xshare:dump || die
88 # limit heap size for large memory on x86 #405239
89 # this is a workaround and shouldn't be needed.
90 bin/java -server -Xmx64m -Xshare:dump || die
93 bin/java -server -Xshare:dump || die
99 local dest="/opt/${P}"
100 local ddest="${ED}${dest}"
102 # We should not need the ancient plugin for Firefox 2 anymore, plus it has
103 # writable executable segments
105 rm -vf lib/i386/libjavaplugin_oji.so \
106 lib/i386/libjavaplugin_nscp*.so
109 # Without nsplugin flag, also remove the new plugin
111 use x86 && arch=i386;
112 if ! use nsplugin; then
113 rm -vf lib/${arch}/libnpjp2.so \
114 lib/${arch}/libjavaplugin_jni.so
118 cp -pPR bin lib man "${ddest}" || die
120 # Remove empty dirs we might have copied
121 find "${D}" -type d -empty -exec rmdir {} + || die
123 dodoc COPYRIGHT README
126 dodir "${dest}"/lib/security/strong-jce
127 mv "${ddest}"/lib/security/US_export_policy.jar \
128 "${ddest}"/lib/security/strong-jce || die
129 mv "${ddest}"/lib/security/local_policy.jar \
130 "${ddest}"/lib/security/strong-jce || die
131 dosym /opt/sun-jce-bin-1.6.0/jre/lib/security/unlimited-jce/US_export_policy.jar \
132 "${dest}"/lib/security/US_export_policy.jar
133 dosym /opt/sun-jce-bin-1.6.0/jre/lib/security/unlimited-jce/local_policy.jar \
134 "${dest}"/lib/security/local_policy.jar
137 if use nsplugin; then
138 install_mozilla_plugin "${dest}"/lib/${arch}/libnpjp2.so
141 # Install desktop file for the Java Control Panel.
142 # Using ${PN}-${SLOT} to prevent file collision with jre and or other slots.
143 # make_desktop_entry can't be used as ${P} would end up in filename.
144 newicon lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png \
145 sun-jcontrol-${PN}-${SLOT}.png || die
146 sed -e "s#Name=.*#Name=Java Control Panel for Oracle JDK ${SLOT} (${PN})#" \
147 -e "s#Exec=.*#Exec=${dest}/bin/jcontrol#" \
148 -e "s#Icon=.*#Icon=sun-jcontrol-${PN}-${SLOT}#" \
149 -e "s#Application;##" \
151 lib/desktop/applications/sun_java.desktop > \
152 "${T}"/jcontrol-${PN}-${SLOT}.desktop || die
153 domenu "${T}"/jcontrol-${PN}-${SLOT}.desktop
155 # http://docs.oracle.com/javase/6/docs/technotes/guides/intl/fontconfig.html
156 rm "${ddest}"/lib/fontconfig.* || die
157 cp "${FILESDIR}"/fontconfig.Gentoo.properties-r1 "${T}"/fontconfig.properties || die
158 eprefixify "${T}"/fontconfig.properties
159 insinto "${dest}"/lib/
160 doins "${T}"/fontconfig.properties
162 set_java_env "${FILESDIR}/${VMHANDLE}.env-r1"
167 java-vm-2_pkg_postinst
169 elog "If you want Oracles JRE 7 'emerge oracle-jre-bin' instead."