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=('jre17-openjdk-headless' 'jre17-openjdk' 'jdk17-openjdk' 'openjdk17-src' 'openjdk17-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=('22575340d080a396442658356583d9c7dc0c44cefa52842fbfcf23eef23c39a0'
31 '85c4742764590783160af74587a47269e6797fbdf17ec485c7644bd239adf61d'
32 'abac1ab09a33a3654378bc69be5a7cf075263ab3ae9efec1eb25cf388e711bb7'
33 'e7cce0ecf868f656d8dc2eb25ab82ab665526a0a28aba20f02632dd29962dac3')
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,debuginfo}
45 lib/libjawt.{so,debuginfo}
46 lib/libjsound.{so,debuginfo}
47 lib/libsplashscreen.{so,debuginfo})
53 MAKEFLAG_J=$(echo ${MAKEFLAGS} | sed -En 's/.*-j([0-9]+).*/\1/p')
54 if [ -n "${MAKEFLAG_J}" ]; then
55 # http://hg.openjdk.java.net/jdk10/jdk10/file/85e6cb013b98/make/InitSupport.gmk#l105
56 echo "Removing '-j${MAKEFLAG_J}' from MAKEFLAGS to prevent build fail. Passing it directly to ./configure."
57 export MAKEFLAGS=${MAKEFLAGS/-j${MAKEFLAG_J}/}
58 NUM_PROC_OPT="--with-num-cores=${MAKEFLAG_J}"
61 # Avoid optimization of HotSpot to be lowered from O3 to O2
62 local _CFLAGS="${CFLAGS//-O2/-O3} ${CPPFLAGS} -fcommon"
63 local _CXXFLAGS="${CXXFLAGS//-O2/-O3} ${CPPFLAGS} -fcommon"
64 local _LDFLAGS=${LDFLAGS}
65 if [[ ${CARCH} = i686 ]]; then
66 echo "Removing '-fno-plt' from CFLAGS and CXXFLAGS to prevent build fail with this architecture"
67 _CFLAGS=${CFLAGS/-fno-plt/}
68 _CXXFLAGS=${CXXFLAGS/-fno-plt/}
71 # TODO: Should be rechecked for the next releases
72 # compiling with -fexceptions leads to:
73 # /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()':
74 # /build/java-openjdk/src/jdk17u-jdk-17.0.3-2/src/hotspot/share/gc/z/zList.hpp:54: undefined reference to `ZListNode<ZMemory>::~ZListNode()'
75 # collect2: error: ld returned 1 exit status
76 _CFLAGS=${CFLAGS/-fexceptions/}
77 _CXXFLAGS=${CXXFLAGS/-fexceptions/}
79 # CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
80 # in the output of ./configure unless used like such:
81 # --with-extra-cflags="${CFLAGS}"
82 # --with-extra-cxxflags="${CXXFLAGS}"
83 # --with-extra-ldflags="${LDFLAGS}"
84 # See also paragraph "Configure Control Variables from "jdk${_majorver}-${_git_tag}/common/doc/building.md
90 --with-version-build="${_updatever}" \
91 --with-version-pre="" \
92 --with-version-opt="" \
93 --with-stdc++lib=dynamic \
94 --with-extra-cflags="${_CFLAGS}" \
95 --with-extra-cxxflags="${_CXXFLAGS}" \
96 --with-extra-ldflags="${_LDFLAGS}" \
97 --with-libjpeg=system \
98 --with-giflib=system \
99 --with-libpng=system \
102 --with-harfbuzz=system \
103 --with-jvm-features=zgc \
104 --enable-unlimited-crypto \
105 --disable-warnings-as-errors \
107 #--disable-javac-server
109 make images legacy-jre-image docs
111 # https://bugs.openjdk.java.net/browse/JDK-8173610
112 find "../${_imgdir}" -iname '*.so' -exec chmod +x {} \;
121 package_jre17-openjdk-headless() {
122 pkgdesc="OpenJDK Java ${_majorver} headless runtime environment"
123 depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
124 'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
126 optdepends=('java-rhino: for some JavaScript support')
127 provides=("java-runtime-headless=${_majorver}" "java-runtime-headless-openjdk=${_majorver}" "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}")
128 backup=(etc/${pkgbase}/logging.properties
129 etc/${pkgbase}/management/jmxremote.access
130 etc/${pkgbase}/management/jmxremote.password.template
131 etc/${pkgbase}/management/management.properties
132 etc/${pkgbase}/net.properties
133 etc/${pkgbase}/security/java.policy
134 etc/${pkgbase}/security/java.security
135 etc/${pkgbase}/security/policy/README.txt
136 etc/${pkgbase}/security/policy/limited/default_US_export.policy
137 etc/${pkgbase}/security/policy/limited/default_local.policy
138 etc/${pkgbase}/security/policy/limited/exempt_local.policy
139 etc/${pkgbase}/security/policy/unlimited/default_US_export.policy
140 etc/${pkgbase}/security/policy/unlimited/default_local.policy
141 etc/${pkgbase}/sound.properties)
142 install=install_jre-openjdk-headless.sh
146 install -dm 755 "${pkgdir}${_jvmdir}"
149 "${pkgdir}${_jvmdir}"
151 for f in "${_nonheadless[@]}"; do
152 rm "${pkgdir}${_jvmdir}/${f}"
155 cp ../jdk/release "${pkgdir}${_jvmdir}"
156 cp ../jdk/lib/modules "${pkgdir}${_jvmdir}/lib"
159 install -dm 755 "${pkgdir}/etc"
160 cp -r conf "${pkgdir}/etc/${pkgbase}"
161 ln -s /etc/${pkgbase} "${pkgdir}/${_jvmdir}/conf"
164 install -dm 755 "${pkgdir}/usr/share/licenses"
165 cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
166 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
167 ln -s /usr/share/licenses/${pkgbase} "${pkgdir}/${_jvmdir}/legal"
172 _man=../jdk/man/man1/"${f}.1"
173 test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
175 ln -s /usr/share/man "${pkgdir}/${_jvmdir}/man"
177 # Link JKS keystore from ca-certificates-utils
178 rm -f "${pkgdir}${_jvmdir}/lib/security/cacerts"
179 ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/lib/security/cacerts"
182 package_jre17-openjdk() {
183 pkgdesc="OpenJDK Java ${_majorver} full runtime environment"
184 depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
185 'glibc' 'gcc-libs' 'libpng')
186 optdepends=('alsa-lib: for basic sound support'
187 'gtk2: for the Gtk+ 2 look and feel - desktop usage'
188 'gtk3: for the Gtk+ 3 look and feel - desktop usage')
189 provides=("java-runtime=${_majorver}" "java-runtime-openjdk=${_majorver}" "jre${_majorver}-openjdk=${pkgver}-${pkgrel}")
190 install=install_jre-openjdk.sh
194 install -dm 755 "${pkgdir}${_jvmdir}"
196 for f in "${_nonheadless[@]}"; do
197 install -Dm 644 ${f} "${pkgdir}${_jvmdir}/${f}"
201 install -dm 755 "${pkgdir}/usr/share/licenses"
202 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
205 package_jdk17-openjdk() {
206 pkgdesc="OpenJDK Java ${_majorver} development kit"
207 depends=("jre${_majorver}-openjdk=${pkgver}-${pkgrel}" 'java-environment-common=3'
208 'hicolor-icon-theme' 'libelf' 'glibc' 'gcc-libs')
209 provides=("java-environment=${_majorver}" "java-environment-openjdk=${_majorver}" "jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
210 install=install_jdk-openjdk.sh
214 install -dm 755 "${pkgdir}${_jvmdir}"
216 cp -a bin demo include jmods lib \
217 "${pkgdir}${_jvmdir}"
219 rm "${pkgdir}${_jvmdir}/lib/src.zip"
221 # Remove files held by JRE
224 find ${d} ! -type d -exec rm "${pkgdir}${_jvmdir}/{}" \;
227 find "${pkgdir}${_jvmdir}/lib" -type d -empty -delete
229 # Conf files all belong to JRE
232 install -dm 755 "${pkgdir}/usr/share/licenses"
233 cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
235 find . ! -type d -exec rm "${pkgdir}/usr/share/licenses/${pkgbase}/{}" \;
237 find "${pkgdir}/usr/share/licenses" -type d -empty -delete
238 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
243 _man=man/man1/"${f}.1"
244 test -f "../jre/bin/${f}" && continue
245 test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
249 for s in 16 24 32 48; do
251 "${srcdir}/${_jdkdir}/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png" \
252 "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/${pkgbase}.png"
256 for f in jconsole java jshell; do
258 "${srcdir}/freedesktop-${f}.desktop" \
259 "${pkgdir}/usr/share/applications/${f}-${pkgbase}.desktop"
263 package_openjdk17-src() {
264 pkgdesc="OpenJDK Java ${_majorver} sources"
265 # Depends on JDK to get license files
266 depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
267 provides=("openjdk${_majorver}-src=${pkgver}-${pkgrel}")
269 install -Dm 644 -t "${pkgdir}${_jvmdir}/lib" ${_imgdir}/jdk/lib/src.zip
271 install -dm 755 "${pkgdir}/usr/share/licenses"
272 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
275 package_openjdk17-doc() {
276 pkgdesc="OpenJDK Java ${_majorver} documentation"
277 # Depends on JDK to get license files
278 depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
279 provides=("openjdk${_majorver}-doc=${pkgver}-${pkgrel}")
281 install -dm 755 "${pkgdir}/usr/share/doc"
282 cp -r ${_imgdir}/docs "${pkgdir}/usr/share/doc/${pkgbase}"
284 install -dm 755 "${pkgdir}/usr/share/licenses"
285 ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"