summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2220f9ff3caf6ee94309f6157ce7acdeed2555de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Maintainer: Aviana Cruz <gwencroft[at]proton[dot]me>
# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Frederik Schwan <freswa[at]archlinux[dot]org>
# Contributor: Guillaume ALAUX <guillaume[at]archlinux[dot]org>
# Contributor: Boyan Ding <stu_dby[at]126[dot]com>

pkgname=jdk8-dragonwell-extended

_majorver=8
_minorver=16
_updatever=17
_jdk_updatever=382
pkgver=${_majorver}.${_minorver}.${_updatever}
pkgrel=1
arch=('x86_64')
url="https://github.com/alibaba/dragonwell${_majorver}"
license=('GPL2')
makedepends=("java-environment=${_majorver}" 'ccache' 'cpio' 'unzip' 'zip' 'git' 'bash'
  'libxrender' 'libxtst' 'fontconfig' 'libcups' 'alsa-lib')
pkgdesc='An in-house OpenJDK implementation at Alibaba (Extended Edition)'
depends=('java-environment-common' "java-environment-openjdk=${_majorver}")
provides=("java-runtime=${_majorver}" "java-environment=${_majorver}" "java-environment-openjdk=${_majorver}")
conflicts=("${pkgname}-bin")
install="${pkgname}.install"
options=(!lto)
source=("${url}/archive/refs/tags/dragonwell-extended-${pkgver}_jdk${_majorver}u${_jdk_updatever}-ga.tar.gz"
  gcc11.patch)
b2sums=('a0e9968ccde391365aae323a461980aaca9467818de5b63a7ba032ac38486c3f258a99e4c2581384cb02350596d1300694b094ab91d81aeb3f827746045307ce'
  '9679e4dfb6027a87376081489c09810812d6849573afac4ea96abe3a3e00ca5b6af7d0ffb010c43b93cfa913f9e97fbb9f11e19fcc86a89b4548442671c32da1')

_jdkname='openjdk8'
_jvmdir="/usr/lib/jvm/java-${_majorver}-dragonwell-extended"
_prefix='jdk8u/image'
_imgdir="${_prefix}/jvm/openjdk-1.8.0_$(printf '%.2d' ${_minorver})"

prepare() {
  cd dragonwell${_majorver}-dragonwell-extended-${pkgver}_jdk${_majorver}u${_jdk_updatever}-ga

  # Fix build with C++17 (Fedora)
  patch -Np1 -i "${srcdir}"/gcc11.patch
}

build() {
  cd dragonwell${_majorver}-dragonwell-extended-${pkgver}_jdk${_majorver}u${_jdk_updatever}-ga

  unset JAVA_HOME
  # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1346
  export MAKEFLAGS=${MAKEFLAGS/-j*/}

  # Avoid optimization of HotSpot being lowered from O3 to O2
  # -fno-exceptions for FS#73134
  export CFLAGS="${CFLAGS//-O2/-O3} -Wno-error=nonnull -Wno-error=deprecated-declarations -Wno-error=stringop-overflow= -Wno-error=return-type -Wno-error=cpp -fno-delete-null-pointer-checks -fcommon -fno-exceptions -Wno-error=format-overflow="
  export CXXFLAGS="${CXXFLAGS} -fcommon -fno-exceptions"

  install -d -m 755 "${srcdir}/${_prefix}/"
  bash configure \
    --prefix="${srcdir}/${_prefix}" \
    --with-update-version="${_minorver}" \
    --with-build-number="b${_updatever}" \
    --with-milestone="fcs" \
    --enable-unlimited-crypto \
    --with-zlib=system \
    --with-giflib=system \
    --with-extra-cflags="${CFLAGS}" \
    --with-extra-cxxflags="${CXXFLAGS}" \
    --with-extra-ldflags="${LDFLAGS}"

  # These help to debug builds: LOG=trace HOTSPOT_BUILD_JOBS=1
  make
  make docs

  # FIXME sadly 'DESTDIR' is not used here!
  make install

  cd ../${_imgdir}

  # A lot of build stuff were directly taken from
  # http://pkgs.fedoraproject.org/cgit/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec

  # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
  find . -iname '*.jar' -exec chmod ugo+r {} \;
  chmod ugo+r lib/ct.sym

  # remove redundant *diz and *debuginfo files
  find . -iname '*.diz' -exec rm {} \;
  find . -iname '*.debuginfo' -exec rm {} \;
}

package() {
  cd ${_imgdir}

  # Main files
  install -d -m 755 "${pkgdir}${_jvmdir}"

  cp -a include lib jre "${pkgdir}${_jvmdir}"
  rm "${pkgdir}${_jvmdir}"/jre/{ASSEMBLY_EXCEPTION,LICENSE,THIRD_PARTY_README}

  # 'bin' files
  pushd bin

  # 'java-rmi.cgi' will be handled separately as it should not be in the PATH and has no man page
  for b in $(ls | grep -v java-rmi.cgi); do
    if [ -e ../jre/bin/${b} ]; then
      # Provide a link of the jre binary in the jdk/bin/ directory
      ln -s ../jre/bin/${b} "${pkgdir}${_jvmdir}/bin/${b}"
    else
      # Copy binary to jdk/bin/
      install -D -m 755 ${b} "${pkgdir}${_jvmdir}/bin/${b}"
      # Copy man page
      if [ -f ../man/man1/${b}.1 ]; then
        install -D -m 644 ../man/man1/${b}.1 "${pkgdir}/usr/share/man/man1/${b}-${_jdkname}.1"
      fi
      if [ -f ../man/ja/man1/${b}.1 ]; then
        install -D -m 644 ../man/ja/man1/${b}.1 "${pkgdir}/usr/share/man/ja/man1/${b}-${_jdkname}.1"
      fi
    fi
  done
  popd

  # Handling 'java-rmi.cgi' separately
  install -D -m 755 bin/java-rmi.cgi "${pkgdir}${_jvmdir}/bin/java-rmi.cgi"

  # link license
  install -d -m 755 "${pkgdir}/usr/share/licenses/"
  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
}