1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: Frederik Schwan <freswa at archlinux dot org>
3 # Contributor: Guillaume ALAUX <guillaume@archlinux.org>
5 # TODO add test, see about packaging jtreg and using it here
8 pkgname=('jre-openjdk-headless' 'jre-openjdk' 'jdk-openjdk' 'openjdk-src' 'openjdk-doc')
13 pkgver=${_majorver}.${_minorver}.${_securityver}.u${_updatever}
14 #pkgver=${_majorver}.u${_updatever}
16 _git_tag=jdk-${_majorver}.${_minorver}.${_securityver}+${_updatever}
17 #_git_tag=jdk-${_majorver}+${_updatever}
19 url='https://openjdk.java.net/'
21 makedepends=('java-environment>=17' 'cpio' 'unzip' 'zip' 'libelf' 'libcups' 'libx11'
22 'libxrender' 'libxtst' 'libxt' 'libxext' 'libxrandr' 'alsa-lib' 'pandoc'
23 'graphviz' 'freetype2' 'libjpeg-turbo' 'giflib' 'libpng' 'lcms2'
24 'libnet' 'bash' 'harfbuzz' 'gcc-libs' 'glibc')
26 source=(https://github.com/openjdk/jdk${_majorver}u/archive/${_git_tag}.tar.gz
27 freedesktop-java.desktop
28 freedesktop-jconsole.desktop
29 freedesktop-jshell.desktop)
30 sha256sums=('1b7f42ecedf97a837b1f3499d2b6293b26ffed97627b1bd883452c21cf9f798b'
31 '761d4f1274c7dfb4ff61f6d6cb01504f2f886240229e371647ce227fcf81278e'
32 '2b17178ac414e1d0768c8f482779efa88bfeab17b8b0517df4e66b3c2874131c'
33 '82329d23887df14bce3f8d8f356fe8f4b643831d40ade5fed31a070516f86fd7')
36 x86_64) _JARCH='x86_64';;
40 _jvmdir=/usr/lib/jvm/java-${_majorver}-openjdk
41 _jdkdir=jdk${_majorver}u-${_git_tag//+/-}
42 _imgdir=${_jdkdir}/build/linux-${_JARCH}-server-release/images
44 _nonheadless=(lib/libawt_xawt.so
47 lib/libsplashscreen.so)
59 MAKEFLAG_J=$(echo ${MAKEFLAGS} | sed -En 's/.*-j([0-9]+).*/\1/p')
60 if [ -n "${MAKEFLAG_J}" ]; then
61 # http://hg.openjdk.java.net/jdk10/jdk10/file/85e6cb013b98/make/InitSupport.gmk#l105
62 echo "Removing '-j${MAKEFLAG_J}' from MAKEFLAGS to prevent build fail. Passing it directly to ./configure."
63 export MAKEFLAGS=${MAKEFLAGS/-j${MAKEFLAG_J}/}
64 NUM_PROC_OPT="--with-num-cores=${MAKEFLAG_J}"
67 # Avoid optimization of HotSpot to be lowered from O3 to O2
68 local _CFLAGS="${CFLAGS//-O2/-O3} ${CPPFLAGS} -fcommon"
69 local _CXXFLAGS="${CXXFLAGS//-O2/-O3} ${CPPFLAGS} -fcommon"
70 local _LDFLAGS=${LDFLAGS}
71 if [[ ${CARCH} = i686 ]]; then
72 echo "Removing '-fno-plt' from CFLAGS and CXXFLAGS to prevent build fail with this architecture"
73 _CFLAGS=${CFLAGS/-fno-plt/}
74 _CXXFLAGS=${CXXFLAGS/-fno-plt/}
77 # TODO: Should be rechecked for the next releases
78 # compiling with -fexceptions leads to:
79 # /usr/bin/ld: /build/java-openjdk/src/jdk17u-jdk-17.0.3-2/build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/zPhysicalMemory.o: in function `ZList<ZMemory>::~ZList()':
80 # /build/java-openjdk/src/jdk17u-jdk-17.0.3-2/src/hotspot/share/gc/z/zList.hpp:54: undefined reference to `ZListNode<ZMemory>::~ZListNode()'
81 # collect2: error: ld returned 1 exit status
82 _CFLAGS=${CFLAGS/-fexceptions/}
83 _CXXFLAGS=${CXXFLAGS/-fexceptions/}
85 # CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
86 # in the output of ./configure unless used like such:
87 # --with-extra-cflags="${CFLAGS}"
88 # --with-extra-cxxflags="${CXXFLAGS}"
89 # --with-extra-ldflags="${LDFLAGS}"
90 # See also paragraph "Configure Control Variables from "jdk${_majorver}-${_git_tag}/common/doc/building.md
96 --with-version-build="${_updatever}" \
97 --with-version-pre="" \
98 --with-version-opt="" \
99 --with-stdc++lib=dynamic \
100 --with-extra-cflags="${_CFLAGS}" \
101 --with-extra-cxxflags="${_CXXFLAGS}" \
102 --with-extra-ldflags="${_LDFLAGS}" \
103 --with-libjpeg=system \
104 --with-giflib=system \
105 --with-libpng=system \
108 --with-harfbuzz=system \
109 --with-jvm-features=zgc,shenandoahgc \
110 --with-native-debug-symbols=internal \
111 --enable-unlimited-crypto \
112 --disable-warnings-as-errors \
114 #--disable-javac-server
116 make images legacy-jre-image docs
118 # https://bugs.openjdk.java.net/browse/JDK-8173610
119 find "../${_imgdir}" -iname '*.so' -exec chmod +x {} \;
128 package_jre-openjdk-headless() {
129 pkgdesc="OpenJDK Java ${_majorver} headless runtime environment"
130 depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
131 'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
133 optdepends=('java-rhino: for some JavaScript support')
134 provides=("java-runtime-headless=${_majorver}" "java-runtime-headless-openjdk=${_majorver}" "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}")
135 backup=(etc/${pkgbase}/logging.properties
136 etc/${pkgbase}/management/jmxremote.access
137 etc/${pkgbase}/management/jmxremote.password.template
138 etc/${pkgbase}/management/management.properties
139 etc/${pkgbase}/net.properties
140 etc/${pkgbase}/security/java.policy
141 etc/${pkgbase}/security/java.security
142 etc/${pkgbase}/security/policy/README.txt
143 etc/${pkgbase}/security/policy/limited/default_US_export.policy
144 etc/${pkgbase}/security/policy/limited/default_local.policy
145 etc/${pkgbase}/security/policy/limited/exempt_local.policy
146 etc/${pkgbase}/security/policy/unlimited/default_US_export.policy
147 etc/${pkgbase}/security/policy/unlimited/default_local.policy
148 etc/${pkgbase}/sound.properties)
149 install=install_jre-openjdk-headless.sh
153 install -dm 755 "${pkgdir}${_jvmdir}"/bin
155 for i in $(ls bin/); do
156 cp ../jdk/bin/$i "${pkgdir}${_jvmdir}/bin/"
159 cp -a ../jdk/lib "${pkgdir}${_jvmdir}"
161 for f in "${_nonjre[@]}"; do
162 rm "${pkgdir}${_jvmdir}/${f}"
165 for f in "${_nonheadless[@]}"; do
166 rm "${pkgdir}${_jvmdir}/${f}"
169 cp ../jdk/release "${pkgdir}${_jvmdir}"
170 cp ../jdk/lib/modules "${pkgdir}${_jvmdir}/lib"
173 install -dm 755 "${pkgdir}/etc"
174 cp -r conf "${pkgdir}/etc/${pkgbase}"
175 ln -s /etc/${pkgbase} "${pkgdir}/${_jvmdir}/conf"
178 install -dm 755 "${pkgdir}/usr/share/licenses"
179 cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
180 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
181 ln -s /usr/share/licenses/${pkgbase} "${pkgdir}/${_jvmdir}/legal"
186 _man=../jdk/man/man1/"${f}.1"
187 test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
189 ln -s /usr/share/man "${pkgdir}/${_jvmdir}/man"
191 # Link JKS keystore from ca-certificates-utils
192 rm -f "${pkgdir}${_jvmdir}/lib/security/cacerts"
193 ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/lib/security/cacerts"
196 package_jre-openjdk() {
197 pkgdesc="OpenJDK Java ${_majorver} full runtime environment"
198 depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
199 'glibc' 'gcc-libs' 'libpng')
200 optdepends=('alsa-lib: for basic sound support'
201 'gtk2: for the Gtk+ 2 look and feel - desktop usage'
202 'gtk3: for the Gtk+ 3 look and feel - desktop usage')
203 provides=("java-runtime=${_majorver}" "java-runtime-openjdk=${_majorver}" "jre${_majorver}-openjdk=${pkgver}-${pkgrel}")
204 install=install_jre-openjdk.sh
208 install -dm 755 "${pkgdir}${_jvmdir}"
210 for f in "${_nonheadless[@]}"; do
211 install -Dm 644 ${f} "${pkgdir}${_jvmdir}/${f}"
215 install -dm 755 "${pkgdir}/usr/share/licenses"
216 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
219 package_jdk-openjdk() {
220 pkgdesc="OpenJDK Java ${_majorver} development kit"
221 depends=("jre${_majorver}-openjdk=${pkgver}-${pkgrel}" 'java-environment-common=3'
222 'hicolor-icon-theme' 'libelf' 'glibc' 'gcc-libs')
223 provides=("java-environment=${_majorver}" "java-environment-openjdk=${_majorver}" "jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
224 install=install_jdk-openjdk.sh
228 install -dm 755 "${pkgdir}${_jvmdir}"
230 cp -a bin demo include jmods lib \
231 "${pkgdir}${_jvmdir}"
233 rm "${pkgdir}${_jvmdir}/lib/src.zip"
235 # Remove files held by JRE
238 find ${d} ! -type d -exec rm "${pkgdir}${_jvmdir}/{}" \;
241 find "${pkgdir}${_jvmdir}/lib" -type d -empty -delete
243 # Conf files all belong to JRE
246 install -dm 755 "${pkgdir}/usr/share/licenses"
247 cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
249 find . ! -type d -exec rm "${pkgdir}/usr/share/licenses/${pkgbase}/{}" \;
251 find "${pkgdir}/usr/share/licenses" -type d -empty -delete
252 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
257 _man=man/man1/"${f}.1"
258 test -f "../jre/bin/${f}" && continue
259 test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
263 for s in 16 24 32 48; do
265 "${srcdir}/${_jdkdir}/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png" \
266 "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/${pkgbase}.png"
270 for f in jconsole java jshell; do
272 "${srcdir}/freedesktop-${f}.desktop" \
273 "${pkgdir}/usr/share/applications/${f}-${pkgbase}.desktop"
277 package_openjdk-src() {
278 pkgdesc="OpenJDK Java ${_majorver} sources"
279 # Depends on JDK to get license files
280 depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
281 provides=("openjdk${_majorver}-src=${pkgver}-${pkgrel}")
283 install -Dm 644 -t "${pkgdir}${_jvmdir}/lib" ${_imgdir}/jdk/lib/src.zip
285 install -dm 755 "${pkgdir}/usr/share/licenses"
286 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
289 package_openjdk-doc() {
290 pkgdesc="OpenJDK Java ${_majorver} documentation"
291 # Depends on JDK to get license files
292 depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
293 provides=("openjdk${_majorver}-doc=${pkgver}-${pkgrel}")
295 install -dm 755 "${pkgdir}/usr/share/doc"
296 cp -r ${_imgdir}/docs "${pkgdir}/usr/share/doc/${pkgbase}"
298 install -dm 755 "${pkgdir}/usr/share/licenses"
299 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"