db-move: moved webkitgtk-6.0 from [testing] to [extra] (x86_64)
[arch-packages.git] / java8-openjdk / trunk / PKGBUILD
blob48dcf3ee3e67487eb5201b1275ddddfaeefc09ff
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=372
11 _updatever=07
12 pkgver=${_majorver}.${_minorver}.u${_updatever}
13 pkgrel=1
14 arch=('x86_64')
15 url='https://openjdk.java.net/'
16 license=('custom')
17 makedepends=(
18   'alsa-lib'
19   'bash'
20   'ccache'
21   'cpio'
22   'fontconfig'
23   'giflib'
24   'git'
25   'java-environment=8'
26   'libcups'
27   'libxrender'
28   'libxtst'
29   'unzip'
30   'zip'
32 options=(!lto)
33 source=(https://github.com/openjdk/jdk${_majorver}u/archive/refs/tags/jdk${_majorver}u${_minorver}-b${_updatever}.tar.gz
34         gcc11.patch)
35 b2sums=('35bef818f7e9f6872356672e1bed50233fc4fa094c1a6eac30395d05cc8addb59b5eb0b985d3702d78939ab0a08195f87b2b2d9a7533058516e9b4477f7ae334'
36         '9679e4dfb6027a87376081489c09810812d6849573afac4ea96abe3a3e00ca5b6af7d0ffb010c43b93cfa913f9e97fbb9f11e19fcc86a89b4548442671c32da1')
38 case "${CARCH}" in
39   'x86_64') _JARCH=amd64 ; _DOC_ARCH=x86_64 ;;
40   'i686'  ) _JARCH=i386  ; _DOC_ARCH=x86    ;;
41 esac
43 _jdkname=openjdk8
44 _jvmdir=/usr/lib/jvm/java-8-openjdk
45 _prefix="jdk8u/image"
46 _imgdir="${_prefix}/jvm/openjdk-1.8.0_$(printf '%.2d' ${_minorver})"
47 _nonheadless=(bin/policytool
48               lib/${_JARCH}/libjsound.so
49               lib/${_JARCH}/libjsoundalsa.so
50               lib/${_JARCH}/libsplashscreen.so)
52 prepare() {
53   cd jdk8u-jdk${_majorver}u${_minorver}-b${_updatever}
55   # Fix build with C++17 (Fedora)
56   patch -Np1 -i "${srcdir}"/gcc11.patch
59 build() {
60   cd jdk8u-jdk${_majorver}u${_minorver}-b${_updatever}
62   unset JAVA_HOME
63   # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1346
64   export MAKEFLAGS=${MAKEFLAGS/-j*}
66   # Avoid optimization of HotSpot being lowered from O3 to O2
67   # -fno-exceptions for FS#73134
68   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="
69   export CXXFLAGS="${CXXFLAGS} -fcommon -fno-exceptions"
71   install -d -m 755 "${srcdir}/${_prefix}/"
72   bash configure \
73     --prefix="${srcdir}/${_prefix}" \
74     --with-update-version="${_minorver}" \
75     --with-build-number="b${_updatever}" \
76     --with-milestone="fcs" \
77     --enable-unlimited-crypto \
78     --with-giflib=system \
79     --with-zlib=system \
80     --with-extra-cflags="${CFLAGS}" \
81     --with-extra-cxxflags="${CXXFLAGS}" \
82     --with-extra-ldflags="${LDFLAGS}"
84   # These help to debug builds: LOG=trace HOTSPOT_BUILD_JOBS=1
85   # Without 'DEBUG_BINARIES', i686 won't build: http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-July/019203.html
86   make
87   make docs
89   # FIXME sadly 'DESTDIR' is not used here!
90   make install
92   cd ../${_imgdir}
94   # A lot of build stuff were directly taken from
95   # http://pkgs.fedoraproject.org/cgit/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec
97   # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
98   find . -iname '*.jar' -exec chmod ugo+r {} \;
99   chmod ugo+r lib/ct.sym
101   # remove redundant *diz and *debuginfo files
102   find . -iname '*.diz' -exec rm {} \;
103   find . -iname '*.debuginfo' -exec rm {} \;
106 check() {
107   cd jdk8u-jdk${_majorver}u${_minorver}-b${_updatever}
108   #make -k test
111 package_jre8-openjdk-headless() {
112   pkgdesc='OpenJDK Java 8 headless runtime environment'
113   depends=('java-runtime-common' 'ca-certificates-utils' 'nss')
114   optdepends=('java-rhino: for some JavaScript support')
115   provides=('java-runtime-headless=8' 'java-runtime-headless-openjdk=8')
116   # Upstream config files that should go to etc and get backup
117   _backup_etc=(etc/java-8-openjdk/${_JARCH}/jvm.cfg
118                etc/java-8-openjdk/calendars.properties
119                etc/java-8-openjdk/content-types.properties
120                etc/java-8-openjdk/flavormap.properties
121                etc/java-8-openjdk/images/cursors/cursors.properties
122                etc/java-8-openjdk/logging.properties
123                etc/java-8-openjdk/management/jmxremote.access
124                etc/java-8-openjdk/management/jmxremote.password
125                etc/java-8-openjdk/management/management.properties
126                etc/java-8-openjdk/management/snmp.acl
127                etc/java-8-openjdk/net.properties
128                etc/java-8-openjdk/psfont.properties.ja
129                etc/java-8-openjdk/psfontj2d.properties
130                etc/java-8-openjdk/security/java.policy
131                etc/java-8-openjdk/security/java.security
132                etc/java-8-openjdk/sound.properties)
133   replaces=('jre8-openjdk-headless-wm')
134   backup=(${_backup_etc[@]})
135   install=install_jre8-openjdk-headless.sh
137   cd ${_imgdir}/jre
139   install -d -m 755 "${pkgdir}${_jvmdir}/jre/"
140   cp -a bin lib "${pkgdir}${_jvmdir}/jre"
142   cp ../release "${pkgdir}${_jvmdir}" # FS#52692
144   # Set config files
145   mv "${pkgdir}${_jvmdir}"/jre/lib/management/jmxremote.password{.template,}
146   mv "${pkgdir}${_jvmdir}"/jre/lib/management/snmp.acl{.template,}
148   # Remove 'non-headless' lib files
149   for f in "${_nonheadless[@]}"; do
150     rm "${pkgdir}${_jvmdir}/jre/${f}"
151   done
153   # Man pages
154   pushd "${pkgdir}${_jvmdir}/jre/bin"
155   install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
156   for file in *; do
157     if [ -f "${srcdir}/${_imgdir}/man/man1/${file}.1" ]; then
158       install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
159         "${pkgdir}/usr/share/man/man1/${file}-${_jdkname}.1"
160     fi
161     if [ -f "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" ]; then
162       install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
163         "${pkgdir}/usr/share/man/ja/man1/${file}-${_jdkname}.1"
164     fi
165   done
166   popd
168   # Link JKS keystore from ca-certificates-utils
169   rm -f "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
170   ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
172   # Install license
173   install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
174   install -m 644 ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README \
175                  "${pkgdir}/usr/share/licenses/${pkgbase}"
176   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
178   # Move config files that were set in _backup_etc from ./lib to /etc
179   for file in "${_backup_etc[@]}"; do
180     _filepkgpath=${_jvmdir}/jre/lib/${file#etc/java-8-openjdk/}
181     install -D -m 644 "${pkgdir}${_filepkgpath}" "${pkgdir}/${file}"
182     ln -sf /${file} "${pkgdir}${_filepkgpath}"
183   done
186 package_jre8-openjdk() {
187   pkgdesc='OpenJDK Java 8 full runtime environment'
188   depends=(
189     "jre8-openjdk-headless=${pkgver}-${pkgrel}"
190     'xdg-utils'
191     'hicolor-icon-theme'
192     'giflib'
193   )
194   optdepends=('icedtea-web: web browser plugin + Java Web Start'
195               'alsa-lib: for basic sound support'
196               'gtk2: for the Gtk+ look and feel - desktop usage'
197               'java8-openjfx: for JavaFX GUI components support')
198   provides=('java-runtime=8' 'java-runtime-openjdk=8')
199   install=install_jre8-openjdk.sh
200   replaces=('jre8-openjdk-wm')
202   cd ${_imgdir}/jre
204   for f in "${_nonheadless[@]}"; do
205     install -D ${f} "${pkgdir}${_jvmdir}/jre/${f}"
206   done
208   # Man pages
209   pushd "${pkgdir}${_jvmdir}/jre/bin"
210   install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
211   for file in *; do
212     install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
213       "${pkgdir}/usr/share/man/man1/${file}-${_jdkname}.1"
214     install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
215       "${pkgdir}/usr/share/man/ja/man1/${file}-${_jdkname}.1"
216   done
217   popd
219   # Install license
220   install -d -m 755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
221   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
224 package_jdk8-openjdk() {
225   pkgdesc='OpenJDK Java 8 development kit'
226   depends=('java-environment-common' "jre8-openjdk=${pkgver}-${pkgrel}")
227   provides=('java-environment=8' 'java-environment-openjdk=8')
228   replaces=('jdk8-openjdk-wm')
229   install=install_jdk8-openjdk.sh
231   cd ${_imgdir}
233   # Main files
234   install -d -m 755 "${pkgdir}${_jvmdir}"
236   cp -a include lib "${pkgdir}${_jvmdir}"
238   # 'bin' files
239   pushd bin
241   # 'java-rmi.cgi' will be handled separately as it should not be in the PATH and has no man page
242   for b in $(ls | grep -v java-rmi.cgi); do
243     if [ -e ../jre/bin/${b} ]; then
244       # Provide a link of the jre binary in the jdk/bin/ directory
245       ln -s ../jre/bin/${b} "${pkgdir}${_jvmdir}/bin/${b}"
246     else
247       # Copy binary to jdk/bin/
248       install -D -m 755 ${b} "${pkgdir}${_jvmdir}/bin/${b}"
249       # Copy man page
250       if [ -f ../man/man1/${b}.1 ]; then
251         install -D -m 644 ../man/man1/${b}.1 "${pkgdir}/usr/share/man/man1/${b}-${_jdkname}.1"
252       fi
253       if [ -f ../man/ja/man1/${b}.1 ]; then
254         install -D -m 644 ../man/ja/man1/${b}.1 "${pkgdir}/usr/share/man/ja/man1/${b}-${_jdkname}.1"
255       fi
256     fi
257   done
258   popd
260   # Handling 'java-rmi.cgi' separately
261   install -D -m 755 bin/java-rmi.cgi "${pkgdir}${_jvmdir}/bin/java-rmi.cgi"
263   # link license
264   install -d -m 755 "${pkgdir}/usr/share/licenses/"
265   ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
268 package_openjdk8-src() {
269   pkgdesc='OpenJDK Java 8 sources'
271   install -D "${srcdir}/${_imgdir}/src.zip" "${pkgdir}${_jvmdir}/src.zip"
274 package_openjdk8-doc() {
275   pkgdesc='OpenJDK Java 8 documentation'
277   install -d -m 755 "${pkgdir}/usr/share/doc/${pkgbase}/"
278   cp -r "${srcdir}"/jdk8u-jdk${_majorver}u${_minorver}-b${_updatever}/build/linux-${_DOC_ARCH}-normal-server-release/docs/* \
279     "${pkgdir}/usr/share/doc/${pkgbase}/"
282 # vim: ts=2 sw=2 et: