Skip to contentSkip to conversation

OpenJDK: new package.

PATCH Superseded aduskett at gmail.com 2 participants 5 messages Jan 28, 2019

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v2 cover OpenJDK: new package.

From: Adam Duskett <[email protected]>

V2: Fixed the second patch name. Copy and paste is sometimes my enemy!

This patch series introduces BuildRoot to OpenJDK.

A previous patch series for OpenJDK8 used the JDK Muricle page to download a tarball. Instead, what I have chosen to do is use the AdoptOpenJDK GitHub repository. This repository allows us to use the GitHub macro instead of trying to provide a nasty workaround when grabbing the source code.

With this patch series, there are some quirks that I would like to detail:

- The openjdk-bin package:
From http://hg.openjdk.java.net/jdk10/jdk10/raw-file/tip/common/doc/building.html#boot-jdk-requirements
"Paradoxically, building OpenJDK requires a pre-existing JDK. This is called
the "boot JDK." The boot JDK does not have to be OpenJDK, though. If you are
porting OpenJDK to a new platform, the chances are that there already exists
another JDK for that platform that is usable as boot JDK.

The rule of thumb is that the boot JDK for building JDK major version N should be a JDK of major version N-1, so for building JDK 9, a JDK 8 would be suitable as boot JDK."

This paradox causes an issue because every distribution I have used comes with JDK8 by default. So there are two solutions that I could come up with:
1) Require the host-system to have JDK N-1
2) Grab the convenient and easy to install binaries from the AdoptOpenJDK repository, and use those binaries as the boot-jdk.

- JDK >= 10 requires X11, even if building a headless version. It's unfortunate, but there isn't anything I cared to do about it.

- Running "make install" installs the entire JDK to the target directory, which is why INSTALL_TARGET is manual.

- Depending on !BR2_SOFT_FLOAT
From http://hg.openjdk.java.net/jdk10/jdk10/raw-file/tip/common/doc/building.html#building-for-armaarch64
"Note that soft-float ABIs are no longer properly supported on OpenJDK."
Yes, it will compile as of right now, but I don't want to have to help people with possible ASM java bugs because they wanted to use a processor without an FPU.

- Requiring GLIBC
OpenJDK could probably build against uClibc with a few patches, but I decided against going through the effort of doing so. My reasoning is that uClibc advertises itself as a small C library, however, at this time, OpenJDK comes in at over 100MB for a minimal install. So the few megabytes saved by using uClibc probably isn't going to be a concern for anybody wanting to use Java on their embedded environment.

- Other thoughts:
It is possible to use fine-grained make targets when building OpenJDK, check out
http://hg.openjdk.java.net/jdk10/jdk10/raw-file/tip/common/doc/building.html#using-fine-grained-make-targets.
Perhaps in the future, BuildRoot could have Java setup just like PHP or Python, with a large selection of modules to build? This could potentially save a massive amount of space.

Comments and critiques are always welcome!

Adam

Adam Duskett (2):
openjdk-bin: new package
OpenJDK is a free and open-source implementation of the Java Platform.
This package provides the option to build a client or a server JVM interpreter.

 DEVELOPERS                           |   2 +
 package/Config.in                    |   1 +
 package/Config.in.host               |   1 +
 package/openjdk-bin/Config.in.host   |  12 +++
 package/openjdk-bin/openjdk-bin.hash |   6 ++
 package/openjdk-bin/openjdk-bin.mk   |  22 +++++
 package/openjdk/Config.in            |  54 ++++++++++
 package/openjdk/openjdk.hash         |   3 +
 package/openjdk/openjdk.mk           | 141 +++++++++++++++++++++++++++
 9 files changed, 242 insertions(+)
 create mode 100644 package/openjdk-bin/Config.in.host
 create mode 100644 package/openjdk-bin/openjdk-bin.hash
 create mode 100644 package/openjdk-bin/openjdk-bin.mk
 create mode 100644 package/openjdk/Config.in
 create mode 100644 package/openjdk/openjdk.hash
 create mode 100644 package/openjdk/openjdk.mk
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/2 openjdk-bin: new package

From: Adam Duskett <[email protected]>

Paradoxically, building OpenJDK requires a pre-existing JDK. This pre-existing JDK is called the "boot JDK."

The boot JDK for building JDK major version N should be a JDK of major version N-1, so for building JDK11, JDK10 would be needed. This requirement is an issue when building on most distributions, as the host JDK tends to be JDK8.

The AdoptOpenJDK project provides binaries that can act as the boot JDK to build the target JDK, which is what this package provides.

---
Changes v1 -> v2:
- None

 DEVELOPERS                           |  1 +
 package/Config.in.host               |  1 +
 package/openjdk-bin/Config.in.host   | 12 ++++++++++++
 package/openjdk-bin/openjdk-bin.hash |  6 ++++++
 package/openjdk-bin/openjdk-bin.mk   | 22 ++++++++++++++++++++++
 5 files changed, 42 insertions(+)
 create mode 100644 package/openjdk-bin/Config.in.host
 create mode 100644 package/openjdk-bin/openjdk-bin.hash
 create mode 100644 package/openjdk-bin/openjdk-bin.mk
DEVELOPERS +1 -0
index c1950bb0f4..28ba480d85 100644
@@ -50,6 +50,7 @@ F:	package/libselinux/
 F:	package/libsemanage/
 F:	package/libsepol/
 F:	package/nginx-naxsi/
+F:	package/openjdk-bin/
 F:	package/policycoreutils/
 F:	package/python-flask-sqlalchemy/
 F:	package/python-mutagen/
package/Config.in.host +1 -0
index 16b474fc9d..0499589c4f 100644
@@ -39,6 +39,7 @@ menu "Host utilities"
 	source "package/mtools/Config.in.host"
 	source "package/mxsldr/Config.in.host"
 	source "package/omap-u-boot-utils/Config.in.host"
+	source "package/openjdk-bin/Config.in.host"
 	source "package/openocd/Config.in.host"
 	source "package/opkg-utils/Config.in.host"
 	source "package/parted/Config.in.host"
package/openjdk-bin/Config.in.host new file +12 -0
new file mode 100644
index 0000000000..e3dd438a0f
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
+	bool
+	default y if BR2_HOSTARCH = "x86_64"
+
+config BR2_PACKAGE_HOST_OPENJDK_BIN
+	bool "host openjdk-bin"
+	depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
+	help
+	  Pre-packaged OpenJDK binaries used to compile the target
+	  OpenJDK.
+
+	  https://adoptopenjdk.net/
package/openjdk-bin/openjdk-bin.hash new file +6 -0
new file mode 100644
index 0000000000..35d0b5c44b
@@ -0,0 +1,6 @@
+# From https://github.com/AdoptOpenJDK/openjdk11-binaries/releases
+sha256	d89304a971e5186e80b6a48a9415e49583b7a5a9315ba5552d373be7782fc528	OpenJDK11U-jdk_x64_linux_hotspot_11.0.2_7.tar.gz
+
+# Locally calculated
+sha256	4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726	legal/java.prefs/LICENSE
+sha256	a44eb7b5caf5534c6ef536b21edb40b4d6babf91bf97d9d45596868618b2c6fb	legal/java.prefs/ASSEMBLY_EXCEPTION
package/openjdk-bin/openjdk-bin.mk new file +22 -0
new file mode 100644
index 0000000000..cfad5d78d5
@@ -0,0 +1,22 @@
+################################################################################
+#
+# host-openjdk-bin
+#
+################################################################################
+
+HOST_OPENJDK_BIN_VERSION_MAJOR = 11.0.2
+HOST_OPENJDK_BIN_VERSION_MINOR = 7
+HOST_OPENJDK_BIN_VERSION = $(HOST_OPENJDK_BIN_VERSION_MAJOR)_$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_SOURCE = OpenJDK11U-jdk_x64_linux_hotspot_$(HOST_OPENJDK_BIN_VERSION).tar.gz
+HOST_OPENJDK_BIN_SITE = https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-$(HOST_OPENJDK_BIN_VERSION_MAJOR)%2B$(HOST_OPENJDK_BIN_VERSION_MINOR)
+HOST_OPENJDK_BIN_LICENSE = GPLv2+ with exception
+HOST_OPENJDK_BIN_LICENSE_FILES = legal/java.prefs/LICENSE legal/java.prefs/ASSEMBLY_EXCEPTION
+
+# The java binary expects the JDK to be installed in /usr/jvm/openjdk.
+HOST_OPENJDK_BIN_INSTALL_DIR=$(HOST_DIR)/usr/jvm/openjdk-$(HOST_OPENJDK_BIN_VERSION_MAJOR)
+define HOST_OPENJDK_BIN_INSTALL_CMDS
+	mkdir -p $(HOST_DIR)/usr/jvm/openjdk-$(HOST_OPENJDK_BIN_VERSION_MAJOR)
+	cp -aLrf $(@D)/* $(HOST_OPENJDK_BIN_INSTALL_DIR)
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/2 openjdk: new package

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

OpenJDK is a free and open-source implementation of the Java Platform. This package provides the option to build a client or a server JVM interpreter.

The default option is the server option, as that is what the majority of users use. This JVM interpreter loads more slowly, putting more effort into JIT compilations to yield higher performance.

---
Changes v1 -> v2:
- Fixed the patch name.

 DEVELOPERS                   |   1 +
 package/Config.in            |   1 +
 package/openjdk/Config.in    |  54 ++++++++++++++
 package/openjdk/openjdk.hash |   3 +
 package/openjdk/openjdk.mk   | 141 +++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 package/openjdk/Config.in
 create mode 100644 package/openjdk/openjdk.hash
 create mode 100644 package/openjdk/openjdk.mk
DEVELOPERS +1 -0
index 28ba480d85..0893af58dc 100644
@@ -50,6 +50,7 @@ F:	package/libselinux/
 F:	package/libsemanage/
 F:	package/libsepol/
 F:	package/nginx-naxsi/
+F:	package/openjdk/
 F:	package/openjdk-bin/
 F:	package/policycoreutils/
 F:	package/python-flask-sqlalchemy/
package/Config.in +1 -0
index 5036421a73..e150e32563 100644
@@ -671,6 +671,7 @@ menu "Mono libraries/modules"
 endmenu
 endif
 	source "package/nodejs/Config.in"
+	source "package/openjdk/Config.in"
 	source "package/perl/Config.in"
 if BR2_PACKAGE_PERL
 menu "Perl libraries/modules"
package/openjdk/Config.in new file +54 -0

54 lines not on this page · raw message

package/openjdk/openjdk.hash new file +3 -0
new file mode 100644
index 0000000000..dc201863a7
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 9bb8c44e42fbfcee8402f6d0722fbe2209647b7959544d924a6790bc053e8f20  openjdk-jdk-11.0.2+7.tar.gz
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726  LICENSE
package/openjdk/openjdk.mk new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.20.1
#3 lore raw

PATCH v2 2/2 openjdk: new package

El lun., 28 ene. 2019 a las 17:36, <[email protected]> escribi?:

Quoted 240 lines

From: Adam Duskett <[email protected]>

OpenJDK is a free and open-source implementation of the Java Platform. This package provides the option to build a client or a server JVM interpreter.

The default option is the server option, as that is what the majority of users use. This JVM interpreter loads more slowly, putting more effort into JIT compilations to yield higher performance.

---
Changes v1 -> v2:
- Fixed the patch name.

 DEVELOPERS                   |   1 +
 package/Config.in            |   1 +
 package/openjdk/Config.in    |  54 ++++++++++++++
 package/openjdk/openjdk.hash |   3 +
 package/openjdk/openjdk.mk   | 141 +++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 package/openjdk/Config.in
 create mode 100644 package/openjdk/openjdk.hash
 create mode 100644 package/openjdk/openjdk.mk
DEVELOPERS +1 -0
index 28ba480d85..0893af58dc 100644
@@ -50,6 +50,7 @@ F:    package/libselinux/
 F:     package/libsemanage/
 F:     package/libsepol/
 F:     package/nginx-naxsi/
+F:     package/openjdk/
 F:     package/openjdk-bin/
 F:     package/policycoreutils/
 F:     package/python-flask-sqlalchemy/
package/Config.in +1 -0
index 5036421a73..e150e32563 100644
@@ -671,6 +671,7 @@ menu "Mono libraries/modules"
 endmenu
 endif
        source "package/nodejs/Config.in"
+       source "package/openjdk/Config.in"
        source "package/perl/Config.in"
 if BR2_PACKAGE_PERL
 menu "Perl libraries/modules"
package/openjdk/Config.in new file +54 -0
new file mode 100644
index 0000000000..287e1077e7
@@ -0,0 +1,54 @@
+config BR2_PACKAGE_OPENJDK
+       bool "OpenJDK"
+       depends on !BR2_SOFT_FLOAT
+       depends on !BR2_STATIC_LIBS
+       depends on BR2_INSTALL_LIBSTDCPP # gtk2, cups
+       depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
+       depends on BR2_PACKAGE_XORG7
+       depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4 # gtk2 -> pango -> harfbuzz
+       depends on BR2_TOOLCHAIN_HAS_THREADS # gtk2 -> glib2
+       depends on BR2_TOOLCHAIN_USES_GLIBC
+       depends on BR2_USE_MMU # gtk2 -> glib2
+       depends on BR2_USE_WCHAR # gtk2 -> glib2
+       select BR2_PACKAGE_ALSA_LIB
+       select BR2_PACKAGE_CUPS
+       select BR2_PACKAGE_FONTCONFIG
+       select BR2_PACKAGE_HOST_OPENJDK_BIN
+       select BR2_PACKAGE_LIBUSB
+       select BR2_PACKAGE_XLIB_LIBXRENDER
+       select BR2_PACKAGE_XLIB_LIBXT
+       select BR2_PACKAGE_XLIB_LIBXTST
+       help
+         OpenJDK is a free and open-source implementation of the
+         Java Platform.
+
+         http://openjdk.java.net/
+
+if BR2_PACKAGE_OPENJDK
+
+menu "JVM Variants"
+
+config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
+       bool "client"
+       help
+         Quick loading, but slower run-time performance.
+
+config BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER
+       bool "server"
+       default y
+         Slower loading, but faster run-time performance.
+
+endmenu
+endif
+
+comment "OpenJDK needs a glibc toolchain w/ wchar, dynamic library, threads, C++, gcc >= 4.9"
+       depends on BR2_USE_MMU
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4
+       depends on BR2_PACKAGE_XORG7
+       depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS || !BR2_INSTALL_LIBSTDCPP || \
+               !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_HAS_THREADS || \
+               !BR2_TOOLCHAIN_USES_GLIBC
+
+comment "OpenJDK does not support soft floats"
+       depends on BR2_SOFT_FLOAT
package/openjdk/openjdk.hash new file +3 -0
new file mode 100644
index 0000000000..dc201863a7
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 9bb8c44e42fbfcee8402f6d0722fbe2209647b7959544d924a6790bc053e8f20  openjdk-jdk-11.0.2+7.tar.gz
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726  LICENSE
package/openjdk/openjdk.mk new file +116 -0
new file mode 100644
index 0000000000..8717320693
@@ -0,0 +1,141 @@
+################################################################################
+#
+# openjdk
+#
+################################################################################
+
+OPENJDK_VERSION_MAJOR = 11.0.2
+OPENJDK_VERSION_MINOR = 7
+OPENJDK_VERSION=jdk-$(OPENJDK_VERSION_MAJOR)+$(OPENJDK_VERSION_MINOR)
+OPENJDK_RELEASE = jdk11u
+OPENJDK_SITE = $(call github,AdoptOpenJDK,openjdk-jdk11u,$(OPENJDK_VERSION))
+OPENJDK_LICENSE = GPLv2+ with exception
+OPENJDK_LICENSE_FILES = LICENSE
+
+OPENJDK_DEPENDENCIES = \
+       host-openjdk-bin \
+       host-pkgconf \
+       alsa-lib \
+       cups \
+       fontconfig \
+       libusb \
+       xlib_libXrender \
+       xlib_libXt \
+       xlib_libXtst
+
+# JVM variants
+ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT),y)
+OPENJDK_JVM_VARIANTS += client
+endif
+
+ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER),y)
+OPENJDK_JVM_VARIANTS += server
+endif
+OPENJDK_JVM_VARIANT_LIST = $(subst $(space),$(comma),$(OPENJDK_JVM_VARIANTS))
+
+# Some environment variables will be ignored unless passed via environment
+# variables.
+# OpenJDK will default to ld, but will pass -Xlinker and -z as arguments,
+# which will cause compilation failures. Instead, tell OpenJDK to use gcc.
+# Furthermore, if ccache is enabled, BuildRoot will set CC,CXX, and CPP to
+# the ccache binary, which will cause OpenJDK to throw an error during the
+# configure step, so we must set these variables explicitly to the actual
+# binaries.
+OPENJDK_CONF_ENV = \
+       PATH=$(BR_PATH) \
+       LD=$(TARGET_CC) \
+       CC=$(TARGET_CC) \
+       CXX=$(TARGET_CXX) \
+       CPP=$(TARGET_CPP)
+
+OPENJDK_CONF_OPTS = \
+       --disable-full-docs \
+       --disable-hotspot-gtest \
+       --disable-manpages \
+       --disable-warnings-as-errors \
+       --enable-headless-only \
+       --enable-openjdk-only \
+       --enable-unlimited-crypto \
+       --openjdk-target=$(GNU_TARGET_NAME) \
+       --prefix=$(TARGET_DIR)/usr \
+       --with-boot-jdk=$(HOST_OPENJDK_BIN_INSTALL_DIR) \
+       --with-debug-level=release \
+       --with-devkit=$(HOST_DIR) \
+       --with-extra-cflags="$(TARGET_CFLAGS)" \
+       --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
+       --with-extra-path=$(HOST_DIR)/bin:$(HOST_DIR)/sbin \
+       --with-giflib=bundled \
+       --with-jobs=$(PARALLEL_JOBS) \
+       --with-jvm-variants=$(OPENJDK_JVM_VARIANT_LIST) \
+       --with-libjpeg=bundled \
+       --with-libpng=bundled \
+       --with-native-debug-symbols=none \
+       --without-version-pre \
+       --with-sysroot=$(STAGING_DIR) \
+       --with-vendor-name="AdoptOpenJDK" \
+       --with-vendor-url="https://adoptopenjdk.net/" \
+       --with-vendor-version-string="AdoptOpenJDK" \
+       --with-version-build="$(OPENJDK_VERSION_MAJOR)" \
+       --with-version-string="$(OPENJDK_VERSION_MAJOR)" \
+       --with-zlib=bundled \
+       OBJCOPY=$(TARGET_OBJCOPY) \
+       OBJDUMP=$(TARGET_OBJDUMP) \
+       NM=$(TARGET_NM) \
+       STRIP=$(TARGET_STRIP) \
+       AR=$(TARGET_AR)
+
+ifeq ($(BR2_aarch64),y)
+OPENJDK_CONF_OPTS += --with-cpu-port=aarch64 --with-abi-profile=aarch64
+endif
+
+ifeq ($(BR2_CCACHE),y)
+OPENJDK_CONF_OPTS += \
+       --enable-ccache \
+       --with-ccache-dir=$(BR2_CCACHE_DIR)
+endif
+
+ifeq ($(BR2_PACKAGE_JPEG),y)
+OPENJDK_DEPENDENCIES += jpeg
+OPENJDK_CONF_OPTS += --with-libjpeg=system
+endif
+
+ifeq ($(BR2_PACKAGE_GIFLIB),y)
+OPENJDK_DEPENDENCIES += giflib
+OPENJDK_CONF_OPTS += --with-giflib=system
+endif
+
+ifeq ($(BR2_PACKAGE_LIBPNG),y)
+OPENJDK_DEPENDENCIES += libpng
+OPENJDK_CONF_OPTS += --with-libpng=system
+endif
+
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+OPENJDK_DEPENDENCIES += libzlib
+OPENJDK_CONF_OPTS += --with-zlib=system
+endif
+

package/openjdk/openjdk.mk line 126

Quoted 10 lines
package/openjdk/openjdk.mk new file +10 -0
+# Autogen and configure are done in a single step.
+define OPENJDK_CONFIGURE_CMDS
+       chmod +x $(@D)/configure
+       cd $(@D); $(OPENJDK_CONF_ENV) ./configure autogen $(OPENJDK_CONF_OPTS)
+endef
+
+# Build just the JRE image for the target.
+define OPENJDK_BUILD_CMDS
+       $(MAKE1) -C $(@D) legacy-jre-image
+endef

In the openjdk package I sent last year, I did this:

+ $(OPENJDK_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) JOBS=$(PARALLEL_JOBS) -C $(@D) $(OPENJDK_MAKE_OPTS) images

I have following questions:

- what is the difference between 'images' and 'legacy-jre-image'.
- did you consider passing 'JOBS' to enable parallel compilation?

Best regards,
Thomas

#4 lore raw

PATCH v2 2/2 openjdk: new package

Hi Thomas!

Quoted 255 lines · Thomas De Schampheleire

El lun., 28 ene. 2019 a las 17:36, <[email protected]> escribi?:

Quoted 240 lines

From: Adam Duskett <[email protected]>

OpenJDK is a free and open-source implementation of the Java Platform. This package provides the option to build a client or a server JVM interpreter.

The default option is the server option, as that is what the majority of users use. This JVM interpreter loads more slowly, putting more effort into JIT compilations to yield higher performance.

---
Changes v1 -> v2:
- Fixed the patch name.

 DEVELOPERS                   |   1 +
 package/Config.in            |   1 +
 package/openjdk/Config.in    |  54 ++++++++++++++
 package/openjdk/openjdk.hash |   3 +
 package/openjdk/openjdk.mk   | 141 +++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 package/openjdk/Config.in
 create mode 100644 package/openjdk/openjdk.hash
 create mode 100644 package/openjdk/openjdk.mk
DEVELOPERS +1 -0
index 28ba480d85..0893af58dc 100644
@@ -50,6 +50,7 @@ F:    package/libselinux/
 F:     package/libsemanage/
 F:     package/libsepol/
 F:     package/nginx-naxsi/
+F:     package/openjdk/
 F:     package/openjdk-bin/
 F:     package/policycoreutils/
 F:     package/python-flask-sqlalchemy/
package/Config.in +1 -0
index 5036421a73..e150e32563 100644
@@ -671,6 +671,7 @@ menu "Mono libraries/modules"
 endmenu
 endif
        source "package/nodejs/Config.in"
+       source "package/openjdk/Config.in"
        source "package/perl/Config.in"
 if BR2_PACKAGE_PERL
 menu "Perl libraries/modules"
package/openjdk/Config.in new file +54 -0
new file mode 100644
index 0000000000..287e1077e7
@@ -0,0 +1,54 @@
+config BR2_PACKAGE_OPENJDK
+       bool "OpenJDK"
+       depends on !BR2_SOFT_FLOAT
+       depends on !BR2_STATIC_LIBS
+       depends on BR2_INSTALL_LIBSTDCPP # gtk2, cups
+       depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
+       depends on BR2_PACKAGE_XORG7
+       depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4 # gtk2 -> pango -> harfbuzz
+       depends on BR2_TOOLCHAIN_HAS_THREADS # gtk2 -> glib2
+       depends on BR2_TOOLCHAIN_USES_GLIBC
+       depends on BR2_USE_MMU # gtk2 -> glib2
+       depends on BR2_USE_WCHAR # gtk2 -> glib2
+       select BR2_PACKAGE_ALSA_LIB
+       select BR2_PACKAGE_CUPS
+       select BR2_PACKAGE_FONTCONFIG
+       select BR2_PACKAGE_HOST_OPENJDK_BIN
+       select BR2_PACKAGE_LIBUSB
+       select BR2_PACKAGE_XLIB_LIBXRENDER
+       select BR2_PACKAGE_XLIB_LIBXT
+       select BR2_PACKAGE_XLIB_LIBXTST
+       help
+         OpenJDK is a free and open-source implementation of the
+         Java Platform.
+
+         http://openjdk.java.net/
+
+if BR2_PACKAGE_OPENJDK
+
+menu "JVM Variants"
+
+config BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT
+       bool "client"
+       help
+         Quick loading, but slower run-time performance.
+
+config BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER
+       bool "server"
+       default y
+         Slower loading, but faster run-time performance.
+
+endmenu
+endif
+
+comment "OpenJDK needs a glibc toolchain w/ wchar, dynamic library, threads, C++, gcc >= 4.9"
+       depends on BR2_USE_MMU
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4
+       depends on BR2_PACKAGE_XORG7
+       depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS || !BR2_INSTALL_LIBSTDCPP || \
+               !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_HAS_THREADS || \
+               !BR2_TOOLCHAIN_USES_GLIBC
+
+comment "OpenJDK does not support soft floats"
+       depends on BR2_SOFT_FLOAT
package/openjdk/openjdk.hash new file +3 -0
new file mode 100644
index 0000000000..dc201863a7
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 9bb8c44e42fbfcee8402f6d0722fbe2209647b7959544d924a6790bc053e8f20  openjdk-jdk-11.0.2+7.tar.gz
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726  LICENSE
package/openjdk/openjdk.mk new file +116 -0
new file mode 100644
index 0000000000..8717320693
@@ -0,0 +1,141 @@
+################################################################################
+#
+# openjdk
+#
+################################################################################
+
+OPENJDK_VERSION_MAJOR = 11.0.2
+OPENJDK_VERSION_MINOR = 7
+OPENJDK_VERSION=jdk-$(OPENJDK_VERSION_MAJOR)+$(OPENJDK_VERSION_MINOR)
+OPENJDK_RELEASE = jdk11u
+OPENJDK_SITE = $(call github,AdoptOpenJDK,openjdk-jdk11u,$(OPENJDK_VERSION))
+OPENJDK_LICENSE = GPLv2+ with exception
+OPENJDK_LICENSE_FILES = LICENSE
+
+OPENJDK_DEPENDENCIES = \
+       host-openjdk-bin \
+       host-pkgconf \
+       alsa-lib \
+       cups \
+       fontconfig \
+       libusb \
+       xlib_libXrender \
+       xlib_libXt \
+       xlib_libXtst
+
+# JVM variants
+ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT),y)
+OPENJDK_JVM_VARIANTS += client
+endif
+
+ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER),y)
+OPENJDK_JVM_VARIANTS += server
+endif
+OPENJDK_JVM_VARIANT_LIST = $(subst $(space),$(comma),$(OPENJDK_JVM_VARIANTS))
+
+# Some environment variables will be ignored unless passed via environment
+# variables.
+# OpenJDK will default to ld, but will pass -Xlinker and -z as arguments,
+# which will cause compilation failures. Instead, tell OpenJDK to use gcc.
+# Furthermore, if ccache is enabled, BuildRoot will set CC,CXX, and CPP to
+# the ccache binary, which will cause OpenJDK to throw an error during the
+# configure step, so we must set these variables explicitly to the actual
+# binaries.
+OPENJDK_CONF_ENV = \
+       PATH=$(BR_PATH) \
+       LD=$(TARGET_CC) \
+       CC=$(TARGET_CC) \
+       CXX=$(TARGET_CXX) \
+       CPP=$(TARGET_CPP)
+
+OPENJDK_CONF_OPTS = \
+       --disable-full-docs \
+       --disable-hotspot-gtest \
+       --disable-manpages \
+       --disable-warnings-as-errors \
+       --enable-headless-only \
+       --enable-openjdk-only \
+       --enable-unlimited-crypto \
+       --openjdk-target=$(GNU_TARGET_NAME) \
+       --prefix=$(TARGET_DIR)/usr \
+       --with-boot-jdk=$(HOST_OPENJDK_BIN_INSTALL_DIR) \
+       --with-debug-level=release \
+       --with-devkit=$(HOST_DIR) \
+       --with-extra-cflags="$(TARGET_CFLAGS)" \
+       --with-extra-cxxflags="$(TARGET_CXXFLAGS)" \
+       --with-extra-path=$(HOST_DIR)/bin:$(HOST_DIR)/sbin \
+       --with-giflib=bundled \
+       --with-jobs=$(PARALLEL_JOBS) \
+       --with-jvm-variants=$(OPENJDK_JVM_VARIANT_LIST) \
+       --with-libjpeg=bundled \
+       --with-libpng=bundled \
+       --with-native-debug-symbols=none \
+       --without-version-pre \
+       --with-sysroot=$(STAGING_DIR) \
+       --with-vendor-name="AdoptOpenJDK" \
+       --with-vendor-url="https://adoptopenjdk.net/" \
+       --with-vendor-version-string="AdoptOpenJDK" \
+       --with-version-build="$(OPENJDK_VERSION_MAJOR)" \
+       --with-version-string="$(OPENJDK_VERSION_MAJOR)" \
+       --with-zlib=bundled \
+       OBJCOPY=$(TARGET_OBJCOPY) \
+       OBJDUMP=$(TARGET_OBJDUMP) \
+       NM=$(TARGET_NM) \
+       STRIP=$(TARGET_STRIP) \
+       AR=$(TARGET_AR)
+
+ifeq ($(BR2_aarch64),y)
+OPENJDK_CONF_OPTS += --with-cpu-port=aarch64 --with-abi-profile=aarch64
+endif
+
+ifeq ($(BR2_CCACHE),y)
+OPENJDK_CONF_OPTS += \
+       --enable-ccache \
+       --with-ccache-dir=$(BR2_CCACHE_DIR)
+endif
+
+ifeq ($(BR2_PACKAGE_JPEG),y)
+OPENJDK_DEPENDENCIES += jpeg
+OPENJDK_CONF_OPTS += --with-libjpeg=system
+endif
+
+ifeq ($(BR2_PACKAGE_GIFLIB),y)
+OPENJDK_DEPENDENCIES += giflib
+OPENJDK_CONF_OPTS += --with-giflib=system
+endif
+
+ifeq ($(BR2_PACKAGE_LIBPNG),y)
+OPENJDK_DEPENDENCIES += libpng
+OPENJDK_CONF_OPTS += --with-libpng=system
+endif
+
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+OPENJDK_DEPENDENCIES += libzlib
+OPENJDK_CONF_OPTS += --with-zlib=system
+endif
+

package/openjdk/openjdk.mk line 126

Quoted 10 lines
package/openjdk/openjdk.mk new file +10 -0
+# Autogen and configure are done in a single step.
+define OPENJDK_CONFIGURE_CMDS
+       chmod +x $(@D)/configure
+       cd $(@D); $(OPENJDK_CONF_ENV) ./configure autogen $(OPENJDK_CONF_OPTS)
+endef
+
+# Build just the JRE image for the target.
+define OPENJDK_BUILD_CMDS
+       $(MAKE1) -C $(@D) legacy-jre-image
+endef

In the openjdk package I sent last year, I did this:

Quoted 6 lines

+ $(OPENJDK_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) JOBS=$(PARALLEL_JOBS) -C $(@D) $(OPENJDK_MAKE_OPTS) images

I have following questions:

- what is the difference between 'images' and 'legacy-jre-image'.

images will build the entire jdk, legacy-jre-image will build just the jre.

Quoted 1 line

- did you consider passing 'JOBS' to enable parallel compilation?

--with-jobs=$(PARALLEL_JOBS) during the configure step does the same thing.

Quoted 4 lines

Best regards,
Thomas

Thanks!

Adam