OCaml 5.0.0 rebuild: Fix Pervasives deprecation
[arch-packages.git] / java11-openjdk / repos / extra-x86_64 / PKGBUILD
blobd0687a21437ac61d46d430ad12abee690454fd45
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
6 # TODO see about building with OpenJDK10
7 # TODO add javazi
8 # TODO when IcedTea provides it, package icedtea-web and add it as optdepends
9 # TODO package OpenJFX for OpenJDK10 and add it as optdepends
11 ## EXPLORATIONS
12 # TODO extract a jmods package from jdk10-openjdk?
13 # TODO extract a jdk-headless package?
15 pkgbase=java11-openjdk
16 pkgname=('jre11-openjdk-headless' 'jre11-openjdk' 'jdk11-openjdk' 'openjdk11-src' 'openjdk11-doc')
17 _majorver=11
18 _minorver=0
19 _securityver=19
20 _updatever=7
21 pkgver=${_majorver}.${_minorver}.${_securityver}.u${_updatever}
22 pkgrel=1
23 _git_tag=jdk-${_majorver}.${_minorver}.${_securityver}+${_updatever}
24 arch=('x86_64')
25 url='https://openjdk.java.net/'
26 license=('custom')
27 makedepends=('java-environment>=10' 'java-environment<12' 'cpio' 'unzip' 'zip' 'libelf' 'libcups' 'libx11'
28              'libxrender' 'libxtst' 'libxt' 'libxext' 'libxrandr' 'alsa-lib' 'pandoc'
29              'graphviz' 'freetype2' 'libjpeg-turbo' 'giflib' 'libpng' 'lcms2'
30              'libnet' 'bash' 'harfbuzz' 'glibc' 'gcc-libs')
31 options=(!lto)
32 source=(https://github.com/openjdk/jdk${_majorver}u/archive/${_git_tag}.tar.gz
33         freedesktop-java.desktop
34         freedesktop-jconsole.desktop
35         freedesktop-jshell.desktop)
36 sha256sums=('25fd9ab3042a284aa4e6348969403016404bc2706a4a02c149a0054fbe477337'
37             '575587ad58dfa9908f046d307b9afc7b0b2eb20a1eb454f8fdbbd539ea7b3d01'
38             '2f57b7c7dd671eabe9fa10c4f1283573e99d7f7c36eccd82c95b705979a2e8cb'
39             'f271618a8c2a892b554caf26857af41efdf0d8bcb95d57ce7ba535d6979e96da')
41 case "${CARCH}" in
42   x86_64) _JARCH='x86_64';;
43   i686)   _JARCH='x86';;
44 esac
46 _jvmdir=/usr/lib/jvm/java-${_majorver}-openjdk
47 _jdkdir=jdk${_majorver}u-${_git_tag//+/-}
48 _imgdir=${_jdkdir}/build/linux-${_JARCH}-normal-server-release/images
50 _nonheadless=(lib/libawt_xawt.so
51               lib/libjawt.so
52               lib/libjsound.so
53               lib/libsplashscreen.so)
55 build() {
56   cd ${_jdkdir}
58   NUM_PROC_OPT=''
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}"
65   fi
67   # Avoid optimization of HotSpot being 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/}
75   fi
77   # CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
78   # in the output of ./configure unless used like such:
79   #  --with-extra-cflags="${CFLAGS}"
80   #  --with-extra-cxxflags="${CXXFLAGS}"
81   #  --with-extra-ldflags="${LDFLAGS}"
82   # See also paragraph "Configure Control Variables from "jdk${_majorver}-${_git_tag}/common/doc/building.md
83   unset CFLAGS
84   unset CXXFLAGS
85   unset LDFLAGS
87   bash configure \
88     --with-version-build="${_updatever}" \
89     --with-version-pre="" \
90     --with-version-opt="" \
91     --with-stdc++lib=dynamic \
92     --with-extra-cflags="${_CFLAGS}" \
93     --with-extra-cxxflags="${_CXXFLAGS}" \
94     --with-extra-ldflags="${_LDFLAGS}" \
95     --with-libjpeg=system \
96     --with-giflib=system \
97     --with-libpng=system \
98     --with-lcms=system \
99     --with-zlib=system \
100     --with-harfbuzz=system \
101     --with-jvm-features=zgc,shenandoahgc \
102     --with-native-debug-symbols=internal \
103     --enable-unlimited-crypto \
104     --disable-warnings-as-errors \
105     ${NUM_PROC_OPT}
106     #--disable-javac-server
108   make images legacy-jre-image docs
110   # https://bugs.openjdk.java.net/browse/JDK-8173610
111   find "../${_imgdir}" -iname '*.so' -exec chmod +x {} \;
114 check() {
115   cd ${_jdkdir}
116   # TODO package jtreg
117   # make -k check
120 package_jre11-openjdk-headless() {
121   pkgdesc="OpenJDK Java ${_majorver} headless runtime environment"
122   depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
123            'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
124            'glibc' 'gcc-libs')
125   optdepends=('java-rhino: for some JavaScript support')
126   provides=("java-runtime-headless=${_majorver}" "java-runtime-headless-openjdk=${_majorver}" "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}")
127   backup=(etc/${pkgbase}/logging.properties
128           etc/${pkgbase}/management/jmxremote.access
129           etc/${pkgbase}/management/jmxremote.password.template
130           etc/${pkgbase}/management/management.properties
131           etc/${pkgbase}/net.properties
132           etc/${pkgbase}/security/java.policy
133           etc/${pkgbase}/security/java.security
134           etc/${pkgbase}/security/policy/README.txt
135           etc/${pkgbase}/security/policy/limited/default_US_export.policy
136           etc/${pkgbase}/security/policy/limited/default_local.policy
137           etc/${pkgbase}/security/policy/limited/exempt_local.policy
138           etc/${pkgbase}/security/policy/unlimited/default_US_export.policy
139           etc/${pkgbase}/security/policy/unlimited/default_local.policy
140           etc/${pkgbase}/sound.properties)
141   install=install_jre-openjdk-headless.sh
143   cd ${_imgdir}/jre
145   install -dm 755 "${pkgdir}${_jvmdir}"
147   cp -a bin lib \
148     "${pkgdir}${_jvmdir}"
150   for f in "${_nonheadless[@]}"; do
151     rm "${pkgdir}${_jvmdir}/${f}"
152   done
154   cp ../jdk/release "${pkgdir}${_jvmdir}"
155   cp ../jdk/lib/modules "${pkgdir}${_jvmdir}/lib"
157   # Conf
158   install -dm 755 "${pkgdir}/etc"
159   cp -r conf "${pkgdir}/etc/${pkgbase}"
160   ln -s /etc/${pkgbase} "${pkgdir}/${_jvmdir}/conf"
162   # Legal
163   install -dm 755 "${pkgdir}/usr/share/licenses"
164   cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
165   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
166   ln -s /usr/share/licenses/${pkgbase} "${pkgdir}/${_jvmdir}/legal"
168   # Man pages
169   for f in man/man1/* man/ja/man1/*; do
170     install -Dm 644 "${f}" "${pkgdir}/usr/share/${f/\.1/-openjdk${_majorver}.1}"
171   done
172   ln -s /usr/share/man "${pkgdir}/${_jvmdir}/man"
174   # Link JKS keystore from ca-certificates-utils
175   rm -f "${pkgdir}${_jvmdir}/lib/security/cacerts"
176   ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/lib/security/cacerts"
179 package_jre11-openjdk() {
180   pkgdesc="OpenJDK Java ${_majorver} full runtime environment"
181   depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
182            'glibc' 'gcc-libs' 'libpng')
183   optdepends=('alsa-lib: for basic sound support'
184               'gtk2: for the Gtk+ 2 look and feel - desktop usage'
185               'gtk3: for the Gtk+ 3 look and feel - desktop usage')
186   provides=("java-runtime=${_majorver}" "java-runtime-openjdk=${_majorver}" "jre${_majorver}-openjdk=${pkgver}-${pkgrel}")
187   install=install_jre-openjdk.sh
189   cd ${_imgdir}/jre
191   install -dm 755 "${pkgdir}${_jvmdir}"
193   for f in "${_nonheadless[@]}"; do
194     install -Dm 644 ${f} "${pkgdir}${_jvmdir}/${f}"
195   done
197   # Licenses
198   install -dm 755 "${pkgdir}/usr/share/licenses"
199   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
202 package_jdk11-openjdk() {
203   pkgdesc="OpenJDK Java ${_majorver} development kit"
204   depends=("jre${_majorver}-openjdk=${pkgver}-${pkgrel}" 'java-environment-common=3'
205            'hicolor-icon-theme' 'libelf' 'glibc' 'gcc-libs')
206   provides=("java-environment=${_majorver}" "java-environment-openjdk=${_majorver}" "jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
207   install=install_jdk-openjdk.sh
209   cd ${_imgdir}/jdk
211   install -dm 755 "${pkgdir}${_jvmdir}"
213   cp -a bin demo include jmods lib \
214     "${pkgdir}${_jvmdir}"
216   rm "${pkgdir}${_jvmdir}/lib/src.zip"
218   # Remove files held by JRE
219   pushd ../jre
220   for d in bin lib; do
221     find ${d} ! -type d -exec rm "${pkgdir}${_jvmdir}/{}" \;
222   done
223   popd
224   find "${pkgdir}${_jvmdir}/lib" -type d -empty -delete
226   # Conf files all belong to JRE
228   # Legal
229   install -dm 755 "${pkgdir}/usr/share/licenses"
230   cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
231   pushd ../jre/legal
232   find . ! -type d -exec rm "${pkgdir}/usr/share/licenses/${pkgbase}/{}" \;
233   popd
234   find "${pkgdir}/usr/share/licenses" -type d -empty -delete
235   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
237   # Man pages
238   for f in man/man1/* man/ja/man1/*; do
239     if [ ! -e "../jre/${f}" ]; then
240       install -Dm 644 "${f}" "${pkgdir}/usr/share/${f/\.1/-openjdk${_majorver}.1}"
241     fi
242   done
244   # Icons
245   for s in 16 24 32 48; do
246     install -Dm 644 \
247       "${srcdir}/${_jdkdir}/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png" \
248       "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/${pkgbase}.png"
249   done
251   # Desktop files
252   for f in jconsole java jshell; do
253     install -Dm 644 \
254       "${srcdir}/freedesktop-${f}.desktop" \
255       "${pkgdir}/usr/share/applications/${f}-${pkgbase}.desktop"
256   done
259 package_openjdk11-src() {
260   pkgdesc="OpenJDK Java ${_majorver} sources"
261   # Depends on JDK to get license files
262   depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
263   provides=("openjdk${_majorver}-src=${pkgver}-${pkgrel}")
265   install -Dm 644 -t "${pkgdir}${_jvmdir}/lib" ${_imgdir}/jdk/lib/src.zip
267   install -dm 755 "${pkgdir}/usr/share/licenses"
268   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
271 package_openjdk11-doc() {
272   pkgdesc="OpenJDK Java ${_majorver} documentation"
273   # Depends on JDK to get license files
274   depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
275   provides=("openjdk${_majorver}-doc=${pkgver}-${pkgrel}")
277   install -dm 755 "${pkgdir}/usr/share/doc"
278   cp -r ${_imgdir}/docs "${pkgdir}/usr/share/doc/${pkgbase}"
280   install -dm 755 "${pkgdir}/usr/share/licenses"
281   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
284 # vim: ts=2 sw=2 et: