diff options
-rwxr-xr-x | scripts/link_debian.sh | 24 | ||||
-rwxr-xr-x | scripts/patch_gson.sh | 13 |
2 files changed, 32 insertions, 5 deletions
diff --git a/scripts/link_debian.sh b/scripts/link_debian.sh new file mode 100755 index 0000000..183cb99 --- /dev/null +++ b/scripts/link_debian.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Links everything into a self-contained executable using jlink. + +set -e + +# Needed if you have a java version other than 11 as default +JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64' + +# Compile sources +mvn compile + +# Patch gson +if [ ! -e modules/gson.jar ]; then + ./scripts/patch_gson.sh +fi + +# Build using jlink +rm -rf dist/debian +$JAVA_HOME/bin/jlink \ + --module-path modules/gson.jar:target/classes \ + --add-modules gson,javacs \ + --launcher launcher=javacs/org.javacs.Main \ + --output dist/debian \ + --compress 2 diff --git a/scripts/patch_gson.sh b/scripts/patch_gson.sh index d2981ea..348f01f 100755 --- a/scripts/patch_gson.sh +++ b/scripts/patch_gson.sh @@ -6,7 +6,10 @@ set -e # Needed if you have a java version other than 11 as default -JAVA_HOME=$(/usr/libexec/java_home -v 11) +# and used if java_home is available +if [ -f /usr/libexec/java_home ] ; then + JAVA_HOME=$(/usr/libexec/java_home -v 11) +fi # Download Gson jar cd modules @@ -15,15 +18,15 @@ curl https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.j # Unpack jar into modules/classes mkdir classes cd classes -jar xf ../gson.jar +$JAVA_HOME/bin/jar xf ../gson.jar cd .. # Compile module-info.java to module-info.class -javac -p com.google.gson -d classes module-info.java +$JAVA_HOME/bin/javac -p com.google.gson -d classes module-info.java # Update gson.jar with module-info.class -jar uf gson.jar -C classes module-info.class +$JAVA_HOME/bin/jar uf gson.jar -C classes module-info.class # Clean up rm -rf classes -cd ..
\ No newline at end of file +cd .. |