mirror of
https://github.com/feigeCode/navop.git
synced 2026-09-22 08:01:27 +00:00
51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
APP_NAME="Navop"
|
|
BINARY_NAME="navop"
|
|
TARGET="${1:-aarch64-apple-darwin}"
|
|
VERSION="${ONETCLI_VERSION:-0.1.0}"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
APP_DIR="${PROJECT_DIR}/target/${APP_NAME}.app"
|
|
|
|
echo "Bundling ${APP_NAME}.app for ${TARGET} (version: ${VERSION})..."
|
|
|
|
# Clean previous bundle
|
|
rm -rf "$APP_DIR"
|
|
|
|
# Create .app directory structure
|
|
mkdir -p "$APP_DIR/Contents/MacOS"
|
|
mkdir -p "$APP_DIR/Contents/Resources"
|
|
|
|
# Copy binary
|
|
BINARY_PATH="${PROJECT_DIR}/target/${TARGET}/release/${BINARY_NAME}"
|
|
if [ ! -f "$BINARY_PATH" ]; then
|
|
echo "Error: Binary not found at ${BINARY_PATH}"
|
|
echo "Run: cargo build --release -p main --target ${TARGET}"
|
|
exit 1
|
|
fi
|
|
cp "$BINARY_PATH" "$APP_DIR/Contents/MacOS/${BINARY_NAME}"
|
|
|
|
# Copy Info.plist and substitute version
|
|
sed "s/\${ONETCLI_VERSION}/${VERSION}/g" \
|
|
"${PROJECT_DIR}/resources/macos/Info.plist" \
|
|
> "$APP_DIR/Contents/Info.plist"
|
|
|
|
# Copy icon
|
|
ICNS_PATH="${PROJECT_DIR}/resources/macos/Navop.icns"
|
|
if [ ! -f "$ICNS_PATH" ]; then
|
|
echo "Error: Icon file not found at ${ICNS_PATH}"
|
|
exit 1
|
|
fi
|
|
cp "$ICNS_PATH" "$APP_DIR/Contents/Resources/Navop.icns"
|
|
|
|
# Write PkgInfo
|
|
echo -n "APPL????" > "$APP_DIR/Contents/PkgInfo"
|
|
|
|
echo "Successfully built: ${APP_DIR}"
|
|
echo "Contents:"
|
|
ls -la "$APP_DIR/Contents/"
|
|
ls -la "$APP_DIR/Contents/MacOS/"
|
|
ls -la "$APP_DIR/Contents/Resources/"
|