From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Nadav Har'El <n...@scylladb.com> Branch: master
external x64: replace openjdk7 module with with new openjdk8-from-host one Java 7 reached end of life almost 5 years ago and has since been largely replaced by Java 8 which is still widely used. This patch eliminates openjdk7 module and adds new openjdk8-from-host one as a default java module. This patch also replaces dependencies in the main makefile on antique openjdk7 in external/x64 with openjdk8 from host that should be installed by setup.py. This patch also removes external/x64/openjdk.bin and external/aarch64/openjdk.bin modules. References #743 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> Message-Id: <20200122032153.6195-2-jwkozac...@gmail.com> --- diff --git a/.gitmodules b/.gitmodules --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "external/x64/openjdk.bin"] - path = external/x64/openjdk.bin - url = ../../cloudius-systems/openjdk.bin - ignore = dirty [submodule "external/x64/gcc.bin"] path = external/x64/gcc.bin url = ../../cloudius-systems/gcc.bin @@ -24,9 +20,6 @@ [submodule "external/aarch64/misc.bin"] path = external/aarch64/misc.bin url = ../../cloudius-systems/aarch64-misc.bin.git -[submodule "external/aarch64/openjdk.bin"] - path = external/aarch64/openjdk.bin - url = ../../cloudius-systems/aarch64-openjdk.bin.git [submodule "modules/httpserver/swagger-ui"] path = modules/httpserver-html5-gui/swagger-ui url = ../../cloudius-systems/swagger-ui.git diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -112,17 +112,13 @@ endif # musl/ - for some of the header files (symbolic links in include/api) and # some of the source files ($(musl) below). # external/x64/acpica - for the ACPICA library (see $(acpi) below). -# external/x64/openjdk.bin - for $(java-targets) below. # Additional submodules are need when certain make parameters are used. ifeq (,$(wildcard musl/include)) $(error Missing musl/ directory. Please run "git submodule update --init --recursive") endif ifeq (,$(wildcard external/x64/acpica/source)) $(error Missing external/x64/acpica/ directory. Please run "git submodule update --init --recursive") endif -ifeq (,$(wildcard external/x64/openjdk.bin/usr)) - $(error Missing external/x64/openjdk.bin/ directory. Please run "git submodule update --init --recursive") -endif # This makefile wraps all commands with the $(quiet) or $(very-quiet) macros # so that instead of half-a-screen-long command lines we short summaries @@ -233,9 +229,6 @@ INCLUDES += -isystem include/glibc-compat gccbase = external/$(arch)/gcc.bin miscbase = external/$(arch)/misc.bin -jdkbase := $(shell find external/$(arch)/openjdk.bin/usr/lib/jvm \ - -maxdepth 1 -type d -name 'java*') - ifeq ($(gcc_include_env), external) gcc-inc-base := $(dir $(shell find $(gccbase)/ -name vector | grep -v -e debug/vector$$ -e profile/vector$$)) @@ -1933,7 +1926,7 @@ $(bootfs_manifest_dep): phony $(out)/bootfs.bin: scripts/mkbootfs.py $(bootfs_manifest) $(bootfs_manifest_dep) $(tools:%=$(out)/%) \ $(out)/zpool.so $(out)/zfs.so $(out)/libenviron.so $(out)/libvdso.so $(call quiet, olddir=`pwd`; cd $(out); "$$olddir"/scripts/mkbootfs.py -o bootfs.bin -d bootfs.bin.d -m "$$olddir"/$(bootfs_manifest) \ - -D jdkbase="$$olddir"/$(jdkbase) -D gccbase="$$olddir"/$(gccbase) \ + -D gccbase="$$olddir"/$(gccbase) \ -D miscbase="$$olddir"/$(miscbase), MKBOOTFS $@) $(out)/bootfs.o: $(out)/bootfs.bin diff --git a/external/aarch64/openjdk.bin b/external/aarch64/openjdk.bin --- a/external/aarch64/openjdk.bin +++ b/external/aarch64/openjdk.bin @@ -1 +0,0 @@ -Subproject commit 443f2cca797910915274a0a3a42ea8a67752c063 diff --git a/external/x64/openjdk.bin b/external/x64/openjdk.bin --- a/external/x64/openjdk.bin +++ b/external/x64/openjdk.bin @@ -1 +0,0 @@ -Subproject commit 019ea95e844cc9e51c149a519391e2a99915ad39 diff --git a/modules/httpserver-jvm-plugin/Makefile b/modules/httpserver-jvm-plugin/Makefile --- a/modules/httpserver-jvm-plugin/Makefile +++ b/modules/httpserver-jvm-plugin/Makefile @@ -1,7 +1,6 @@ INCLUDES = -I$(src)/build/$(mode)/gen/include -INCLUDES += -I../../include -I. -I../../java -I../../arch/$(ARCH) -I../.. -INCLUDES += -I$(jdkbase)/include -I$(jdkbase)/include/linux +INCLUDES += -I../../include -I. -I../../arch/$(ARCH) -I../.. INCLUDES += -I../httpserver-api # compiler flags: diff --git a/modules/java-base/common.gmk b/modules/java-base/common.gmk --- a/modules/java-base/common.gmk +++ b/modules/java-base/common.gmk @@ -1,3 +1,5 @@ +jdkbase = $(dir $(shell readlink -f $$(which javac)))/.. + INCLUDES = -I$(src)/arch/$(arch) -I$(src) -I$(src)/include -I$(src)/arch/common INCLUDES += -I$(src)/include/glibc-compat INCLUDES += $(shell $(CXX) -E -xc++ - -v </dev/null 2>&1 | awk '/^End/ {exit} /^ .*c\+\+/ {print "-isystem" $$0}') diff --git a/modules/java/module.py b/modules/java/module.py --- a/modules/java/module.py +++ b/modules/java/module.py @@ -1,4 +1,4 @@ from osv.modules import api api.require('java-non-isolated') -api.require('openjdk7') +api.require('openjdk8-from-host') diff --git a/modules/openjdk7/module.py b/modules/openjdk7/module.py --- a/modules/openjdk7/module.py +++ b/modules/openjdk7/module.py @@ -1,22 +0,0 @@ -from osv.modules.filemap import FileMap -from osv.modules import api -import os, os.path - -api.require('java-cmd') -provides = ['java'] - -usr_files = FileMap() - -jdkdir = os.path.basename(os.path.expandvars('${jdkbase}')) - -usr_files.add('${jdkbase}').to('/usr/lib/jvm/java') \ - .include('lib/**') \ - .include('jre/**') \ - .include('bin/java') \ - .exclude('jre/lib/security/cacerts') \ - .exclude('jre/lib/audio/**') - -usr_files.link('/usr/lib/jvm/' + jdkdir).to('java') -usr_files.link('/usr/lib/jvm/jre').to('java/jre') -usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts') -usr_files.link('/usr/bin/java').to('/usr/lib/jvm/java/bin/java') diff --git a/modules/openjdk8-from-host/.gitignore b/modules/openjdk8-from-host/.gitignore --- a/modules/openjdk8-from-host/.gitignore +++ b/modules/openjdk8-from-host/.gitignore @@ -0,0 +1 @@ +usr.manifest diff --git a/modules/openjdk8-from-host/Makefile b/modules/openjdk8-from-host/Makefile --- a/modules/openjdk8-from-host/Makefile +++ b/modules/openjdk8-from-host/Makefile @@ -0,0 +1,14 @@ +.PHONY: module clean + +SRC = $(shell readlink -f ../..) + +javac_exe_path = $(shell realpath $$(which javac)) +javac_bin_path = $(shell dirname $(javac_exe_path)) +java_jdk_path = $(shell dirname $(javac_bin_path)) + +module: + $(SRC)/scripts/manifest_from_host.sh $(java_jdk_path)/jre/lib/amd64/libsunec.so > usr.manifest + $(SRC)/scripts/manifest_from_host.sh -l libfreeblpriv3.so >> usr.manifest + +clean: + rm -rf usr.manifest diff --git a/modules/openjdk8-from-host/module.py b/modules/openjdk8-from-host/module.py --- a/modules/openjdk8-from-host/module.py +++ b/modules/openjdk8-from-host/module.py @@ -0,0 +1,40 @@ +from osv.modules.filemap import FileMap +from osv.modules import api +import os, os.path +import subprocess + +api.require('java-cmd') +provides = ['java','java8'] + +#Verify that the jdk exists by trying to locate javac (java compiler) +if subprocess.call(['which', 'javac']) != 0: + print('Could not find any jdk on the host. Please install openjdk8!') + os.exit(-1) + +java_version = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT) +if not 'openjdk version "1.8.0' in java_version: + print('Could not find openjdk version 8 on the host. Please install openjdk8!') + os.exit(-1) + +javac_path = subprocess.check_output(['which', 'javac']).split('\n')[0] +javac_real_path = os.path.realpath(javac_path) +jdk_path = os.path.dirname(os.path.dirname(javac_real_path)) + +usr_files = FileMap() + +jdk_dir = os.path.basename(jdk_path) + +usr_files.add(jdk_path).to('/usr/lib/jvm/java') \ + .include('jre/**') \ + .exclude('jre/lib/security/cacerts') \ + .exclude('jre/lib/amd64/*audio*') \ + .exclude('jre/lib/amd64/*sound*') \ + .exclude('') \ + .exclude('jre/man/**') \ + .exclude('jre/bin/**') \ + .include('jre/bin/java') + +usr_files.link('/usr/lib/jvm/' + jdk_dir).to('java') +usr_files.link('/usr/lib/jvm/jre').to('java/jre') +usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts') +usr_files.link('/usr/bin/java').to('/usr/lib/jvm/java/jre/bin/java') diff --git a/scripts/build b/scripts/build --- a/scripts/build +++ b/scripts/build @@ -170,7 +170,6 @@ esac modules=${vars[modules]-!$image} # TODO: some modules need these... Would be better if they wouldn't... -jdkbase=${vars[jdkbase]-`find "$SRC"/external/$arch/openjdk.bin/usr/lib/jvm -maxdepth 1 -type d -name 'java*'`} gccbase=${vars[gccbase]-"$SRC"/external/$arch/gcc.bin} miscbase=${vars[miscbase]-"$SRC"/external/$arch/misc.bin} @@ -221,8 +220,8 @@ fi export "$i" ;; esac done - # Export the variables we already have. This makes it unnecessary to do "fs__type=$fstype jdkbase $jdkbase ..." - export fs_type jdkbase mode OSV_BUILD_PATH + # Export the variables we already have. This makes it unnecessary to do "fs__type=$fstype ..." + export fs_type mode OSV_BUILD_PATH # Other variables we wanted to rename, I don't know why export ARCH=$arch OSV_BASE=$SRC # Run what we wanted to run. It will inherit everything we exported above. @@ -269,15 +268,15 @@ zfs) if [ "$export" == "none" ] then - "$SRC"/scripts/upload_manifest.py -o usr.img -m usr.manifest -D jdkbase="$jdkbase" -D gccbase="$gccbase" -D miscbase="$miscbase" + "$SRC"/scripts/upload_manifest.py -o usr.img -m usr.manifest -D gccbase="$gccbase" -D miscbase="$miscbase" else export_dir=${vars[export_dir]-$SRC/build/export} - "$SRC"/scripts/export_manifest.py -e "$export_dir" -m usr.manifest -D jdkbase="$jdkbase" -D gccbase="$gccbase" -D miscbase="$miscbase" + "$SRC"/scripts/export_manifest.py -e "$export_dir" -m usr.manifest -D gccbase="$gccbase" -D miscbase="$miscbase" fi ;; rofs) rm -rf rofs.img - "$SRC"/scripts/gen-rofs-img.py -o rofs.img -m usr.manifest -D jdkbase="$jdkbase" -D gccbase="$gccbase" -D miscbase="$miscbase" + "$SRC"/scripts/gen-rofs-img.py -o rofs.img -m usr.manifest -D gccbase="$gccbase" -D miscbase="$miscbase" rofs_size=`stat --printf %s rofs.img` img_size=$((kernel_end + rofs_size)) cp loader.img bare.raw -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000d66294059cb790e5%40google.com.