Skip to content

Commit

Permalink
use os dependent build scripts [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Nov 6, 2024
1 parent 2e5b271 commit d59feca
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
4 changes: 1 addition & 3 deletions build.sh → build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
exit 1
fi

NATIVE_ACCESS_PACKAGE="no.native.access.needed"
NATIVE_ACCESS_PACKAGE="no.native.access.available"
_OS=$(uname -s)
if (echo "$_OS" | grep -q "Linux.*") ; then
_ARCH=$(uname -m)
Expand All @@ -45,8 +45,6 @@ if (echo "$_OS" | grep -q "Linux.*") ; then
elif [ "$_ARCH" = "aarch64" ]; then
NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.linux.aarch64"
fi
elif (echo "$_OS" | grep -q "Darwin.*"); then
NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.darwin"
fi

echo "Creating app binary with jpackage..."
Expand Down
62 changes: 62 additions & 0 deletions build_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

echo "Building cryptomator cli..."

# Check if Maven is installed
if ! command -v mvn &> /dev/null; then
echo "Maven is not installed. Please install Maven to proceed."
exit 1
fi

# Check if JAVA_HOME is set
if [ -z "$JAVA_HOME" ]; then
echo "Environment variable JAVA_HOME not defined"
exit 1
fi

echo "Building java app with maven..."
mvn -B clean package
cp ./LICENSE.txt ./target/
mv ./target/cryptomator-cli-*.jar ./target/mods

echo "Creating JRE with jlink..."
"$JAVA_HOME/bin/jlink" \
--verbose \
--output target/runtime \
--module-path "${JAVA_HOME}/jmods" \
--add-modules java.base,java.compiler,java.naming,java.xml \
--strip-native-commands \
--no-header-files \
--no-man-pages \
--strip-debug \
--compress zip-0

if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
echo "JRE creation with jlink failed."
exit 1
fi

echo "Creating app binary with jpackage..."
"$JAVA_HOME/bin/jpackage" \
--verbose \
--type app-image \
--runtime-image target/runtime \
--input target/libs \
--module-path target/mods \
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli \
--dest target \
--name cryptomator-cli \
--vendor "Skymatic GmbH" \
--copyright "(C) 2016 - 2024 Skymatic GmbH" \
--app-version "99.9.9" \
--java-options "-Dorg.cryptomator.cli.version=0.0.1-local" \
--java-options "--enable-preview" \
--java-options "--enable-native-access=org.cryptomator.jfuse.mac" \
--java-options "-Xss5m" \
--java-options "-Xmx256m" \
--java-options "-Dfile.encoding=utf-8" \

if [ $? -ne 0 ] || [ ! -d ./target/cryptomator-cli.app ]; then
echo "Binary creation with jpackage failed."
exit 1
fi
File renamed without changes.

0 comments on commit d59feca

Please sign in to comment.