OpenJDK: new package and tests
v4 cover OpenJDK: new package and tests
From: Adam Duskett <[email protected]>
This patch series adds OpenJDK and an updated testing framework to BuildRoot.
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.
- The OpenJDK package:
- 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 compiles 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 fine-grained build could potentially save a massive amount of space.
Perhaps in the future, a patch set that removes the X11/Alsa/cups dependencies can be added.
In addition to the OpenJDK patches, Matt Webber, Daniel Leach and Ricardo Martincoski extended the testing framework to allow for a more flexible and comprehensive testing environment. The first of which is to test OpenJDK by running a simple "Hello world" application.
Comments and critiques are always welcome!
Adam
Daniel J. Leach (1):
support/testing: openjdk hello world
Adam Duskett (5):
openjdk-bin: new package
openjdk: new package
Adam Duskett (3):
openjdk-bin: new package
openjdk: new package
openjdk-hello-world: new test
.gitlab-ci.yml | 1 + DEVELOPERS | 3 + package/Config.in | 1 + package/openjdk-bin/openjdk-bin.hash | 6 + package/openjdk-bin/openjdk-bin.mk | 23 +++ package/openjdk/Config.in | 58 ++++++++ package/openjdk/openjdk.hash | 3 + package/openjdk/openjdk.mk | 135 ++++++++++++++++++ .../package/br2-external/openjdk/Config.in | 1 + .../br2-external/openjdk/external.desc | 1 + .../package/br2-external/openjdk/external.mk | 1 + .../package/openjdk-hello-world/Config.in | 26 ++++ .../openjdk-hello-world/HelloWorld.java | 8 ++ .../openjdk-hello-world.mk | 18 +++ support/testing/tests/package/test_openjdk.py | 42 ++++++ 15 files changed, 327 insertions(+) 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 create mode 100644 support/testing/tests/package/br2-external/openjdk/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/external.desc create mode 100644 support/testing/tests/package/br2-external/openjdk/external.mk create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk create mode 100644 support/testing/tests/package/test_openjdk.py
Signature · 1 line
2.20.1
PATCH v4 1/3 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.
Currently, only a x86_64 host is supported, for two reasons:
1) A 32bit x86 binary distribution is not available from AdoptOpenJDK
2) Access to a machine that is not x86_64 that can build Buildroot is not avaliable.
OpenJDK-bin installs to $(HOST_DIR)/openjdk/ because the RPATH of the provided java binaries do not have a proper RPATH, which causes a build failure.
---
Changes v1 -> v2:
- No change
Changes v2 -> v3:
- Changed the location of the installed binaries to just $(HOST_DIR)/openjdk
- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.
Changes v3 -> v4:
- Removed first person wordage. (Thomas)
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Removed Config.in.host (Thomas)
DEVELOPERS | 2 ++ package/openjdk-bin/openjdk-bin.hash | 6 ++++++ package/openjdk-bin/openjdk-bin.mk | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 package/openjdk-bin/openjdk-bin.hash create mode 100644 package/openjdk-bin/openjdk-bin.mk
DEVELOPERS +2 -0
@@ -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/
@@ -1468,6 +1469,7 @@ F: package/valijson/ F: package/wpa_supplicant/ F: package/wireless_tools/ F: package/xen/ +F: support/testing/tests/package/br2-external/openjdk/ N: Mauro Condarelli <[email protected]> F: package/mc/
package/openjdk-bin/openjdk-bin.hash new file +6 -0
@@ -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 +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# 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 = GPL-2.0+ with exception +HOST_OPENJDK_BIN_LICENSE_FILES = legal/java.prefs/LICENSE legal/java.prefs/ASSEMBLY_EXCEPTION + +# If the files are installed to $(HOST_DIR)/bin and $(HOST_DIR)/lib +# the build will fail because the RPATH of java binaries do not have a proper +# RPATH +define HOST_OPENJDK_BIN_INSTALL_CMDS + mkdir -p $(HOST_DIR)/openjdk + cp -aLrf $(@D)/* $(HOST_DIR)/openjdk/ +endef + +$(eval $(host-generic-package))
Signature · 1 line
2.20.1
PATCH v4 1/3 openjdk-bin: new package
Adam,
Quoted 13 lines · On Mon, Feb 4, 2019 at 2:56 AM <[email protected]> wrote:
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.
Quoted 8 lines
Currently, only a
x86_64host is supported, for two reasons:
1) A 32bit x86 binary distribution is not available from AdoptOpenJDK
2) Access to a machine that is notx86_64that can build Buildroot is not avaliable.OpenJDK-bin installs to $(HOST_DIR)/openjdk/ because the RPATH of the provided java binaries do not have a proper RPATH, which causes a build failure.
That isn't cool.....
Quoted 37 lines
Signed-off-by Adam Duskett <[email protected]>---
Changes v1 -> v2:
- No changeChanges v2 -> v3:
- Changed the location of the installed binaries to just $(HOST_DIR)/openjdk- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.
Changes v3 -> v4:
- Removed first person wordage. (Thomas)
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Removed Config.in.host (Thomas)DEVELOPERS | 2 ++ package/openjdk-bin/openjdk-bin.hash | 6 ++++++ package/openjdk-bin/openjdk-bin.mk | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 package/openjdk-bin/openjdk-bin.hash create mode 100644 package/openjdk-bin/openjdk-bin.mkDEVELOPERS +1
-0@@ -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/
DEVELOPERS F: package/valijson/ · line 1472
Quoted 4 lines
DEVELOPERS +1
-0@@ -1468,6 +1469,7 @@ F: package/valijson/ F: package/wpa_supplicant/ F: package/wireless_tools/ F: package/xen/ +F: support/testing/tests/package/br2-external/openjdk/
If this should be included at all, suggest adding it to your 3rd patch with the test case. Generally, I'm unsure of how we're handling specific runtime test DEVELOPER entries. I know Ricardo has the whole support/testing/ folder but that's all I see in the file at the moment.
Quoted 28 lines
DEVELOPERS +0
-0N: Mauro Condarelli <[email protected]> F: package/mc/package/openjdk-bin/openjdk-bin.hash new file +6
-0@@ -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_EXCEPTIONpackage/openjdk-bin/openjdk-bin.mk new file +7
-0@@ -0,0 +1,23 @@ +################################################################################ +# +# host-openjdk-bin +# +################################################################################ + +HOST_OPENJDK_BIN_VERSION_MAJOR = 11.0.2
package/openjdk-bin/openjdk-bin.mk line 17
Quoted 10 lines
package/openjdk-bin/openjdk-bin.mk new file +10
-0+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 = GPL-2.0+ with exception +HOST_OPENJDK_BIN_LICENSE_FILES = legal/java.prefs/LICENSE legal/java.prefs/ASSEMBLY_EXCEPTION + +# If the files are installed to $(HOST_DIR)/bin and $(HOST_DIR)/lib +# the build will fail because the RPATH of java binaries do not have a proper +# RPATH
Could we fix it?
Quoted 9 lines
package/openjdk-bin/openjdk-bin.mk new file +6
-1+define HOST_OPENJDK_BIN_INSTALL_CMDS + mkdir -p $(HOST_DIR)/openjdk + cp -aLrf $(@D)/* $(HOST_DIR)/openjdk/ +endef + +$(eval $(host-generic-package)) --2.20.1
Thanks for sending this,
Matt
PATCH v4 2/3 openjdk: new package
In reply to aduskett at gmail.comFrom: 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.
Unlike most autotools packages, OpenJDK is exceptionally different and has many quirks, some of which are documented below:
- X11, alsa, and cups are required to build Java, even if it's a headless build.
- There is no autogen.sh file, instead, a user calls ./configure autogen.
- If ccache is enabled, BuildRoot sets CC, CXX, and CPP to
the ccache binary, which causes OpenJDK to throw an error during the configure step, so LD, CC, CXX, and CPP must set explicitly to the actual binaries.
- Some variables are ignored unless set as a configure option. These variables are OBJCOPY, OBJDUMP, NM, STRIP, and AR.
- Other variables must be environment variables, these are PATH, LD, CC, CXX, and CPP.
- Parallel make is possible, but not with make -jN, instead, one has to pass the --with-jobs=$(PARALLEL_JOBS) to configure, or pass JOBS=$(PARALLEL_JOBS) to make. The formner wass chosen as it seems cleaner.
---
Changes v1 -> v2:
- Fixed the patch name.
Changes v2 -> v3:
- Changed the install location of the libraries and binaries to
$(TARGET_DIR)/bin and $(TARGET_DIR)/lib.
- Changed -with-boot-jdk location to $(HOST_DIR)/openjdk
- Added a more in-depth commit message explaining some of the my reasoning for some of the quirks in the package files.
Changes v3 -> v4:
- Changed GPLv2+ -> GPL-2.0+ (Thomas)
- Added BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS to Config.in
- Removed first person wordage. (Thomas)
DEVELOPERS | 1 + package/Config.in | 1 + package/openjdk/Config.in | 58 +++++++++++++++ package/openjdk/openjdk.hash | 3 + package/openjdk/openjdk.mk | 135 +++++++++++++++++++++++++++++++++++ 5 files changed, 198 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
@@ -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
@@ -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 +58 -0
58 lines not on this page · raw message
package/openjdk/openjdk.hash new file +3 -0
@@ -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 +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v4 2/3 openjdk: new package
Adam,
Quoted 3 lines · On Mon, Feb 4, 2019 at 2:56 AM <[email protected]> wrote:
From: Adam Duskett <[email protected]>
[snip]
Quoted 44 lines
package/openjdk/openjdk.mk new file +44
-0+ +# 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_DIR)/openjdk \ + --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)" \
package/openjdk/openjdk.mk line 88
Quoted 10 lines
package/openjdk/openjdk.mk new file +10
-0+ --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
Are there default profiles and cpu supported? Could be good to note in a comment above these explicit enables.
package/openjdk/openjdk.mk line 99
Quoted 11 lines
package/openjdk/openjdk.mk new file +11
-0+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
For this _CONF_OPTS and those below, suggest adding the else condition and moving your defaults (--with-libjpeg=bundled) from above down here.
Quoted 16 lines
package/openjdk/openjdk.mk new file +16
-0+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 125
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
It would be good to add a comment of why MAKE1
package/openjdk/openjdk.mk
Quoted 11 lines
package/openjdk/openjdk.mk new file +10
-1+endef + +# Calling make install will build and install the JDK instad of the JRE, +# which makes manual installation necessary. +define OPENJDK_INSTALL_TARGET_CMDS + cp -rf $(@D)/build/linux-*-release/images/jre/bin/* $(TARGET_DIR)/usr/bin/ + cp -rf $(@D)/build/linux-*-release/images/jre/lib/* $(TARGET_DIR)/usr/lib/ +endef + +$(eval $(generic-package)) --
Thanks for sending this out!
Matt
PATCH v4 3/3 openjdk-hello-world: new test
In reply to aduskett at gmail.comFrom: Daniel J. Leach <[email protected]>
This test is a simple "Hello, World" integration test of the OpenJDK package.
It compiles the Java app on the host, then runs it on an emulated AARCH64 target and verifies "Hello, World" is printed.
---
Changes v1 -> v3:
- Added this patch to the series.
Changes v3 -> v4:
- None
.gitlab-ci.yml | 1 + .../package/br2-external/openjdk/Config.in | 1 + .../br2-external/openjdk/external.desc | 1 + .../package/br2-external/openjdk/external.mk | 1 + .../package/openjdk-hello-world/Config.in | 26 ++++++++++++ .../openjdk-hello-world/HelloWorld.java | 8 ++++ .../openjdk-hello-world.mk | 18 ++++++++ support/testing/tests/package/test_openjdk.py | 42 +++++++++++++++++++ 8 files changed, 98 insertions(+) create mode 100644 support/testing/tests/package/br2-external/openjdk/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/external.desc create mode 100644 support/testing/tests/package/br2-external/openjdk/external.mk create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk create mode 100644 support/testing/tests/package/test_openjdk.py
.gitlab-ci.yml +1 -0
@@ -323,6 +323,7 @@ tests.package.test_ipython.TestIPythonPy2: *runtime_test tests.package.test_ipython.TestIPythonPy3: *runtime_test tests.package.test_lua.TestLua: *runtime_test tests.package.test_lua.TestLuajit: *runtime_test +tests.package.test_openjdk.TestOpenJdk: *runtime_test tests.package.test_perl.TestPerl: *runtime_test tests.package.test_perl_class_load.TestPerlClassLoad: *runtime_test tests.package.test_perl_dbd_mysql.TestPerlDBDmysql: *runtime_test
support/testing/tests/package/br2-external/openjdk/Config.in new file +1 -0
@@ -0,0 +1 @@ +source "$BR2_EXTERNAL_OPENJDK_PATH/package/openjdk-hello-world/Config.in"
support/testing/tests/package/br2-external/openjdk/external.desc new file +1 -0
@@ -0,0 +1 @@ +name: OPENJDK
support/testing/tests/package/br2-external/openjdk/external.mk new file +1 -0
@@ -0,0 +1 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_OPENJDK_PATH)/package/*/*.mk))
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in new file +26 -0
@@ -0,0 +1,26 @@ +config BR2_PACKAGE_OPENJDK_HELLO_WORLD + bool "openjdk hello world" + depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_PACKAGE_XORG7 + depends on BR2_USE_WCHAR # gtk2 -> glib2 + depends on BR2_TOOLCHAIN_HAS_THREADS # gtk2 -> glib2 + depends on BR2_USE_MMU # gtk2 -> glib2 + depends on BR2_INSTALL_LIBSTDCPP # gtk2, cups + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11 + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # gtk2 -> pango -> harfbuzz + depends on !BR2_STATIC_LIBS + select BR2_PACKAGE_OPENJDK + help + Simple class for testing openjdk + +comment "OpenJDK-hello-world 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
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java new file +8 -0
@@ -0,0 +1,8 @@ +public class HelloWorld +{ + public static void main(String[] args) + { + System.out.println("Hello, World"); + } + +}
support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk new file +18 -0
@@ -0,0 +1,18 @@ +################################################################################ +# +# openjdk hello world +# +################################################################################ + +OPENJDK_HELLO_WORLD_DEPENDENCIES = openjdk + +define OPENJDK_HELLO_WORLD_BUILD_CMDS + $(INSTALL) -D $(OPENJDK_HELLO_WORLD_PKGDIR)/HelloWorld.java $(@D)/HelloWorld.java + $(HOST_DIR)/openjdk/bin/javac $(@D)/HelloWorld.java +endef + +define OPENJDK_HELLO_WORLD_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 755 $(@D)/HelloWorld.class $(TARGET_DIR)/usr/bin/HelloWorld.class +endef + +$(eval $(generic-package))
support/testing/tests/package/test_openjdk.py new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.20.1
v4 cover OpenJDK: new package and tests
In reply to aduskett at gmail.comRomain,
Quoted 59 lines · On Mon, Feb 4, 2019 at 2:56 AM <[email protected]> wrote:
From: Adam Duskett <[email protected]>
This patch series adds OpenJDK and an updated testing framework to BuildRoot.
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_TARGETis manual.- The OpenJDK package:
- 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 compiles 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 fine-grained build could potentially save a massive amount of space.
Quoted 8 lines
Perhaps in the future, a patch set that removes the X11/Alsa/cups dependencies can be added.
In addition to the OpenJDK patches, Matt Webber, Daniel Leach and Ricardo Martincoski extended the testing framework to allow for a more flexible and comprehensive testing environment. The first of which is to test OpenJDK by running a simple "Hello world" application.
Romain, thought I'd mention we are working on a follow-on series which uses Valentin's LLVM work to do Just In Time(JIT) for openJDK!
Quoted 53 lines
Comments and critiques are always welcome!
Adam
Daniel J. Leach (1):
support/testing: openjdk hello worldAdam Duskett (5):
openjdk-bin: new package
openjdk: new packageAdam Duskett (3):
openjdk-bin: new package
openjdk: new package
openjdk-hello-world: new test.gitlab-ci.yml | 1 + DEVELOPERS | 3 + package/Config.in | 1 + package/openjdk-bin/openjdk-bin.hash | 6 + package/openjdk-bin/openjdk-bin.mk | 23 +++ package/openjdk/Config.in | 58 ++++++++ package/openjdk/openjdk.hash | 3 + package/openjdk/openjdk.mk | 135 ++++++++++++++++++ .../package/br2-external/openjdk/Config.in | 1 + .../br2-external/openjdk/external.desc | 1 + .../package/br2-external/openjdk/external.mk | 1 + .../package/openjdk-hello-world/Config.in | 26 ++++ .../openjdk-hello-world/HelloWorld.java | 8 ++ .../openjdk-hello-world.mk | 18 +++ support/testing/tests/package/test_openjdk.py | 42 ++++++ 15 files changed, 327 insertions(+) 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 create mode 100644 support/testing/tests/package/br2-external/openjdk/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/external.desc create mode 100644 support/testing/tests/package/br2-external/openjdk/external.mk create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java create mode 100644 support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk create mode 100644 support/testing/tests/package/test_openjdk.py--
2.20.1_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 23 lines
Matthew Weber | Pr. Software Engineer | Commercial Avionics COLLINS AEROSPACE 400 Collins Road NE, Cedar Rapids, Iowa 52498, USA Tel: +1 319 295 7349 | FAX: +1 319 263 6099 matthew.weber at collins.com | collinsaerospace.com CONFIDENTIALITY WARNING: This message may contain proprietary and/or privileged information of Collins Aerospace and its affiliated companies. If you are not the intended recipient, please 1) Do not disclose, copy, distribute or use this message or its contents. 2) Advise the sender by return email. 3) Delete all copies (including all attachments) from your computer. Your cooperation is greatly appreciated. Any export restricted material should be shared using my matthew.weber at corp.rockwellcollins.com address.