Files
komorebi/e2e/platforms/tart_macos/build-bins.sh
T
LGUG2Z fa2742a75d feat(e2e): scripts that build the golden image of the macOS guest and its programs
build-golden.sh makes the golden Tart image from a vanilla one of Cirrus Labs: it provisions the
guest over SSH (provision.sh: the agent starts at login from a Terminal window, no state of earlier
runs is left, Terminal does not reopen old windows), stops for the one step that cannot be
scripted (a person allows Screen Recording and Accessibility for Terminal, once, and the grants live
in every clone), checks that the agent answers, and shuts the guest down from inside, so that
the last writes are on the disk the clones copy. build-bins.sh builds the programs under test for
the host and points the libiconv of the nix store at the system's, as the nix package does.
2026-11-06 14:40:50 -08:00

37 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# Builds the programs the macOS guest runs and puts them in BIN_DIR, ready to upload:
#
# build-bins.sh BIN_DIR [cargo args, e.g. --release]
#
# komorebi, komorebic, the test window and the agent, built for the host (the guest is the same
# architecture). A build in the dev shell of the flake links the libiconv of the nix store, which the
# guest does not have, so the library is pointed at the system's, as the nix package does, and the
# programs are signed again, as the system asks of a changed one.
set -eu
bin_dir=${1:?usage: build-bins.sh BIN_DIR [cargo args]}
shift
root=$(cd "$(dirname "$0")/../../.." && pwd)
cd "$root"
# the default dev shell builds for Windows: this is for the host
unset CARGO_BUILD_TARGET
profile=debug
case " $* " in *" --release "*) profile=release ;; esac
COMMIT_HASH=${COMMIT_HASH:-$(git rev-parse HEAD 2>/dev/null || echo dev)} \
cargo build --locked -p komorebi -p komorebic -p komorebi-testwin -p komorebi-e2e-agent "$@"
mkdir -p "$bin_dir"
for bin in komorebi komorebic komorebi-testwin komorebi-e2e-agent; do
rm -f "$bin_dir/$bin"
cp "target/$profile/$bin" "$bin_dir/$bin"
chmod u+w "$bin_dir/$bin"
for lib in $(otool -L "$bin_dir/$bin" | grep -o '/nix/store/[^ ]*' || true); do
install_name_tool -change "$lib" "/usr/lib/$(basename "$lib" | sed 's/\.[0-9.]*dylib/.dylib/')" "$bin_dir/$bin"
done
codesign -f -s - "$bin_dir/$bin" 2>/dev/null
done
git rev-parse HEAD > "$bin_dir/commit" 2>/dev/null || true
echo "build-bins: $bin_dir"