jws/build.sh
Patryk Hegenberg 04ecd56598 feat: add first simple jakartaee10-servlet project
jakarta project has to be cleaned up and some smaller errors have to be
fixed
2025-03-19 22:48:03 +01:00

76 lines
1.8 KiB
Bash
Executable file

#!/bin/bash
set -e
# Prüfe auf erforderliches Versions-Argument
if [ -z "$1" ]; then
echo "Fehler: App-Version muss als Parameter angegeben werden (z.B. ./build.sh 0.0.1)"
exit 1
fi
APP_VERSION="$1"
APP_ID="com.hegenberg.javastarter"
APP_BUILD="1"
NAME="jws"
ICON="Icon.png"
SDK_PATH="./MacOSX11.3.sdk"
# Lösche vorhandenen packages-Ordner und erstelle neu
if [ -d "packages" ]; then
echo "Entferne vorhandenen packages-Ordner..."
rm -rf packages
fi
mkdir -p packages
# Build-Funktion für Mac
build_mac() {
local arch="$1"
echo "Baue Mac $arch Version..."
fyne-cross darwin \
-app-id "$APP_ID" \
-app-build "$APP_BUILD" \
-app-version "$APP_VERSION" \
-icon "$ICON" \
-name "$NAME" \
-arch "$arch" \
-macosx-sdk-path "$SDK_PATH" \
-ldflags "-s" \
-ldflags "-w" \
./cmd/jws
# Verpacke die App
local dist_dir="fyne-cross/dist/darwin-${arch}/jws.app"
tar -cJf "packages/jws_mac_${arch}.tar.xz" "$dist_dir"
}
# Bauen für Mac-Architekturen
for arch in arm64 amd64; do
build_mac "$arch"
done
# Build Windows
echo "Baue Windows Version..."
fyne-cross windows \
-app-id "$APP_ID" \
-app-build "$APP_BUILD" \
-app-version "$APP_VERSION" \
-icon "$ICON" \
-name "$NAME.exe" \
-ldflags "-s" \
-ldflags "-w" \
./cmd/jws
mv fyne-cross/dist/windows-amd64/jws.exe.zip packages/jws_windows.zip
# Build Linux
echo "Baue Linux Version..."
# Erstelle selbstentpackendes Bundle
fyne package --target linux --exe ./jws --name "$NAME" --appVersion "$APP_VERSION" --sourceDir ./cmd/jws
# Erstelle einfache Executable
fyne build ./cmd/jws
# Verpacke Linux-Versionen
tar -cJf packages/jws_linux_exe.tar.xz ./jws
tar -cJf packages/jws_linux_bundle.tar.xz ./jws.tar.xz
echo "Build abgeschlossen! Dateien finden sich im packages-Ordner:"
ls -lh packages/