actions.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. import subprocess
  7. from pisi.actionsapi import shelltools, pisitools, autotools
  8. from pisi.actionsapi import get
  9. from pisi.util import join_path
  10. _, _, _, update = get.srcVERSION().split('.')
  11. #jobs = "-j"+ subprocess.check_output("nproc 2>/dev/null", shell=True).rstrip("\n")
  12. jobs = subprocess.check_output("nproc 2>/dev/null", shell=True).rstrip("\n")
  13. jvm_dir = '/usr/lib/jvm/java-openjdk'
  14. img_dir = 'build/linux-%s-server-release/images' % get.ARCH()
  15. cflags = get.CFLAGS()
  16. cxxflags = get.CXXFLAGS()
  17. ldflags = get.LDFLAGS()
  18. pisitools.cflags.reset()
  19. pisitools.cxxflags.reset()
  20. pisitools.ldflags.reset()
  21. def setup():
  22. shelltools.system(
  23. 'bash configure \
  24. --with-version-build="%s" \
  25. --with-version-pre="" \
  26. --with-version-opt="" \
  27. --with-stdc++lib=dynamic \
  28. --with-extra-cflags="%s -fcommon" \
  29. --with-extra-cxxflags="%s -fcommon" \
  30. --with-extra-ldflags="%s" \
  31. --with-libjpeg=system \
  32. --with-giflib=system \
  33. --with-libpng=system \
  34. --with-lcms=system \
  35. --with-zlib=system \
  36. --with-jvm-features=zgc \
  37. --with-boot-jdk="%s" \
  38. --enable-unlimited-crypto \
  39. --disable-warnings-as-errors \
  40. --with-num-cores="%s"' % (update, cflags, cxxflags, ldflags, jvm_dir, jobs)
  41. )
  42. def build():
  43. shelltools.system("make JOBS=%s images legacy-jre-image docs" % jobs)
  44. shelltools.system("find '%s' -iname '*.so' -exec chmod +x {} \\;" % img_dir)
  45. # def check():
  46. # shelltools.system("make JOBS=%s -k check" % jobs)
  47. def install():
  48. # Binaries
  49. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/bin'))
  50. # Libraries
  51. # pisitools.insinto(jvm_dir, join_path(img_dir, 'jre/lib'))
  52. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/lib'))
  53. # Headers
  54. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/include'))
  55. # Others
  56. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/release'))
  57. pisitools.insinto(join_path(jvm_dir, 'lib'), join_path(img_dir, 'jdk/lib/modules'))
  58. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/demo'))
  59. pisitools.insinto(jvm_dir, join_path(img_dir, 'jdk/jmods'))
  60. # Configurations
  61. pisitools.insinto('/etc/java-openjdk', join_path(img_dir, 'jre/conf/*'))
  62. pisitools.dosym('/etc/java-openjdk', join_path(jvm_dir, 'conf'))
  63. # Man pages
  64. pisitools.doman(join_path(img_dir, 'jdk/man/man1/*'))
  65. # Change man page file names to prevent conflict with other Java packages.
  66. for man_file in shelltools.ls(join_path(get.installDIR(), 'usr/share/man/man1')):
  67. pisitools.domove(
  68. '/usr/share/man/man1/%s' % man_file,
  69. '/usr/share/man/man1',
  70. '%s-openjdk21.0' % man_file.replace('.1', '')
  71. )
  72. # Documentations
  73. pisitools.insinto(join_path('/', get.docDIR(), 'java-openjdk'), join_path(img_dir, 'docs/*'))
  74. # Licenses
  75. pisitools.insinto('/usr/share/licenses/java-openjdk', join_path(img_dir, 'jre/legal/*'))
  76. pisitools.dosym('/usr/share/licenses/java-openjdk', join_path(jvm_dir, 'legal'))
  77. pisitools.remove("%s/lib/security/cacerts" % jvm_dir)
  78. pisitools.dosym("/etc/ssl/certs/java/cacerts", "%s/lib/security/cacerts" % jvm_dir)
  79. shelltools.system("rm -rf %s/%s/bin/*.debuginfo" %(get.installDIR(), jvm_dir))
  80. # Icons
  81. for size in [16, 24, 32, 48]:
  82. pisitools.insinto(
  83. "/usr/share/icons/hicolor/{size}x{size}/apps/".format(size=size),
  84. "src/java.desktop/unix/classes/sun/awt/X11/java-icon%s.png" % size,
  85. "java-openjdk.png"
  86. )