openjdk.mk 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ################################################################################
  2. #
  3. # openjdk
  4. #
  5. ################################################################################
  6. OPENJDK_VERSION_MAJOR = 14
  7. OPENJDK_VERSION_MINOR = 36
  8. OPENJDK_VERSION = $(OPENJDK_VERSION_MAJOR)+$(OPENJDK_VERSION_MINOR)
  9. OPENJDK_SOURCE = jdk-$(OPENJDK_VERSION).tar.gz
  10. OPENJDK_SITE = https://hg.openjdk.java.net/jdk-updates/jdk14u/archive
  11. OPENJDK_LICENSE = GPL-2.0+ with exception
  12. OPENJDK_LICENSE_FILES = LICENSE
  13. # OpenJDK requires Alsa, cups, and X11 even for a headless build.
  14. # host-zip is needed for the zip executable.
  15. OPENJDK_DEPENDENCIES = \
  16. host-gawk \
  17. host-openjdk-bin \
  18. host-pkgconf \
  19. host-zip \
  20. host-zlib \
  21. alsa-lib \
  22. cups \
  23. fontconfig \
  24. giflib \
  25. jpeg \
  26. lcms2 \
  27. libpng \
  28. libusb \
  29. xlib_libXrandr \
  30. xlib_libXrender \
  31. xlib_libXt \
  32. xlib_libXtst \
  33. zlib
  34. # JVM variants
  35. ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT),y)
  36. OPENJDK_JVM_VARIANT = client
  37. endif
  38. ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER),y)
  39. OPENJDK_JVM_VARIANT = server
  40. endif
  41. ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO),y)
  42. OPENJDK_JVM_VARIANT = zero
  43. OPENJDK_DEPENDENCIES += libffi
  44. endif
  45. # OpenJDK installs a file named 'modules' in jre/lib, which gets installed as
  46. # /usr/lib/modules. However, with a merged /usr, this conflicts with the
  47. # directory named 'modules' installed by the kernel. If OpenJDK gets built
  48. # after the kernel, this manifests itself with: "cp: cannot overwrite
  49. # directory '/usr/lib/modules with non-directory."
  50. OPENJDK_INSTALL_BASE = /usr/lib/jvm
  51. # OpenJDK ignores some variables unless passed via the environment.
  52. # These variables are PATH, LD, CC, CXX, and CPP.
  53. # OpenJDK defaults ld to the ld binary but passes -Xlinker and -z as
  54. # arguments during the linking process, which causes compilation failures.
  55. # To fix this issue, LD is set to point to gcc.
  56. OPENJDK_CONF_ENV = \
  57. PATH=$(BR_PATH) \
  58. CC=$(TARGET_CC) \
  59. CPP=$(TARGET_CPP) \
  60. CXX=$(TARGET_CXX) \
  61. LD=$(TARGET_CC) \
  62. BUILD_SYSROOT_CFLAGS="$(HOST_CFLAGS)" \
  63. BUILD_SYSROOT_LDFLAGS="$(HOST_LDFLAGS)"
  64. OPENJDK_CONF_OPTS = \
  65. --disable-full-docs \
  66. --disable-hotspot-gtest \
  67. --disable-manpages \
  68. --disable-warnings-as-errors \
  69. --enable-headless-only \
  70. --enable-openjdk-only \
  71. --enable-unlimited-crypto \
  72. --openjdk-target=$(GNU_TARGET_NAME) \
  73. --with-boot-jdk=$(HOST_DIR) \
  74. --with-stdc++lib=dynamic \
  75. --with-debug-level=release \
  76. --with-devkit=$(HOST_DIR) \
  77. --with-extra-cflags="$(TARGET_CFLAGS)" \
  78. --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
  79. --with-extra-ldflags="-Wl,-rpath,$(OPENJDK_INSTALL_BASE)/lib,-rpath,$(OPENJDK_INSTALL_BASE)/lib/$(OPENJDK_JVM_VARIANT)" \
  80. --with-giflib=system \
  81. --with-jobs=$(PARALLEL_JOBS) \
  82. --with-jvm-variants=$(OPENJDK_JVM_VARIANT) \
  83. --with-lcms=system \
  84. --with-libjpeg=system \
  85. --with-libpng=system \
  86. --with-zlib=system \
  87. --with-native-debug-symbols=none \
  88. --without-version-pre \
  89. --with-sysroot=$(STAGING_DIR) \
  90. --with-version-build="$(OPENJDK_VERSION_MAJOR)" \
  91. --with-version-string="$(OPENJDK_VERSION_MAJOR)"
  92. # If building for AArch64, use the provided CPU port.
  93. ifeq ($(BR2_aarch64),y)
  94. OPENJDK_CONF_OPTS += --with-abi-profile=aarch64
  95. endif
  96. ifeq ($(BR2_CCACHE),y)
  97. OPENJDK_CONF_OPTS += \
  98. --enable-ccache \
  99. --with-ccache-dir=$(BR2_CCACHE_DIR)
  100. endif
  101. # Autogen and configure are performed in a single step.
  102. define OPENJDK_CONFIGURE_CMDS
  103. chmod +x $(@D)/configure
  104. cd $(@D); $(OPENJDK_CONF_ENV) ./configure autogen $(OPENJDK_CONF_OPTS)
  105. endef
  106. # Make -jn is unsupported. Instead, set the "--with-jobs=" configure option,
  107. # and use $(MAKE1).
  108. define OPENJDK_BUILD_CMDS
  109. $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) legacy-jre-image
  110. endef
  111. # Calling make install always builds and installs the JDK instead of the JRE,
  112. # which makes manual installation necessary.
  113. define OPENJDK_INSTALL_TARGET_CMDS
  114. mkdir -p $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)
  115. cp -dpfr $(@D)/build/linux-*-release/images/jre/bin/ \
  116. $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/
  117. cp -dpfr $(@D)/build/linux-*-release/images/jre/lib/ \
  118. $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/
  119. cd $(TARGET_DIR)/usr/bin && ln -snf ../..$(OPENJDK_INSTALL_BASE)/bin/* .
  120. endef
  121. $(eval $(generic-package))