dev-java/gradle-bin: Bump to version 6.3 and EAPI 7
[gentoo.git] / dev-java / openjdk / openjdk-8.252_p09.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 check-reqs eapi7-ver flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
7
8 # we need latest -ga tag from hg, but want to keep build number as well
9 # as _p component of the gentoo version string.
10
11 MY_PV=$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)
12
13 BASE_URI="https://hg.${PN}.java.net/jdk8u/jdk8u"
14
15 DESCRIPTION="Open source implementation of the Java programming language"
16 HOMEPAGE="https://openjdk.java.net"
17 SRC_URI="
18         ${BASE_URI}/archive/jdk${MY_PV}.tar.bz2 -> ${P}.tar.bz2
19         ${BASE_URI}/corba/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-corba-${PV}.tar.bz2
20         ${BASE_URI}/hotspot/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-hotspot-${PV}.tar.bz2
21         ${BASE_URI}/jaxp/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxp-${PV}.tar.bz2
22         ${BASE_URI}/jaxws/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxws-${PV}.tar.bz2
23         ${BASE_URI}/jdk/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jdk-${PV}.tar.bz2
24         ${BASE_URI}/langtools/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-langtools-${PV}.tar.bz2
25         ${BASE_URI}/nashorn/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-nashorn-${PV}.tar.bz2
26 "
27
28 LICENSE="GPL-2"
29 SLOT="$(ver_cut 1)"
30 KEYWORDS="~amd64 ~ppc64 ~x86"
31 IUSE="alsa debug cups doc examples headless-awt +jbootstrap nsplugin +pch selinux source webstart"
32
33 COMMON_DEPEND="
34         media-libs/freetype:2=
35         media-libs/giflib:0/7
36         sys-libs/zlib
37 "
38 # Many libs are required to build, but not to run, make is possible to remove
39 # by listing conditionally in RDEPEND unconditionally in DEPEND
40 RDEPEND="
41         ${COMMON_DEPEND}
42         >=sys-apps/baselayout-java-0.1.0-r1
43         !headless-awt? (
44                 x11-libs/libX11
45                 x11-libs/libXext
46                 x11-libs/libXi
47                 x11-libs/libXrender
48                 x11-libs/libXt
49                 x11-libs/libXtst
50         )
51         alsa? ( media-libs/alsa-lib )
52         cups? ( net-print/cups )
53         selinux? ( sec-policy/selinux-java )
54 "
55
56 DEPEND="
57         ${COMMON_DEPEND}
58         app-arch/zip
59         media-libs/alsa-lib
60         net-print/cups
61         x11-base/xorg-proto
62         x11-libs/libX11
63         x11-libs/libXext
64         x11-libs/libXi
65         x11-libs/libXrender
66         x11-libs/libXt
67         x11-libs/libXtst
68         || (
69                 dev-java/openjdk-bin:${SLOT}
70                 dev-java/icedtea-bin:${SLOT}
71                 dev-java/openjdk:${SLOT}
72                 dev-java/icedtea:${SLOT}
73         )
74 "
75
76 PDEPEND="
77         webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
78         nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
79 "
80
81 S="${WORKDIR}/jdk${SLOT}u-jdk${MY_PV}"
82
83 # The space required to build varies wildly depending on USE flags,
84 # ranging from 2GB to 16GB. This function is certainly not exact but
85 # should be close enough to be useful.
86 openjdk_check_requirements() {
87         local M
88         M=2048
89         M=$(( $(usex debug 3 1) * $M ))
90         M=$(( $(usex jbootstrap 2 1) * $M ))
91         M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
92
93         CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
94 }
95
96 pkg_pretend() {
97         openjdk_check_requirements
98         has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}"
99 }
100
101 pkg_setup() {
102         openjdk_check_requirements
103
104         JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
105         JAVA_PKG_WANT_SOURCE="${SLOT}"
106         JAVA_PKG_WANT_TARGET="${SLOT}"
107
108         java-vm-2_pkg_setup
109         java-pkg-2_pkg_setup
110 }
111
112 src_prepare() {
113         default
114         chmod +x configure || die
115         local repo
116         for repo in corba hotspot jdk jaxp jaxws langtools nashorn; do
117                 ln -s ../"${repo}-jdk${MY_PV}" "${repo}" || die
118         done
119         # new warnings in new gcc https://bugs.gentoo.org/685426
120         sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
121                 hotspot/make/linux/makefiles/gcc.make || die
122 }
123
124 src_configure() {
125         # general build info found here:
126         #https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
127
128         # Work around stack alignment issue, bug #647954.
129         use x86 && append-flags -mincoming-stack-boundary=2
130
131         # Work around -fno-common ( GCC10 default ), bug #706638
132         append-flags -fcommon
133
134         local myconf=(
135                         --disable-ccache
136                         --enable-unlimited-crypto
137                         --with-boot-jdk="${JDK_HOME}"
138                         --with-extra-cflags="${CFLAGS}"
139                         --with-extra-cxxflags="${CXXFLAGS}"
140                         --with-extra-ldflags="${LDFLAGS}"
141                         --with-giflib=system
142                         --with-jtreg=no
143                         --with-jobs=1
144                         --with-num-cores=1
145                         --with-update-version="$(ver_cut 2)"
146                         --with-build-number="b$(ver_cut 4)"
147                         --with-milestone="fcs" # magic variable that means "release version"
148                         --with-vendor-name="Gentoo"
149                         --with-vendor-url="https://gentoo.org"
150                         --with-vendor-bug-url="https://bugs.gentoo.org"
151                         --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
152                         --with-zlib=system
153                         --with-native-debug-symbols=$(usex debug internal none)
154                         $(usex headless-awt --disable-headful '')
155                 )
156
157         # PaX breaks pch, bug #601016
158         if use pch && ! host-is-pax; then
159                 myconf+=( --enable-precompiled-headers )
160         else
161                 myconf+=( --disable-precompiled-headers )
162         fi
163
164         (
165                 unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
166                 CFLAGS= CXXFLAGS= LDFLAGS= \
167                 CONFIG_SITE=/dev/null \
168                 econf "${myconf[@]}"
169         )
170 }
171
172 src_compile() {
173         local myemakeargs=(
174                 JOBS=$(makeopts_jobs)
175                 LOG=debug
176                 $(usex doc docs '')
177                 $(usex jbootstrap bootcycle-images images)
178         )
179         emake "${myemakeargs[@]}" -j1 #nowarn
180 }
181
182 src_install() {
183         local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
184         local ddest="${ED%/}/${dest#/}"
185
186         cd "${S}"/build/*-release/images/j2sdk-image || die
187
188         if ! use alsa; then
189                 rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
190         fi
191
192         # stupid build system does not remove that
193         if use headless-awt ; then
194                 rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
195                 {,jre/}bin/policytool bin/appletviewer || die
196         fi
197
198         if ! use examples ; then
199                 rm -vr demo/ || die
200         fi
201
202         if ! use source ; then
203                 rm -v src.zip || die
204         fi
205
206         dodir "${dest}"
207         cp -pPR * "${ddest}" || die
208
209         dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
210
211         java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
212         java-vm_set-pax-markings "${ddest}"
213         java-vm_revdep-mask
214         java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
215
216         if use doc ; then
217                 docinto html
218                 dodoc -r "${S}"/build/*-release/docs/*
219         fi
220 }
221
222 pkg_postinst() {
223         java-vm-2_pkg_postinst
224 }