PKGBUILD 11 KB

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