PKGBUILD 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. # Maintainer: Noah Vogt (noahvogt) <noah@noahvogt.com>
  2. # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
  3. # Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
  4. # TODO add test, see about packaging jtreg and using it here
  5. pkgbase=java-openjdk-xdg
  6. pkgname=('jre-openjdk-headless-xdg' 'jre-openjdk-xdg' 'jdk-openjdk-xdg' 'openjdk-src-xdg' 'openjdk-doc-xdg')
  7. _majorver=17
  8. _minorver=0
  9. _securityver=1
  10. _updatever=12
  11. pkgrel=2
  12. pkgver=${_majorver}.${_minorver}.${_securityver}.u${_updatever}
  13. #pkgver=${_majorver}.u${_updatever}
  14. _git_tag=jdk-${_majorver}.${_minorver}.${_securityver}+${_updatever}
  15. #_git_tag=jdk-${_majorver}+${_updatever}
  16. arch=('x86_64')
  17. url='https://openjdk.java.net/'
  18. license=('custom')
  19. makedepends=('java-environment>=11' 'cpio' 'unzip' 'zip' 'libelf' 'libcups' 'libx11'
  20. 'libxrender' 'libxtst' 'libxt' 'libxext' 'libxrandr' 'alsa-lib' 'pandoc'
  21. 'graphviz' 'freetype2' 'libjpeg-turbo' 'giflib' 'libpng' 'lcms2'
  22. 'libnet' 'bash' 'harfbuzz' 'gcc-libs' 'glibc')
  23. source=(https://github.com/openjdk/jdk${_majorver}u/archive/${_git_tag}.tar.gz
  24. freedesktop-java.desktop
  25. freedesktop-jconsole.desktop
  26. freedesktop-jshell.desktop
  27. xdg-basedir-compliant-fontconfig.patch
  28. xdg-basedir-compliant-userPrefs.patch)
  29. sha256sums=('8c076203a6f85ab916b3e54de1992bcbcc5ffe580c52b1ac8d52ca7afb9f02d1'
  30. '85c4742764590783160af74587a47269e6797fbdf17ec485c7644bd239adf61d'
  31. 'abac1ab09a33a3654378bc69be5a7cf075263ab3ae9efec1eb25cf388e711bb7'
  32. 'e7cce0ecf868f656d8dc2eb25ab82ab665526a0a28aba20f02632dd29962dac3'
  33. '25860396475759236e0edf66711b842143b0ddee47eed61e080da158bbc58ce9'
  34. '48f9e40c4ae8eb79d17fb676893a89b95ac43616827725a9d10de2b1f357642c')
  35. provides=('jre-openjdk-headless' 'jre-openjdk' 'jdk-openjdk' 'openjdk-src' 'openjdk-doc')
  36. conflicts=('jre-openjdk-headless' 'jre-openjdk' 'jdk-openjdk' 'openjdk-src' 'openjdk-doc')
  37. case "${CARCH}" in
  38. x86_64) _JARCH='x86_64';;
  39. i686) _JARCH='x86';;
  40. esac
  41. _jvmdir=/usr/lib/jvm/java-${_majorver}-openjdk
  42. _jdkdir=jdk${_majorver}u-${_git_tag//+/-}
  43. _imgdir=${_jdkdir}/build/linux-${_JARCH}-server-release/images
  44. _nonheadless=(lib/libawt_xawt.{so,debuginfo}
  45. lib/libjawt.{so,debuginfo}
  46. lib/libjsound.{so,debuginfo}
  47. lib/libsplashscreen.{so,debuginfo})
  48. prepare() {
  49. cd ${_jdkdir}
  50. patch -p1 -i ../xdg-basedir-compliant-fontconfig.patch
  51. patch -p1 -i ../xdg-basedir-compliant-userPrefs.patch
  52. }
  53. build() {
  54. cd ${_jdkdir}
  55. # export old flags to avoid zlist fail with hotspot agent (used in artix)
  56. export CPPFLAGS="-D_FORTIFY_SOURCE=2"
  57. export CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
  58. export CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
  59. NUM_PROC_OPT=''
  60. MAKEFLAG_J=$(echo ${MAKEFLAGS} | sed -En 's/.*-j([0-9]+).*/\1/p')
  61. if [ -n "${MAKEFLAG_J}" ]; then
  62. # http://hg.openjdk.java.net/jdk10/jdk10/file/85e6cb013b98/make/InitSupport.gmk#l105
  63. echo "Removing '-j${MAKEFLAG_J}' from MAKEFLAGS to prevent build fail. Passing it directly to ./configure."
  64. export MAKEFLAGS=${MAKEFLAGS/-j${MAKEFLAG_J}/}
  65. NUM_PROC_OPT="--with-num-cores=${MAKEFLAG_J}"
  66. fi
  67. # Avoid optimization of HotSpot to be 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
  76. # CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
  77. # in the output of ./configure unless used like such:
  78. # --with-extra-cflags="${CFLAGS}"
  79. # --with-extra-cxxflags="${CXXFLAGS}"
  80. # --with-extra-ldflags="${LDFLAGS}"
  81. # See also paragraph "Configure Control Variables from "jdk${_majorver}-${_git_tag}/common/doc/building.md
  82. unset CFLAGS
  83. unset CXXFLAGS
  84. unset LDFLAGS
  85. bash configure \
  86. --with-version-build="${_updatever}" \
  87. --with-version-pre="" \
  88. --with-version-opt="" \
  89. --with-stdc++lib=dynamic \
  90. --with-extra-cflags="${_CFLAGS}" \
  91. --with-extra-cxxflags="${_CXXFLAGS}" \
  92. --with-extra-ldflags="${_LDFLAGS}" \
  93. --with-libjpeg=system \
  94. --with-giflib=system \
  95. --with-libpng=system \
  96. --with-lcms=system \
  97. --with-zlib=system \
  98. --with-harfbuzz=system \
  99. --with-jvm-features=zgc \
  100. --enable-unlimited-crypto \
  101. --disable-warnings-as-errors \
  102. ${NUM_PROC_OPT}
  103. #--disable-javac-server
  104. make images legacy-jre-image docs
  105. # https://bugs.openjdk.java.net/browse/JDK-8173610
  106. find "../${_imgdir}" -iname '*.so' -exec chmod +x {} \;
  107. }
  108. check() {
  109. cd ${_jdkdir}
  110. # TODO package jtreg
  111. # make -k check
  112. }
  113. package_jre-openjdk-headless-xdg() {
  114. pkgdesc="OpenJDK Java ${_majorver} headless runtime environment - with improved Support for the XDG Base Directory Specification"
  115. depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
  116. 'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
  117. 'glibc' 'gcc-libs')
  118. optdepends=('java-rhino: for some JavaScript support')
  119. provides=("java-runtime-headless=${_majorver}" "java-runtime-headless-openjdk=${_majorver}" "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}")
  120. backup=(etc/${pkgbase}/logging.properties
  121. etc/${pkgbase}/management/jmxremote.access
  122. etc/${pkgbase}/management/jmxremote.password.template
  123. etc/${pkgbase}/management/management.properties
  124. etc/${pkgbase}/net.properties
  125. etc/${pkgbase}/security/java.policy
  126. etc/${pkgbase}/security/java.security
  127. etc/${pkgbase}/security/policy/README.txt
  128. etc/${pkgbase}/security/policy/limited/default_US_export.policy
  129. etc/${pkgbase}/security/policy/limited/default_local.policy
  130. etc/${pkgbase}/security/policy/limited/exempt_local.policy
  131. etc/${pkgbase}/security/policy/unlimited/default_US_export.policy
  132. etc/${pkgbase}/security/policy/unlimited/default_local.policy
  133. etc/${pkgbase}/sound.properties)
  134. install=install_jre-openjdk-headless.sh
  135. cd ${_imgdir}/jre
  136. install -dm 755 "${pkgdir}${_jvmdir}"
  137. cp -a bin lib \
  138. "${pkgdir}${_jvmdir}"
  139. for f in "${_nonheadless[@]}"; do
  140. rm "${pkgdir}${_jvmdir}/${f}"
  141. done
  142. cp ../jdk/release "${pkgdir}${_jvmdir}"
  143. cp ../jdk/lib/modules "${pkgdir}${_jvmdir}/lib"
  144. # Conf
  145. install -dm 755 "${pkgdir}/etc"
  146. cp -r conf "${pkgdir}/etc/${pkgbase}"
  147. ln -s /etc/${pkgbase} "${pkgdir}/${_jvmdir}/conf"
  148. # Legal
  149. install -dm 755 "${pkgdir}/usr/share/licenses"
  150. cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
  151. ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
  152. ln -s /usr/share/licenses/${pkgbase} "${pkgdir}/${_jvmdir}/legal"
  153. # Man pages
  154. for f in bin/*; do
  155. f=$(basename "${f}")
  156. _man=../jdk/man/man1/"${f}.1"
  157. test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
  158. done
  159. ln -s /usr/share/man "${pkgdir}/${_jvmdir}/man"
  160. # Link JKS keystore from ca-certificates-utils
  161. rm -f "${pkgdir}${_jvmdir}/lib/security/cacerts"
  162. ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/lib/security/cacerts"
  163. }
  164. package_jre-openjdk-xdg() {
  165. pkgdesc="OpenJDK Java ${_majorver} full runtime environment - with improved Support for the XDG Base Directory Specification"
  166. depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
  167. 'glibc' 'gcc-libs' 'libpng')
  168. optdepends=('alsa-lib: for basic sound support'
  169. 'gtk2: for the Gtk+ 2 look and feel - desktop usage'
  170. 'gtk3: for the Gtk+ 3 look and feel - desktop usage')
  171. provides=("java-runtime=${_majorver}" "java-runtime-openjdk=${_majorver}" "jre${_majorver}-openjdk=${pkgver}-${pkgrel}")
  172. install=install_jre-openjdk.sh
  173. cd ${_imgdir}/jre
  174. install -dm 755 "${pkgdir}${_jvmdir}"
  175. for f in "${_nonheadless[@]}"; do
  176. install -Dm 644 ${f} "${pkgdir}${_jvmdir}/${f}"
  177. done
  178. # Licenses
  179. install -dm 755 "${pkgdir}/usr/share/licenses"
  180. ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
  181. }
  182. package_jdk-openjdk-xdg() {
  183. pkgdesc="OpenJDK Java ${_majorver} development kit - with improved Support for the XDG Base Directory Specification"
  184. depends=("jre${_majorver}-openjdk=${pkgver}-${pkgrel}" 'java-environment-common=3'
  185. 'hicolor-icon-theme' 'libelf' 'glibc' 'gcc-libs')
  186. provides=("java-environment=${_majorver}" "java-environment-openjdk=${_majorver}" "jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
  187. install=install_jdk-openjdk.sh
  188. cd ${_imgdir}/jdk
  189. install -dm 755 "${pkgdir}${_jvmdir}"
  190. cp -a bin demo include jmods lib \
  191. "${pkgdir}${_jvmdir}"
  192. rm "${pkgdir}${_jvmdir}/lib/src.zip"
  193. # Remove files held by JRE
  194. pushd ../jre
  195. for d in bin lib; do
  196. find ${d} ! -type d -exec rm "${pkgdir}${_jvmdir}/{}" \;
  197. done
  198. popd
  199. find "${pkgdir}${_jvmdir}/lib" -type d -empty -delete
  200. # Conf files all belong to JRE
  201. # Legal
  202. install -dm 755 "${pkgdir}/usr/share/licenses"
  203. cp -r legal "${pkgdir}/usr/share/licenses/${pkgbase}"
  204. pushd ../jre/legal
  205. find . ! -type d -exec rm "${pkgdir}/usr/share/licenses/${pkgbase}/{}" \;
  206. popd
  207. find "${pkgdir}/usr/share/licenses" -type d -empty -delete
  208. ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
  209. # Man pages
  210. for f in bin/*; do
  211. f=$(basename "${f}")
  212. _man=man/man1/"${f}.1"
  213. test -f "../jre/bin/${f}" && continue
  214. test -f "${_man}" && install -Dm 644 "${_man}" "${pkgdir}/usr/share/man/man1/${f}-openjdk${_majorver}.1"
  215. done
  216. # Icons
  217. for s in 16 24 32 48; do
  218. install -Dm 644 \
  219. "${srcdir}/${_jdkdir}/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png" \
  220. "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/${pkgbase}.png"
  221. done
  222. # Desktop files
  223. for f in jconsole java jshell; do
  224. install -Dm 644 \
  225. "${srcdir}/freedesktop-${f}.desktop" \
  226. "${pkgdir}/usr/share/applications/${f}-${pkgbase}.desktop"
  227. done
  228. }
  229. package_openjdk-src-xdg() {
  230. pkgdesc="OpenJDK Java ${_majorver} sources - with improved Support for the XDG Base Directory Specification"
  231. # Depends on JDK to get license files
  232. depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
  233. provides=("openjdk${_majorver}-src=${pkgver}-${pkgrel}")
  234. install -Dm 644 -t "${pkgdir}${_jvmdir}/lib" ${_imgdir}/jdk/lib/src.zip
  235. install -dm 755 "${pkgdir}/usr/share/licenses"
  236. ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
  237. }
  238. package_openjdk-doc-xdg() {
  239. pkgdesc="OpenJDK Java ${_majorver} documentation - with improved Support for the XDG Base Directory Specification"
  240. # Depends on JDK to get license files
  241. depends=("jdk${_majorver}-openjdk=${pkgver}-${pkgrel}")
  242. provides=("openjdk${_majorver}-doc=${pkgver}-${pkgrel}")
  243. install -dm 755 "${pkgdir}/usr/share/doc"
  244. cp -r ${_imgdir}/docs "${pkgdir}/usr/share/doc/${pkgbase}"
  245. install -dm 755 "${pkgdir}/usr/share/licenses"
  246. ln -s ${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
  247. }
  248. # vim: ts=2 sw=2 et: