Files
komorebi/tools/cc-fake.sh
T
LGUG2Z 2a8b71f1c9 build(tools): add the fake C compiler and mac-check.sh for the macOS type-check on Linux
macOS cannot be built or linked on the Linux host; the way to type-check it is
`cargo check --target aarch64-apple-darwin --all-targets` with a fake C compiler so the
C -sys crates' build scripts succeed. That compiler was only a scratchpad file outside the
repository and mac-check.sh hardcoded a workspace path.

tools/cc-fake.sh: verbatim copy of the scratchpad cc-fake.sh (emits an empty object for
every compile, hands -E to the real gcc). No difference.

tools/mac-check.sh: new copy of the old script with these differences:
- no hardcoded `cd /home/jado/komomono-work/ws-step4/komorebi-for-mac`: the root comes from
  `jj root` (fallback `git rev-parse --show-toplevel`);
- the fake CC is `$HERE/cc-fake.sh` (next to the script) instead of `$S/kfm/cc-fake.sh`;
- the target dir is `${FAST_CHECK_SCRATCH:-${XDG_CACHE_HOME:-$HOME/.cache}/komorebi-fast-check}/target-fast-mac`
  instead of a /tmp/claude-1000 scratchpad;
- in the merged tree (komorebi-for-kde has its own Cargo.toml only in the old layout) it checks the
  packages fast-check checks (-p komorebi -p komorebi-macos -p komorebic-macos
  -p komorebi-client-macos -p komorebi-bar-macos) from the root; with the old separate workspace it
  keeps `cd komorebi-for-mac` and --workspace;
- /bin/sh became bash with `set -euo pipefail`; the old script's omission of --locked is kept
  (pass it as an extra argument).

Verified: bash -n and shellcheck clean. Not run: the check itself needs nix and the toolchain build.
2026-11-05 15:03:26 -08:00

13 lines
415 B
Bash
Executable File

#!/usr/bin/env bash
# check-only hack: emit an empty object for every compile so C -sys build scripts "succeed"
out=""; prev=""; compile=0
for a in "$@"; do
[ "$prev" = "-o" ] && out="$a"
[ "$a" = "-c" ] && compile=1
[ "$a" = "-E" ] && { exec gcc "${@}" ; }
case "$a" in -Fo*) out="${a#-Fo}";; esac
prev="$a"
done
if [ $compile = 1 ] && [ -n "$out" ]; then exec gcc -x c -c /dev/null -o "$out"; fi
exit 0