openjdk.mk 3.5 KB

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