32 lines
1.4 KiB
Bash
Executable File
32 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Native macOS build and app bundle. No Docker, mirror configuration, or tests.
|
|
set -eu
|
|
if [ "$(uname -s)" != Darwin ]; then
|
|
echo "Build this app bundle on macOS." >&2
|
|
exit 1
|
|
fi
|
|
cd "$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
|
cargo build --release --locked "$@"
|
|
version=$(awk -F '"' '$1 ~ /^version[[:space:]]*=/ { print $2; exit }' Cargo.toml)
|
|
test -n "$version"
|
|
bundle="$(pwd)/target/release/Tessera.app"
|
|
mkdir -p "$bundle/Contents/MacOS"
|
|
cp target/release/tessera "$bundle/Contents/MacOS/tessera.new"
|
|
mv -f "$bundle/Contents/MacOS/tessera.new" "$bundle/Contents/MacOS/tessera"
|
|
cat > "$bundle/Contents/Info.plist.new" <<PLIST
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0"><dict>
|
|
<key>CFBundleIdentifier</key><string>com.entroia.tessera</string>
|
|
<key>CFBundleName</key><string>Tessera</string>
|
|
<key>CFBundleDisplayName</key><string>Tessera</string>
|
|
<key>CFBundleExecutable</key><string>tessera</string>
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
<key>CFBundleShortVersionString</key><string>$version</string>
|
|
<key>CFBundleVersion</key><string>$version</string>
|
|
<key>NSHighResolutionCapable</key><true/>
|
|
</dict></plist>
|
|
PLIST
|
|
mv -f "$bundle/Contents/Info.plist.new" "$bundle/Contents/Info.plist"
|
|
printf '%s\n' "$bundle"
|