#!/bin/sh # Native macOS build and app bundle. No Docker, mirror configuration, or tests. set -eu # 此入口只能在 macOS 使用;构建授权由调用方确认,脚本不自动执行测试或部署。 if [ "$(uname -s)" != Darwin ]; then echo "Build this app bundle on macOS." >&2 exit 1 fi cd "$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)" # 锁定依赖并生成 release 可执行文件;附加参数原样交给 Cargo。 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" # 先写临时文件再重命名,避免复制途中将半个二进制留作 bundle 的主程序。 cp target/release/tessera "$bundle/Contents/MacOS/tessera.new" mv -f "$bundle/Contents/MacOS/tessera.new" "$bundle/Contents/MacOS/tessera" # 生成最小 macOS bundle 元数据;应用名、入口与高分辨率标志供系统启动/显示使用。 cat > "$bundle/Contents/Info.plist.new" < CFBundleIdentifiercom.entroia.tessera CFBundleNameTessera CFBundleDisplayNameTessera CFBundleExecutabletessera CFBundlePackageTypeAPPL CFBundleShortVersionString$version CFBundleVersion$version NSHighResolutionCapable PLIST mv -f "$bundle/Contents/Info.plist.new" "$bundle/Contents/Info.plist" printf '%s\n' "$bundle"