dev-java/openjdk-jre-bin: stable latest, drop old
[gentoo.git] / dev-java / openjdk-jre-bin / openjdk-jre-bin-11.0.6_p10.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit java-vm-2
7
8 abi_uri() {
9         echo "${2-$1}? (
10                         https://github.com/AdoptOpenJDK/openjdk${SLOT}-binaries/releases/download/jdk-${MY_PV}/OpenJDK${SLOT}U-jre_${1}_linux_hotspot_${MY_PV//+/_}.tar.gz
11                 )"
12 }
13
14 MY_PV=${PV/_p/+}
15 SLOT=${MY_PV%%[.+]*}
16
17 SRC_URI="
18         $(abi_uri x64 amd64)
19 "
20
21 DESCRIPTION="Prebuilt Java JRE binaries provided by AdoptOpenJDK"
22 HOMEPAGE="https://adoptopenjdk.net"
23 LICENSE="GPL-2-with-classpath-exception"
24 KEYWORDS="amd64"
25 IUSE="alsa cups +gentoo-vm headless-awt nsplugin selinux webstart"
26
27 RDEPEND="
28         media-libs/fontconfig:1.0
29         media-libs/freetype:2
30         >net-libs/libnet-1.1
31         >=sys-apps/baselayout-java-0.1.0-r1
32         >=sys-libs/glibc-2.2.5:*
33         sys-libs/zlib
34         alsa? ( media-libs/alsa-lib )
35         cups? ( net-print/cups )
36         selinux? ( sec-policy/selinux-java )
37         !headless-awt? (
38                 x11-libs/libX11
39                 x11-libs/libXext
40                 x11-libs/libXi
41                 x11-libs/libXrender
42                 x11-libs/libXtst
43         )"
44
45 PDEPEND="webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
46         nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )"
47
48 RESTRICT="preserve-libs splitdebug"
49 QA_PREBUILT="*"
50
51 S="${WORKDIR}/jdk-${MY_PV}-jre"
52
53 src_install() {
54         local dest="/opt/${P}"
55         local ddest="${ED%/}/${dest#/}"
56
57         # Not sure why they bundle this as it's commonly available and they
58         # only do so on x86_64. It's needed by libfontmanager.so. IcedTea
59         # also has an explicit dependency while Oracle seemingly dlopens it.
60         rm -vf lib/libfreetype.so || die
61
62         # Oracle and IcedTea have libjsoundalsa.so depending on
63         # libasound.so.2 but AdoptOpenJDK only has libjsound.so. Weird.
64         if ! use alsa ; then
65                 rm -v lib/libjsound.* || die
66         fi
67
68         if use headless-awt ; then
69                 rm -v lib/lib*{[jx]awt,splashscreen}* || die
70         fi
71
72         rm -v lib/security/cacerts || die
73         dosym ../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
74
75         dodir "${dest}"
76         cp -pPR * "${ddest}" || die
77
78         use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
79         java-vm_set-pax-markings "${ddest}"
80         java-vm_revdep-mask
81         java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
82 }
83
84 pkg_postinst() {
85         java-vm-2_pkg_postinst
86
87         if use gentoo-vm ; then
88                 ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JRE"
89                 ewarn "recognised by the system. This will almost certainly break things."
90         else
91                 ewarn "The experimental gentoo-vm USE flag has not been enabled so this JRE"
92                 ewarn "will not be recognised by the system. For example, simply calling"
93                 ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
94                 ewarn "fully supports Java 11. This JRE must therefore be invoked using its"
95                 ewarn "absolute location under ${EPREFIX}/opt/${P}."
96         fi
97 }