archrelease: copy trunk to extra-x86_64
[arch-packages.git] / java8-openjdk / trunk / PKGBUILD
blob13b07775a4596d4b1ff09dbb93796d68cd609bf7
1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: Frederik Schwan <freswa at archlinux dot org>
3 # Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
4 # Contributor: Boyan Ding <stu_dby@126.com>
6 pkgname=('jre8-openjdk-headless' 'jre8-openjdk' 'jdk8-openjdk' 'openjdk8-src' 'openjdk8-doc')
7 pkgbase=java8-openjdk
9 _majorver=8
10 _minorver=332
11 _updatever=09
12 pkgver=${_majorver}.${_minorver}.u${_updatever}
13 pkgrel=1
14 _git_tag=jdk${_majorver}u${_minorver}-b${_updatever}
15 arch=('x86_64')
16 url='https://openjdk.java.net/'
17 license=('custom')
18 makedepends=('java-environment=8' 'ccache' 'cpio' 'unzip' 'zip' 'git' 'bash'
19              'libxrender' 'libxtst' 'fontconfig' 'libcups' 'alsa-lib')
20 options=(!lto)
21 source=(git+https://github.com/openjdk/jdk${_majorver}u.git#tag=${_git_tag}
22         gcc11.patch)
23 sha256sums=('SKIP'
24             'e1e9452b2078c3e9b45aa73491f3f187e7a9abbc40b6a7fc9239d4e5e525569e')
26 case "${CARCH}" in
27   'x86_64') _JARCH=amd64 ; _DOC_ARCH=x86_64 ;;
28   'i686'  ) _JARCH=i386  ; _DOC_ARCH=x86    ;;
29 esac
31 _jdkname=openjdk8
32 _jvmdir=/usr/lib/jvm/java-8-openjdk
33 _prefix="jdk8u/image"
34 _imgdir="${_prefix}/jvm/openjdk-1.8.0_$(printf '%.2d' ${_minorver})"
35 _nonheadless=(bin/policytool
36               lib/${_JARCH}/libjsound.so
37               lib/${_JARCH}/libjsoundalsa.so
38               lib/${_JARCH}/libsplashscreen.so)
40 prepare() {
41   cd jdk8u
43   # Fix build with C++17 (Fedora)
44   patch -Np1 -i "${srcdir}"/gcc11.patch
47 build() {
48   cd jdk8u
50   unset JAVA_HOME
51   # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1346
52   export MAKEFLAGS=${MAKEFLAGS/-j*}
54   # Avoid optimization of HotSpot being lowered from O3 to O2
55   # -fno-exceptions for FS#73134
56   export CFLAGS="${CFLAGS//-O2/-O3} -Wno-error=nonnull -Wno-error=deprecated-declarations -Wno-error=stringop-overflow= -Wno-error=return-type -Wno-error=cpp -fno-lifetime-dse -fno-delete-null-pointer-checks -fcommon -fno-exceptions -Wno-error=format-overflow="
57   export CXXFLAGS="${CXXFLAGS} -fcommon -fno-exceptions"
59   install -d -m 755 "${srcdir}/${_prefix}/"
60   bash configure \
61     --prefix="${srcdir}/${_prefix}" \
62     --with-update-version="${_minorver}" \
63     --with-build-number="b${_updatever}" \
64     --with-milestone="fcs" \
65     --enable-unlimited-crypto \
66     --with-zlib=system \
67     --with-extra-cflags="${CFLAGS}" \
68     --with-extra-cxxflags="${CXXFLAGS}" \
69     --with-extra-ldflags="${LDFLAGS}"
71   # TODO OpenJDK does not want last version of giflib (add 'giflib' as dependency once fixed)
72   #--with-giflib=system \
74   # These help to debug builds: LOG=trace HOTSPOT_BUILD_JOBS=1
75   # Without 'DEBUG_BINARIES', i686 won't build: http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-July/019203.html
76   make
77   make docs
79   # FIXME sadly 'DESTDIR' is not used here!
80   make install
82   cd ../${_imgdir}
84   # A lot of build stuff were directly taken from
85   # http://pkgs.fedoraproject.org/cgit/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec
87   # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
88   find . -iname '*.jar' -exec chmod ugo+r {} \;
89   chmod ugo+r lib/ct.sym
91   # remove redundant *diz and *debuginfo files
92   find . -iname '*.diz' -exec rm {} \;
93   find . -iname '*.debuginfo' -exec rm {} \;
96 check() {
97   cd jdk8u
98   #make -k test
101 package_jre8-openjdk-headless() {
102   pkgdesc='OpenJDK Java 8 headless runtime environment'
103   depends=('java-runtime-common' 'ca-certificates-utils' 'nss')
104   optdepends=('java-rhino: for some JavaScript support')
105   provides=('java-runtime-headless=8' 'java-runtime-headless-openjdk=8')
106   # Upstream config files that should go to etc and get backup
107   _backup_etc=(etc/java-8-openjdk/${_JARCH}/jvm.cfg
108                etc/java-8-openjdk/calendars.properties
109                etc/java-8-openjdk/content-types.properties
110                etc/java-8-openjdk/flavormap.properties
111                etc/java-8-openjdk/images/cursors/cursors.properties
112                etc/java-8-openjdk/logging.properties
113                etc/java-8-openjdk/management/jmxremote.access
114                etc/java-8-openjdk/management/jmxremote.password
115                etc/java-8-openjdk/management/management.properties
116                etc/java-8-openjdk/management/snmp.acl
117                etc/java-8-openjdk/net.properties
118                etc/java-8-openjdk/psfont.properties.ja
119                etc/java-8-openjdk/psfontj2d.properties
120                etc/java-8-openjdk/security/java.policy
121                etc/java-8-openjdk/security/java.security
122                etc/java-8-openjdk/sound.properties)
123   replaces=('jre8-openjdk-headless-wm')
124   backup=(${_backup_etc[@]})
125   install=install_jre8-openjdk-headless.sh
127   cd ${_imgdir}/jre
129   install -d -m 755 "${pkgdir}${_jvmdir}/jre/"
130   cp -a bin lib "${pkgdir}${_jvmdir}/jre"
132   cp ../release "${pkgdir}${_jvmdir}" # FS#52692
134   # Set config files
135   mv "${pkgdir}${_jvmdir}"/jre/lib/management/jmxremote.password{.template,}
136   mv "${pkgdir}${_jvmdir}"/jre/lib/management/snmp.acl{.template,}
138   # Remove 'non-headless' lib files
139   for f in "${_nonheadless[@]}"; do
140     rm "${pkgdir}${_jvmdir}/jre/${f}"
141   done
143   # Man pages
144   pushd "${pkgdir}${_jvmdir}/jre/bin"
145   install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
146   for file in *; do
147     if [ -f "${srcdir}/${_imgdir}/man/man1/${file}.1" ]; then
148       install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
149         "${pkgdir}/usr/share/man/man1/${file}-${_jdkname}.1"
150     fi
151     if [ -f "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" ]; then
152       install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
153         "${pkgdir}/usr/share/man/ja/man1/${file}-${_jdkname}.1"
154     fi
155   done
156   popd
158   # Link JKS keystore from ca-certificates-utils
159   rm -f "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
160   ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
162   # Install license
163   install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
164   install -m 644 ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README \
165                  "${pkgdir}/usr/share/licenses/${pkgbase}"
166   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
168   # Move config files that were set in _backup_etc from ./lib to /etc
169   for file in "${_backup_etc[@]}"; do
170     _filepkgpath=${_jvmdir}/jre/lib/${file#etc/java-8-openjdk/}
171     install -D -m 644 "${pkgdir}${_filepkgpath}" "${pkgdir}/${file}"
172     ln -sf /${file} "${pkgdir}${_filepkgpath}"
173   done
176 package_jre8-openjdk() {
177   pkgdesc='OpenJDK Java 8 full runtime environment'
178   depends=("jre8-openjdk-headless=${pkgver}-${pkgrel}" 'xdg-utils' 'hicolor-icon-theme')
179   optdepends=('icedtea-web: web browser plugin + Java Web Start'
180               'alsa-lib: for basic sound support'
181               'gtk2: for the Gtk+ look and feel - desktop usage'
182               'java8-openjfx: for JavaFX GUI components support')
183   provides=('java-runtime=8' 'java-runtime-openjdk=8')
184   install=install_jre8-openjdk.sh
185   replaces=('jre8-openjdk-wm')
187   cd ${_imgdir}/jre
189   for f in "${_nonheadless[@]}"; do
190     install -D ${f} "${pkgdir}${_jvmdir}/jre/${f}"
191   done
193   # Man pages
194   pushd "${pkgdir}${_jvmdir}/jre/bin"
195   install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
196   for file in *; do
197     install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
198       "${pkgdir}/usr/share/man/man1/${file}-${_jdkname}.1"
199     install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
200       "${pkgdir}/usr/share/man/ja/man1/${file}-${_jdkname}.1"
201   done
202   popd
204   # Install license
205   install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
206   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
209 package_jdk8-openjdk() {
210   pkgdesc='OpenJDK Java 8 development kit'
211   depends=('java-environment-common' "jre8-openjdk=${pkgver}-${pkgrel}")
212   provides=('java-environment=8' 'java-environment-openjdk=8')
213   replaces=('jdk8-openjdk-wm')
214   install=install_jdk8-openjdk.sh
216   cd ${_imgdir}
218   # Main files
219   install -d -m 755 "${pkgdir}${_jvmdir}"
221   cp -a include lib "${pkgdir}${_jvmdir}"
223   # 'bin' files
224   pushd bin
226   # 'java-rmi.cgi' will be handled separately as it should not be in the PATH and has no man page
227   for b in $(ls | grep -v java-rmi.cgi); do
228     if [ -e ../jre/bin/${b} ]; then
229       # Provide a link of the jre binary in the jdk/bin/ directory
230       ln -s ../jre/bin/${b} "${pkgdir}${_jvmdir}/bin/${b}"
231     else
232       # Copy binary to jdk/bin/
233       install -D -m 755 ${b} "${pkgdir}${_jvmdir}/bin/${b}"
234       # Copy man page
235       if [ -f ../man/man1/${b}.1 ]; then
236         install -D -m 644 ../man/man1/${b}.1 "${pkgdir}/usr/share/man/man1/${b}-${_jdkname}.1"
237       fi
238       if [ -f ../man/ja/man1/${b}.1 ]; then
239         install -D -m 644 ../man/ja/man1/${b}.1 "${pkgdir}/usr/share/man/ja/man1/${b}-${_jdkname}.1"
240       fi
241     fi
242   done
243   popd
245   # Handling 'java-rmi.cgi' separately
246   install -D -m 755 bin/java-rmi.cgi "${pkgdir}${_jvmdir}/bin/java-rmi.cgi"
248   # link license
249   install -d -m 755 "${pkgdir}/usr/share/licenses/"
250   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
253 package_openjdk8-src() {
254   pkgdesc='OpenJDK Java 8 sources'
256   install -D "${srcdir}/${_imgdir}/src.zip" "${pkgdir}${_jvmdir}/src.zip"
259 package_openjdk8-doc() {
260   pkgdesc='OpenJDK Java 8 documentation'
262   install -d -m 755 "${pkgdir}/usr/share/doc/${pkgbase}/"
263   cp -r "${srcdir}"/jdk8u/build/linux-${_DOC_ARCH}-normal-server-release/docs/* \
264     "${pkgdir}/usr/share/doc/${pkgbase}/"
267 # vim: ts=2 sw=2 et: