upgpkg: sbcl 2.2.11-1
[arch-packages.git] / java11-openjdk / trunk / PKGBUILD
blob6a4c9f502395fd4e7a46e9814a64e095ede89aa6
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=17
20 _updatever=1
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=('d0bb1719468f2eb7264caa3aa6a104b4015a0cffb1995e280370d9a7de6c0509'
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,debuginfo}
51               lib/libjawt.{so,debuginfo}
52               lib/libjsound.{so,debuginfo}
53               lib/libsplashscreen.{so,debuginfo})
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     --enable-unlimited-crypto \
103     --disable-warnings-as-errors \
104     ${NUM_PROC_OPT}
105     #--disable-javac-server
107   make images legacy-jre-image docs
109   # https://bugs.openjdk.java.net/browse/JDK-8173610
110   find "../${_imgdir}" -iname '*.so' -exec chmod +x {} \;
113 check() {
114   cd ${_jdkdir}
115   # TODO package jtreg
116   # make -k check
119 package_jre11-openjdk-headless() {
120   pkgdesc="OpenJDK Java ${_majorver} headless runtime environment"
121   depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
122            'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
123            'glibc' 'gcc-libs')
124   optdepends=('java-rhino: for some JavaScript support')
125   provides=("java-runtime-headless=${_majorver}" "java-runtime-headless-openjdk=${_majorver}" "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}")
126   backup=(etc/${pkgbase}/logging.properties
127           etc/${pkgbase}/management/jmxremote.access
128           etc/${pkgbase}/management/jmxremote.password.template
129           etc/${pkgbase}/management/management.properties
130           etc/${pkgbase}/net.properties
131           etc/${pkgbase}/security/java.policy
132           etc/${pkgbase}/security/java.security
133           etc/${pkgbase}/security/policy/README.txt
134           etc/${pkgbase}/security/policy/limited/default_US_export.policy
135           etc/${pkgbase}/security/policy/limited/default_local.policy
136           etc/${pkgbase}/security/policy/limited/exempt_local.policy
137           etc/${pkgbase}/security/policy/unlimited/default_US_export.policy
138           etc/${pkgbase}/security/policy/unlimited/default_local.policy
139           etc/${pkgbase}/sound.properties)
140   install=install_jre-openjdk-headless.sh
142   cd ${_imgdir}/jre
144   install -dm 755 "${pkgdir}${_jvmdir}"
146   cp -a bin lib \
147     "${pkgdir}${_jvmdir}"
149   for f in "${_nonheadless[@]}"; do
150     rm "${pkgdir}${_jvmdir}/${f}"
151   done
153   cp ../jdk/release "${pkgdir}${_jvmdir}"
154   cp ../jdk/lib/modules "${pkgdir}${_jvmdir}/lib"
156   # Conf
157   install -dm 755 "${pkgdir}/etc"
158   cp -r conf "${pkgdir}/etc/${pkgbase}"
159   ln -s /etc/${pkgbase} "${pkgdir}/${_jvmdir}/conf"
161   # Legal
162   install -dm 755 "${pkgdir}/usr/share/licenses"
163   cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
164   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
165   ln -s /usr/share/licenses/${pkgbase} "${pkgdir}/${_jvmdir}/legal"
167   # Man pages
168   for f in man/man1/* man/ja/man1/*; do
169     install -Dm 644 "${f}" "${pkgdir}/usr/share/${f/\.1/-openjdk${_majorver}.1}"
170   done
171   ln -s /usr/share/man "${pkgdir}/${_jvmdir}/man"
173   # Link JKS keystore from ca-certificates-utils
174   rm -f "${pkgdir}${_jvmdir}/lib/security/cacerts"
175   ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/lib/security/cacerts"
178 package_jre11-openjdk() {
179   pkgdesc="OpenJDK Java ${_majorver} full runtime environment"
180   depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
181            'glibc' 'gcc-libs' 'libpng')
182   optdepends=('alsa-lib: for basic sound support'
183               'gtk2: for the Gtk+ 2 look and feel - desktop usage'
184               'gtk3: for the Gtk+ 3 look and feel - desktop usage')
185   provides=("java-runtime=${_majorver}" "java-runtime-openjdk=${_majorver}" "jre${_majorver}-openjdk=${pkgver}-${pkgrel}")
186   install=install_jre-openjdk.sh
188   cd ${_imgdir}/jre
190   install -dm 755 "${pkgdir}${_jvmdir}"
192   for f in "${_nonheadless[@]}"; do
193     install -Dm 644 ${f} "${pkgdir}${_jvmdir}/${f}"
194   done
196   # Licenses
197   install -dm 755 "${pkgdir}/usr/share/licenses"
198   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
201 package_jdk11-openjdk() {
202   pkgdesc="OpenJDK Java ${_majorver} development kit"
203   depends=("jre${_majorver}-openjdk=${pkgver}-${pkgrel}" 'java-environment-common=3'
204            'hicolor-icon-theme' 'libelf' 'glibc' 'gcc-libs')
205   provides=("java-environment=${_majorver}" "java-environment-openjdk=${_majorver}" "jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
206   install=install_jdk-openjdk.sh
208   cd ${_imgdir}/jdk
210   install -dm 755 "${pkgdir}${_jvmdir}"
212   cp -a bin demo include jmods lib \
213     "${pkgdir}${_jvmdir}"
215   rm "${pkgdir}${_jvmdir}/lib/src.zip"
217   # Remove files held by JRE
218   pushd ../jre
219   for d in bin lib; do
220     find ${d} ! -type d -exec rm "${pkgdir}${_jvmdir}/{}" \;
221   done
222   popd
223   find "${pkgdir}${_jvmdir}/lib" -type d -empty -delete
225   # Conf files all belong to JRE
227   # Legal
228   install -dm 755 "${pkgdir}/usr/share/licenses"
229   cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
230   pushd ../jre/legal
231   find . ! -type d -exec rm "${pkgdir}/usr/share/licenses/${pkgbase}/{}" \;
232   popd
233   find "${pkgdir}/usr/share/licenses" -type d -empty -delete
234   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
236   # Man pages
237   for f in man/man1/* man/ja/man1/*; do
238     if [ ! -e "../jre/${f}" ]; then
239       install -Dm 644 "${f}" "${pkgdir}/usr/share/${f/\.1/-openjdk${_majorver}.1}"
240     fi
241   done
243   # Icons
244   for s in 16 24 32 48; do
245     install -Dm 644 \
246       "${srcdir}/${_jdkdir}/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png" \
247       "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/${pkgbase}.png"
248   done
250   # Desktop files
251   for f in jconsole java jshell; do
252     install -Dm 644 \
253       "${srcdir}/freedesktop-${f}.desktop" \
254       "${pkgdir}/usr/share/applications/${f}-${pkgbase}.desktop"
255   done
258 package_openjdk11-src() {
259   pkgdesc="OpenJDK Java ${_majorver} sources"
260   # Depends on JDK to get license files
261   depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
262   provides=("openjdk${_majorver}-src=${pkgver}-${pkgrel}")
264   install -Dm 644 -t "${pkgdir}${_jvmdir}/lib" ${_imgdir}/jdk/lib/src.zip
266   install -dm 755 "${pkgdir}/usr/share/licenses"
267   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
270 package_openjdk11-doc() {
271   pkgdesc="OpenJDK Java ${_majorver} documentation"
272   # Depends on JDK to get license files
273   depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
274   provides=("openjdk${_majorver}-doc=${pkgver}-${pkgrel}")
276   install -dm 755 "${pkgdir}/usr/share/doc"
277   cp -r ${_imgdir}/docs "${pkgdir}/usr/share/doc/${pkgbase}"
279   install -dm 755 "${pkgdir}/usr/share/licenses"
280   ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
283 # vim: ts=2 sw=2 et: