#!/bin/sh set -eu cd "$(dirname "$0")/.." sh scripts/prepare-lab-default.sh scripts/cargo-local.sh build -p meshport-ffi -p meshport-vpn-helper --locked sh scripts/build-singbox-library.sh macos root="$PWD" cd apps/meshport_lab build_number=$(TZ=Asia/Tokyo date +%Y%m%d%H%M%S) flutter build macos --debug --build-number="$build_number" app="$PWD/build/macos/Build/Products/Debug/MeshPort.app" cp "$root/target/debug/libmeshport_ffi.dylib" "$app/Contents/Frameworks/" cp "$root/target/debug/libmeshport_proxy.dylib" "$app/Contents/Frameworks/" cp "$root/target/debug/meshport-vpn-helper" "$app/Contents/MacOS/" codesign --force --sign - "$app/Contents/MacOS/meshport-vpn-helper" codesign --force --sign - "$app/Contents/Frameworks/libmeshport_ffi.dylib" codesign --force --sign - "$app/Contents/Frameworks/libmeshport_proxy.dylib" codesign --force --deep --sign - --entitlements macos/Runner/DebugProfile.entitlements "$app" touch "$app" printf '%s\n' "$app"