#!/bin/sh # Build the alkane-toolkit GUI on macOS as one universal binary. # # scripts/build-gui-macos.sh [extra cargo build args] # -> target/universal-apple-darwin/release/alkane-toolkit (arm64 + x86_64) # # Needs the Xcode Command Line Tools, rustup with the aarch64-apple-darwin and # x86_64-apple-darwin targets, and the universal static wx prefix from # scripts/build-wx-macos.sh (WX_MACOS_PREFIX, default ~/.cache/wx-3.3.3-macos). # Each target is built separately against that prefix, then the two slices # are merged with lipo. MACOSX_DEPLOYMENT_TARGET matches the wx build. set -e cd "$(dirname -- "$0")/.." PREFIX="${WX_MACOS_PREFIX:-$HOME/.cache/wx-3.3.3-macos}" [ -x "$PREFIX/bin/wx-config" ] || { echo "no wx prefix at $PREFIX; run scripts/build-wx-macos.sh first" >&2; exit 1; } export WX_RS_WXCONFIG="$PREFIX/bin/wx-config" export MACOSX_DEPLOYMENT_TARGET="${MACOSX_MIN:-11.0}" for target in aarch64-apple-darwin x86_64-apple-darwin; do cargo build --release --offline --locked -p alkane-gui --target "$target" "$@" done out=target/universal-apple-darwin/release mkdir -p "$out" lipo -create -output "$out/alkane-toolkit" \ target/aarch64-apple-darwin/release/alkane-toolkit \ target/x86_64-apple-darwin/release/alkane-toolkit lipo -info "$out/alkane-toolkit" echo "binary: $out/alkane-toolkit"