Files
OpenPrestige/build-injector.sh
2026-11-11 01:20:27 +02:00

27 lines
1.2 KiB
Bash

#!/bin/sh
# Build OpenPrestige for the current host. Optional JAVA_HOME selects the Gradle JDK.
set -eu
cd "$(dirname "$0")"
case "$(uname -s)" in
Linux) LIB=libprestige_native.so ;;
Darwin) LIB=libprestige_native.dylib ;;
*) echo "Use build-injector.ps1 on Windows" >&2; exit 1 ;;
esac
if [ -n "${JAVA_HOME:-}" ]; then
export JAVA_HOME
PATH="$JAVA_HOME/bin:$PATH"
export PATH
fi
./gradlew bundlePayloads "-PpythonExecutable=${PYTHON:-python3}" --console=plain
unset PRESTIGE_PAYLOAD
export PRESTIGE_BUNDLE="$PWD/build/bundle"
cargo build --release --manifest-path injector/Cargo.toml
mkdir -p dist
cp -f "injector/target/release/OpenPrestigeInjector" "injector/target/release/$LIB" dist/
chmod +x dist/OpenPrestigeInjector
VERSION=$(sed -n 's/^mod_version=//p' gradle.properties)
case "$(uname -s)" in Linux) PLATFORM=linux ;; Darwin) PLATFORM=macos ;; esac
case "$(uname -m)" in x86_64) ARCH=x86_64 ;; arm64|aarch64) ARCH=aarch64 ;; *) echo 'Unsupported architecture' >&2; exit 1 ;; esac
"${PYTHON:-python3}" scripts/package_release.py offline dist "$VERSION" "$PLATFORM-$ARCH" dist/OpenPrestigeInjector "dist/$LIB" build/bundle/common.jar
echo "Done: dist contains the offline multi-version host bundle"