openjdk.mk 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 ignores some variables unless passed via the environment.
  46. # These variables are PATH, LD, CC, CXX, and CPP.
  47. # OpenJDK defaults ld to the ld binary but passes -Xlinker and -z as
  48. # arguments during the linking process, which causes compilation failures.
  49. # To fix this issue, LD is set to point to gcc.
  50. OPENJDK_CONF_ENV = \
  51. PATH=$(BR_PATH) \
  52. CC=$(TARGET_CC) \
  53. CPP=$(TARGET_CPP) \
  54. CXX=$(TARGET_CXX) \
  55. LD=$(TARGET_CC) \
  56. BUILD_SYSROOT_CFLAGS="$(HOST_CFLAGS)" \
  57. BUILD_SYSROOT_LDFLAGS="$(HOST_LDFLAGS)"
  58. OPENJDK_CONF_OPTS = \
  59. --disable-full-docs \
  60. --disable-hotspot-gtest \
  61. --disable-manpages \
  62. --disable-warnings-as-errors \
  63. --enable-headless-only \
  64. --enable-openjdk-only \
  65. --enable-unlimited-crypto \
  66. --openjdk-target=$(GNU_TARGET_NAME) \
  67. --with-boot-jdk=$(HOST_DIR) \
  68. --with-stdc++lib=dynamic \
  69. --with-debug-level=release \
  70. --with-devkit=$(HOST_DIR) \
  71. --with-extra-cflags="$(TARGET_CFLAGS)" \
  72. --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
  73. --with-giflib=system \
  74. --with-jobs=$(PARALLEL_JOBS) \
  75. --with-jvm-variants=$(OPENJDK_JVM_VARIANT) \
  76. --with-lcms=system \
  77. --with-libjpeg=system \
  78. --with-libpng=system \
  79. --with-zlib=system \
  80. --with-native-debug-symbols=none \
  81. --without-version-pre \
  82. --with-sysroot=$(STAGING_DIR) \
  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-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. $(TARGET_MAKE_ENV) $(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))