openjdk.mk 3.5 KB

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