dev-java/sun-jce-bin: Superseded by Oracle's JVM (bug #483018)
[gentoo.git] / dev-java / sun-jre-bin / sun-jre-bin-1.6.0.45.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit java-vm-2 eutils prefix versionator
8
9 # This URIs need to be updated when bumping!
10 JRE_URI="http://www.oracle.com/technetwork/java/javase/downloads/jre6downloads-1902815.html"
11
12 MY_PV="$(get_version_component_range 2)u$(get_version_component_range 4)"
13 S_PV="$(replace_version_separator 3 '_')"
14
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"
18
19 DESCRIPTION="Oracle's Java SE Runtime Environment"
20 HOMEPAGE="http://www.oracle.com/technetwork/java/javase/"
21 SRC_URI="
22         amd64? ( ${AMD64_AT} )
23         ia64? ( ${IA64_AT} )
24         x86? ( ${X86_AT} )"
25
26 LICENSE="Oracle-BCLA-JavaSE"
27 SLOT="1.6"
28 KEYWORDS="amd64 x86"
29 IUSE="X alsa jce nsplugin pax_kernel selinux"
30
31 RESTRICT="fetch strip"
32 QA_PREBUILT="*"
33
34 RDEPEND="
35         X? (
36                 x11-libs/libXext
37                 x11-libs/libXi
38                 x11-libs/libXrender
39                 x11-libs/libXtst
40                 x11-libs/libX11
41         )
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
47 # marking. #427642
48 DEPEND="
49         pax_kernel? ( sys-apps/paxctl )
50         selinux? ( sec-policy/selinux-java )"
51
52 S="${WORKDIR}/jre${S_PV}"
53
54 pkg_nofetch() {
55         if use x86; then
56                 AT=${X86_AT}
57         elif use amd64; then
58                 AT=${AMD64_AT}
59         elif use ia64; then
60                 AT=${IA64_AT}
61         fi
62
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"
66         einfo ""
67         einfo "Please download '${AT}' from:"
68         einfo "'${JRE_URI}'"
69         einfo "and move it to '${DISTDIR}'"
70 }
71
72 src_unpack() {
73         sh "${DISTDIR}"/${A} -noregister || die "Failed to unpack"
74 }
75
76 src_compile() {
77         # This needs to be done before CDS - #215225
78         java-vm_set-pax-markings "${S}"
79
80         # see bug #207282
81         einfo "Creating the Class Data Sharing archives"
82         case ${ARCH} in
83                 ia64)
84                         bin/java -client -Xshare:dump || die
85                         ;;
86                 x86)
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
91                         ;;
92                 *)
93                         bin/java -server -Xshare:dump || die
94                         ;;
95         esac
96 }
97
98 src_install() {
99         local dest="/opt/${P}"
100         local ddest="${ED}${dest}"
101
102         # We should not need the ancient plugin for Firefox 2 anymore, plus it has
103         # writable executable segments
104         if use x86; then
105                 rm -vf lib/i386/libjavaplugin_oji.so \
106                         lib/i386/libjavaplugin_nscp*.so
107                 rm -vrf plugin/i386
108         fi
109         # Without nsplugin flag, also remove the new plugin
110         local arch=${ARCH};
111         use x86 && arch=i386;
112         if ! use nsplugin; then
113                 rm -vf lib/${arch}/libnpjp2.so \
114                         lib/${arch}/libjavaplugin_jni.so
115         fi
116
117         dodir "${dest}"
118         cp -pPR bin lib man "${ddest}" || die
119
120         # Remove empty dirs we might have copied
121         find "${D}" -type d -empty -exec rmdir {} + || die
122
123         dodoc COPYRIGHT README
124
125         if use jce; then
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
135         fi
136
137         if use nsplugin; then
138                 install_mozilla_plugin "${dest}"/lib/${arch}/libnpjp2.so
139         fi
140
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;##" \
150                 -e "/Encoding/d" \
151                 lib/desktop/applications/sun_java.desktop > \
152                 "${T}"/jcontrol-${PN}-${SLOT}.desktop || die
153         domenu "${T}"/jcontrol-${PN}-${SLOT}.desktop
154
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
161
162         set_java_env "${FILESDIR}/${VMHANDLE}.env-r1"
163         java-vm_revdep-mask
164 }
165
166 pkg_postinst() {
167         java-vm-2_pkg_postinst
168
169         elog "If you want Oracles JRE 7 'emerge oracle-jre-bin' instead."
170 }