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 makes openjdk8-zull-full
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.

References #743

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 Makefile                               | 14 +++++++-------
 modules/httpserver-jvm-plugin/Makefile |  2 --
 modules/java-base/common.gmk           |  1 +
 modules/java/module.py                 |  2 +-
 modules/openjdk7/module.py             | 22 ----------------------
 scripts/build                          | 11 +++++------
 6 files changed, 14 insertions(+), 38 deletions(-)
 delete mode 100644 modules/openjdk7/module.py

diff --git a/Makefile b/Makefile
index 62277d5f..8886d1ec 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,6 @@ 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")
@@ -120,9 +119,6 @@ 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,13 @@ 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 ($(arch),x64)
+  jdkbase := $(dir $(shell readlink -f $$(which javac)))/..
+else
+  jdkbase := $(shell find external/$(arch)/openjdk.bin/usr/lib/jvm \
+                       -maxdepth 1 -type d -name 'java*')
+endif
 
 ifeq ($(gcc_include_env), external)
   gcc-inc-base := $(dir $(shell find $(gccbase)/ -name vector | grep -v -e 
debug/vector$$ -e profile/vector$$))
@@ -1940,7 +1940,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/modules/httpserver-jvm-plugin/Makefile 
b/modules/httpserver-jvm-plugin/Makefile
index fdc20bb7..bb802720 100644
--- a/modules/httpserver-jvm-plugin/Makefile
+++ b/modules/httpserver-jvm-plugin/Makefile
@@ -1,7 +1,5 @@
-
 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../httpserver-api
 
 # compiler flags:
diff --git a/modules/java-base/common.gmk b/modules/java-base/common.gmk
index e54a301a..1c79a6b5 100644
--- a/modules/java-base/common.gmk
+++ b/modules/java-base/common.gmk
@@ -1,3 +1,4 @@
+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
diff --git a/modules/java/module.py b/modules/java/module.py
index 7af25104..0c0eb6c5 100644
--- 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-zulu-full')
diff --git a/modules/openjdk7/module.py b/modules/openjdk7/module.py
deleted file mode 100644
index e4895465..00000000
--- a/modules/openjdk7/module.py
+++ /dev/null
@@ -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/scripts/build b/scripts/build
index 2a4ba957..b72a8d67 100755
--- 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
-- 
2.20.1

-- 
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/20200115040644.15786-1-jwkozaczuk%40gmail.com.

Reply via email to