* [Buildroot] [PATCH v3 1/5] testing/infra/builder: build with target and environment
2019-01-28 23:22 [Buildroot] [PATCH v3 0/5] OpenJDK: new package and tests aduskett at gmail.com
@ 2019-01-28 23:22 ` aduskett at gmail.com
2019-01-29 21:56 ` Thomas Petazzoni
2019-01-28 23:22 ` [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external aduskett at gmail.com
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: aduskett at gmail.com @ 2019-01-28 23:22 UTC (permalink / raw)
To: buildroot
From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Make the builder able to call 'VAR1=1 make VAR2=2 target'.
Allow sending extra parameters to be added to the end of make command
line. Uses for these purposes:
- to configure a br2-external, using the 'BR2_EXTERNAL="dir" variable.
- to specify a make target, such as 'foo-source.'
Allow adding variables to the environment when calling make.
These added variables allow a user to override default values from BuildRoot,
such as 'BR2_DL_DIR="dl"'.
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Daniel J. Leach <dleach@belcan.com>
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
Changes v1 -> v3:
- Added this patch to the series.
support/testing/infra/builder.py | 36 ++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
index fc318fe26e..018747555d 100644
--- a/support/testing/infra/builder.py
+++ b/support/testing/infra/builder.py
@@ -12,7 +12,17 @@ class Builder(object):
self.builddir = builddir
self.logfile = infra.open_log_file(builddir, "build", logtofile)
- def configure(self):
+ def configure(self, make_extra_opts=[], make_extra_env={}):
+ """Configure the build.
+
+ make_extra_opts: a list of arguments to be passed to the make
+ command.
+ e.g. make_extra_opts=["BR2_EXTERNAL=/path"]
+
+ make_extra_env: a dict of variables to be appended (or replaced)
+ in the environment that calls make.
+ e.g. make_extra_env={"BR2_DL_DIR": "/path"}
+ """
if not os.path.isdir(self.builddir):
os.makedirs(self.builddir)
@@ -25,22 +35,40 @@ class Builder(object):
self.logfile.flush()
env = {"PATH": os.environ["PATH"]}
+ env.update(make_extra_env)
+
cmd = ["make",
- "O={}".format(self.builddir),
- "olddefconfig"]
+ "O={}".format(self.builddir)]
+ cmd += make_extra_opts
+ cmd += ["olddefconfig"]
+
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
env=env)
if ret != 0:
raise SystemError("Cannot olddefconfig")
- def build(self):
+ def build(self, make_extra_opts=[], make_extra_env={}):
+ """Perform the build.
+
+ make_extra_opts: a list of arguments to be passed to the make
+ command. It can include a make target.
+ e.g. make_extra_opts=["foo-source"]
+
+ make_extra_env: a dict of variables to be appended (or replaced)
+ in the environment that calls make.
+ e.g. make_extra_env={"BR2_DL_DIR": "/path"}
+ """
env = {"PATH": os.environ["PATH"]}
if "http_proxy" in os.environ:
self.logfile.write("Using system proxy: " +
os.environ["http_proxy"] + "\n")
env['http_proxy'] = os.environ["http_proxy"]
env['https_proxy'] = os.environ["http_proxy"]
+ env.update(make_extra_env)
+
cmd = ["make", "-C", self.builddir]
+ cmd += make_extra_opts
+
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
env=env)
if ret != 0:
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external
2019-01-28 23:22 [Buildroot] [PATCH v3 0/5] OpenJDK: new package and tests aduskett at gmail.com
2019-01-28 23:22 ` [Buildroot] [PATCH v3 1/5] testing/infra/builder: build with target and environment aduskett at gmail.com
@ 2019-01-28 23:22 ` aduskett at gmail.com
2019-01-29 15:47 ` Matthew Weber
2019-01-29 21:57 ` Thomas Petazzoni
2019-01-28 23:22 ` [Buildroot] [PATCH v3 3/5] openjdk-bin: new package aduskett at gmail.com
` (2 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: aduskett at gmail.com @ 2019-01-28 23:22 UTC (permalink / raw)
To: buildroot
From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Some upcoming test cases can use one or more br2-external trees as fixtures
that provide packages used only in runtime tests.
Add support for br2-external into the BRTest class. Any test case can
then provide a list of paths for being used as br2-external trees during
the build of the image to test.
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Daniel J. Leach <dleach@belcan.com>
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
Changes v1 -> v3:
- Added this patch to the series.
support/testing/infra/basetest.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 5014fefafa..84139438bc 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -30,6 +30,7 @@ MINIMAL_CONFIG = \
class BRTest(unittest.TestCase):
config = None
+ br2_external = list()
downloaddir = None
outputdir = None
logtofile = True
@@ -58,7 +59,7 @@ class BRTest(unittest.TestCase):
if not self.b.is_finished():
self.show_msg("Building")
- self.b.configure()
+ self.b.configure(["BR2_EXTERNAL={}".format(":".join(self.br2_external))])
self.b.build()
self.show_msg("Building done")
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external
2019-01-28 23:22 ` [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external aduskett at gmail.com
@ 2019-01-29 15:47 ` Matthew Weber
2019-01-29 21:57 ` Thomas Petazzoni
1 sibling, 0 replies; 11+ messages in thread
From: Matthew Weber @ 2019-01-29 15:47 UTC (permalink / raw)
To: buildroot
All,
On Mon, Jan 28, 2019 at 5:22 PM <aduskett@gmail.com> wrote:
>
> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
>
> Some upcoming test cases can use one or more br2-external trees as fixtures
> that provide packages used only in runtime tests.
>
> Add support for br2-external into the BRTest class. Any test case can
> then provide a list of paths for being used as br2-external trees during
> the build of the image to test.
Both this patch and http://patchwork.ozlabs.org/patch/1032309/ would
be nice to have merged as they allow more complex test scenarios to be
built for runtime testing. The patches are independent of the couple
patchsets that have used them.
Tested-by: Matthew Weber <matthew.weber@rockwellcollins.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external
2019-01-28 23:22 ` [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external aduskett at gmail.com
2019-01-29 15:47 ` Matthew Weber
@ 2019-01-29 21:57 ` Thomas Petazzoni
1 sibling, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2019-01-29 21:57 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 28 Jan 2019 18:22:06 -0500
aduskett at gmail.com wrote:
> if not self.b.is_finished():
> self.show_msg("Building")
> - self.b.configure()
> + self.b.configure(["BR2_EXTERNAL={}".format(":".join(self.br2_external))])
I made things explicit by using named arguments, i.e
make_extra_opts=...
Applied to master with this change. Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 3/5] openjdk-bin: new package
2019-01-28 23:22 [Buildroot] [PATCH v3 0/5] OpenJDK: new package and tests aduskett at gmail.com
2019-01-28 23:22 ` [Buildroot] [PATCH v3 1/5] testing/infra/builder: build with target and environment aduskett at gmail.com
2019-01-28 23:22 ` [Buildroot] [PATCH v3 2/5] testing/infra/basetest: support br2-external aduskett at gmail.com
@ 2019-01-28 23:22 ` aduskett at gmail.com
2019-01-29 21:54 ` Thomas Petazzoni
2019-01-28 23:22 ` [Buildroot] [PATCH v3 4/5] openjdk: " aduskett at gmail.com
2019-01-28 23:22 ` [Buildroot] [PATCH v3 5/5] openjdk-hello-world: new test aduskett at gmail.com
4 siblings, 1 reply; 11+ messages in thread
From: aduskett at gmail.com @ 2019-01-28 23:22 UTC (permalink / raw)
To: buildroot
From: Adam Duskett <Aduskett@gmail.com>
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) I do not have access to a machine that is not x86_64 that can build
Buildroot.
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.
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
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.
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 | 23 +++++++++++++++++++++++
5 files changed, 43 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
diff --git a/DEVELOPERS b/DEVELOPERS
index c1950bb0f4..28ba480d85 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/Config.in.host b/package/Config.in.host
index 16b474fc9d..0499589c4f 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/openjdk-bin/Config.in.host b/package/openjdk-bin/Config.in.host
new file mode 100644
index 0000000000..e3dd438a0f
--- /dev/null
+++ b/package/openjdk-bin/Config.in.host
@@ -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/
diff --git a/package/openjdk-bin/openjdk-bin.hash b/package/openjdk-bin/openjdk-bin.hash
new file mode 100644
index 0000000000..35d0b5c44b
--- /dev/null
+++ b/package/openjdk-bin/openjdk-bin.hash
@@ -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
diff --git a/package/openjdk-bin/openjdk-bin.mk b/package/openjdk-bin/openjdk-bin.mk
new file mode 100644
index 0000000000..197ccd8eec
--- /dev/null
+++ b/package/openjdk-bin/openjdk-bin.mk
@@ -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 = GPLv2+ 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))
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 3/5] openjdk-bin: new package
2019-01-28 23:22 ` [Buildroot] [PATCH v3 3/5] openjdk-bin: new package aduskett at gmail.com
@ 2019-01-29 21:54 ` Thomas Petazzoni
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2019-01-29 21:54 UTC (permalink / raw)
To: buildroot
Hello,
Thanks for working on this!
On Mon, 28 Jan 2019 18:22:07 -0500
aduskett at gmail.com wrote:
> From: Adam Duskett <Aduskett@gmail.com>
>
> 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) I do not have access to a machine that is not x86_64 that can build
We generally try to avoid first person sentences in commit logs.
Perhaps you should mention which other host architectures are supported
by the AdoptOpenJDK project, and indicate that they are not supported
because they couldn't be tested.
> 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.
How does installing to $(HOST_DIR)/openjdk/ solves this RPATH issue ? I
see the binaries have this RPATH:
Library rpath: [$ORIGIN/../lib/jli:$ORIGIN/../lib]
why is it invalid ? It seems to fit pretty well with an installation in
$(HOST_DIR). Though maybe we don't want the mess of OpenJDK extracted
right at the root of $(HOST_DIR), but that's a separate concern from
the RPATH one.
> diff --git a/package/openjdk-bin/Config.in.host b/package/openjdk-bin/Config.in.host
> new file mode 100644
> index 0000000000..e3dd438a0f
> --- /dev/null
> +++ b/package/openjdk-bin/Config.in.host
> @@ -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"
I don't think we need a visible Config.in.host option for this package.
It is merely a build dependency for the target openjdk.
> +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
GPL-2.0+
> +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))
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 4/5] openjdk: new package
2019-01-28 23:22 [Buildroot] [PATCH v3 0/5] OpenJDK: new package and tests aduskett at gmail.com
` (2 preceding siblings ...)
2019-01-28 23:22 ` [Buildroot] [PATCH v3 3/5] openjdk-bin: new package aduskett at gmail.com
@ 2019-01-28 23:22 ` aduskett at gmail.com
2019-01-29 18:56 ` Leach, Daniel J.
2019-01-28 23:22 ` [Buildroot] [PATCH v3 5/5] openjdk-hello-world: new test aduskett at gmail.com
4 siblings, 1 reply; 11+ messages in thread
From: aduskett at gmail.com @ 2019-01-28 23:22 UTC (permalink / raw)
To: buildroot
From: Adam Duskett <Aduskett@gmail.com>
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. I chose the former because it seems cleaner.
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
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.
DEVELOPERS | 1 +
package/Config.in | 1 +
package/openjdk/Config.in | 55 ++++++++++++++
package/openjdk/openjdk.hash | 3 +
package/openjdk/openjdk.mk | 136 +++++++++++++++++++++++++++++++++++
5 files changed, 196 insertions(+)
create mode 100644 package/openjdk/Config.in
create mode 100644 package/openjdk/openjdk.hash
create mode 100644 package/openjdk/openjdk.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 28ba480d85..0893af58dc 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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/
diff --git a/package/Config.in b/package/Config.in
index 5036421a73..e150e32563 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/openjdk/Config.in b/package/openjdk/Config.in
new file mode 100644
index 0000000000..f23cedc7ca
--- /dev/null
+++ b/package/openjdk/Config.in
@@ -0,0 +1,55 @@
+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
+ help
+ 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
diff --git a/package/openjdk/openjdk.hash b/package/openjdk/openjdk.hash
new file mode 100644
index 0000000000..dc201863a7
--- /dev/null
+++ b/package/openjdk/openjdk.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 9bb8c44e42fbfcee8402f6d0722fbe2209647b7959544d924a6790bc053e8f20 openjdk-jdk-11.0.2+7.tar.gz
+sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726 LICENSE
diff --git a/package/openjdk/openjdk.mk b/package/openjdk/openjdk.mk
new file mode 100644
index 0000000000..97c55434b6
--- /dev/null
+++ b/package/openjdk/openjdk.mk
@@ -0,0 +1,135 @@
+################################################################################
+#
+# 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_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)" \
+ --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
+
+# 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
+
+# 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))
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 4/5] openjdk: new package
2019-01-28 23:22 ` [Buildroot] [PATCH v3 4/5] openjdk: " aduskett at gmail.com
@ 2019-01-29 18:56 ` Leach, Daniel J.
0 siblings, 0 replies; 11+ messages in thread
From: Leach, Daniel J. @ 2019-01-29 18:56 UTC (permalink / raw)
To: buildroot
On 28-01-19 17:22, Adam Duskett wrote:
> 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. I chose the former because it seems cleaner.
>
> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Tested-by: Daniel J. Leach <dleach@belcan.com>
I built and ran the run-time test in patch 1032312 (http://patchwork.ozlabs.org/patch/1032312/):
./support/testing/run-tests -s -o test-output/ -d test-dl/ -k tests.package.test_openjdk.TestOpenJdk
> ---
> 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.
>
> DEVELOPERS | 1 +
> package/Config.in | 1 +
> package/openjdk/Config.in | 55 ++++++++++++++
> package/openjdk/openjdk.hash | 3 +
> package/openjdk/openjdk.mk | 136 +++++++++++++++++++++++++++++++++++
> 5 files changed, 196 insertions(+)
> create mode 100644 package/openjdk/Config.in
> create mode 100644 package/openjdk/openjdk.hash
> create mode 100644 package/openjdk/openjdk.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 28ba480d85..0893af58dc 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -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/
> diff --git a/package/Config.in b/package/Config.in
> index 5036421a73..e150e32563 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/openjdk/Config.in b/package/openjdk/Config.in
> new file mode 100644
> index 0000000000..f23cedc7ca
> --- /dev/null
> +++ b/package/openjdk/Config.in
> @@ -0,0 +1,55 @@
> +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
> + help
> + 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
> diff --git a/package/openjdk/openjdk.hash b/package/openjdk/openjdk.hash
> new file mode 100644
> index 0000000000..dc201863a7
> --- /dev/null
> +++ b/package/openjdk/openjdk.hash
> @@ -0,0 +1,3 @@
> +# Locally computed
> +sha256 9bb8c44e42fbfcee8402f6d0722fbe2209647b7959544d924a6790bc053e8f20 > openjdk-jdk-11.0.2+7.tar.gz
> +sha256 4b9abebc4338048a7c2dc184e9f800deb349366bdf28eb23c2677a77b4c87726 > LICENSE
> diff --git a/package/openjdk/openjdk.mk b/package/openjdk/openjdk.mk
> new file mode 100644
> index 0000000000..97c55434b6
> --- /dev/null
> +++ b/package/openjdk/openjdk.mk
> @@ -0,0 +1,135 @@
> +###############################################################################> #
> +#
> +# 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_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)" \
> + --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
> +
> +# 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
> +
> +# 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))
> --
> 2.20.1
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v3 5/5] openjdk-hello-world: new test
2019-01-28 23:22 [Buildroot] [PATCH v3 0/5] OpenJDK: new package and tests aduskett at gmail.com
` (3 preceding siblings ...)
2019-01-28 23:22 ` [Buildroot] [PATCH v3 4/5] openjdk: " aduskett at gmail.com
@ 2019-01-28 23:22 ` aduskett at gmail.com
4 siblings, 0 replies; 11+ messages in thread
From: aduskett at gmail.com @ 2019-01-28 23:22 UTC (permalink / raw)
To: buildroot
From: "Daniel J. Leach" <dleach@belcan.com>
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.
Signed-off-by: Daniel J. Leach <dleach@belcan.com>
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
Changes v1 -> v3:
- Added this patch to the series.
.gitlab-ci.yml | 1 +
DEVELOPERS | 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 | 19 +++++++++
support/testing/tests/package/test_openjdk.py | 42 +++++++++++++++++++
9 files changed, 100 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
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8f1e4ae804..8a8bd29d14 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
diff --git a/DEVELOPERS b/DEVELOPERS
index 0893af58dc..baa325eead 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1470,6 +1470,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 <mc5686@mclink.it>
F: package/mc/
diff --git a/support/testing/tests/package/br2-external/openjdk/Config.in b/support/testing/tests/package/br2-external/openjdk/Config.in
new file mode 100644
index 0000000000..00c7fd4799
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/Config.in
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_OPENJDK_PATH/package/openjdk-hello-world/Config.in"
diff --git a/support/testing/tests/package/br2-external/openjdk/external.desc b/support/testing/tests/package/br2-external/openjdk/external.desc
new file mode 100644
index 0000000000..f28ba5060c
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/external.desc
@@ -0,0 +1 @@
+name: OPENJDK
diff --git a/support/testing/tests/package/br2-external/openjdk/external.mk b/support/testing/tests/package/br2-external/openjdk/external.mk
new file mode 100644
index 0000000000..54c24e8c64
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/external.mk
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_OPENJDK_PATH)/package/*/*.mk))
diff --git a/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in
new file mode 100644
index 0000000000..4f9022fb92
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/Config.in
@@ -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
diff --git a/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java
new file mode 100644
index 0000000000..612d661cdd
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/HelloWorld.java
@@ -0,0 +1,8 @@
+public class HelloWorld
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello, World");
+ }
+
+}
diff --git a/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk
new file mode 100644
index 0000000000..1847a11d4f
--- /dev/null
+++ b/support/testing/tests/package/br2-external/openjdk/package/openjdk-hello-world/openjdk-hello-world.mk
@@ -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))
diff --git a/support/testing/tests/package/test_openjdk.py b/support/testing/tests/package/test_openjdk.py
new file mode 100644
index 0000000000..ed8a1f1be4
--- /dev/null
+++ b/support/testing/tests/package/test_openjdk.py
@@ -0,0 +1,42 @@
+import os
+
+import infra.basetest
+
+
+class TestOpenJdk(infra.basetest.BRTest):
+ br2_external = [infra.filepath("tests/package/br2-external/openjdk")]
+ config = \
+ """
+ BR2_aarch64=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7"
+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ BR2_TARGET_ROOTFS_CPIO_GZIP=y
+ BR2_PACKAGE_XORG7=y
+ BR2_PACKAGE_OPENJDK=y
+ BR2_PACKAGE_OPENJDK_HELLO_WORLD=y
+ """
+
+ def login(self):
+ img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
+ kern = os.path.join(self.builddir, "images", "Image")
+ self.emulator.boot(arch="aarch64",
+ kernel=kern,
+ kernel_cmdline=["console=ttyAMA0"],
+ options=["-M", "virt", "-cpu", "cortex-a57", "-m", "512M", "-initrd", img])
+ self.emulator.login()
+
+ def test_run(self):
+ self.login()
+
+ cmd = "java -cp /usr/bin HelloWorld"
+ output, exit_code = self.emulator.run(cmd)
+ print(output)
+ self.assertEqual(exit_code, 0)
+ self.assertEqual(output, ["Hello, World"])
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread