include ../misc/image/image.bas
include ../misc/image/image.beg

select-one zlib1g                        #dependency
select-one libstdc++6                    #dependency
select-one libatomic1                    #dependency
select-dep no
select-dis java-common.*                 #commons
select-dis default-jdk-.*                #def jvm
select-dis default-jre-.*                #def jvm
find-clear
find-package 1-1111 openjdk-[0-9][0-9]-jdk-headless
find-result
select-one %find%                        #new jdk
select-dep yes

copy ../misc/image/init.jvm %tmp%/init.run
copy rtr.jar %tmp%/rtr/

select-lst
select-sum
package-down
package-xtra
package-inst

find-clear
find-file 1-1111 %tmp%/usr/lib/jvm/ java-[0-9][0-9]-openjdk-%arch%
find-result
find-remove -%arch%
find-result
exec /usr/lib/jvm/%find%-*/bin/jlink --module-path %tmp%/usr/lib/jvm/%find%-%arch%/jmods --output %tmp%/java --strip-debug --no-man-pages --no-header-files --add-modules java.base,java.management --endian %carc% --compress zip-0
del %tmp%/usr/lib/jvm %tmp%/etc/java-* %tmp%/java/bin/keytool %tmp%/java/docs %tmp%/java/demo %tmp%/java/man %tmp%/java/legal %tmp%/java/lib/security %tmp%/java/lib/jrt-fs.jar %tmp%/java/lib/libsimdsort.so

include ../misc/image/image.end

include ../misc/image/image.grb

include ../misc/image/image.cdi

catalog-save bld

del %tmp%
