just build no longer builds tcc: use $TCC, an already-built vendored tcc, or tcc on PATH
CI / test (push) Failing after 35s
CI / test (push) Failing after 35s
scripts/tcc/tcc resolves the compiler (and errors with how to get one if none exists); tcc-build stays as an optional recipe. bench no longer depends on it either. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1bbdf58372
commit
92d2b29889
3 files changed
+23
-8
No files matched your search
@@ -12,7 +12,7 @@ tcc := justfile_directory() + "/scripts/tcc/tcc"
|
|||||||
default:
|
default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
# Build the vendored tinycc (third_party/tinycc) into _build/tcc, once.
|
# Build the vendored tinycc (third_party/tinycc) into _build/tcc, once. Optional: `just build` uses any tcc it can find.
|
||||||
tcc-build:
|
tcc-build:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -30,8 +30,9 @@ tcc-build:
|
|||||||
modules:
|
modules:
|
||||||
scripts/build-modules.sh
|
scripts/build-modules.sh
|
||||||
|
|
||||||
# Debug build of the native compositor, compiled and linked with the vendored tcc.
|
# Debug build of the native compositor, compiled and linked with tcc ($TCC, the vendored build if present, or tcc on PATH). Never builds tcc itself.
|
||||||
build: tcc-build
|
build:
|
||||||
|
@{{tcc}} --which >/dev/null
|
||||||
MOON_CC={{tcc}} MOON_STUB_CC={{tcc}} moon build --target native --warn-list -a compositor/bin
|
MOON_CC={{tcc}} MOON_STUB_CC={{tcc}} moon build --target native --warn-list -a compositor/bin
|
||||||
|
|
||||||
# Optimised build with the system C compiler (slower to build, faster to run).
|
# Optimised build with the system C compiler (slower to build, faster to run).
|
||||||
@@ -101,7 +102,7 @@ view: build modules
|
|||||||
xdg-open _build/desktop.png
|
xdg-open _build/desktop.png
|
||||||
|
|
||||||
# Time the native build (cold / warm / one-file edit), tcc vs system cc, on a temp copy: `just bench 5` or `just bench 3 "tcc cc cc-release"`.
|
# Time the native build (cold / warm / one-file edit), tcc vs system cc, on a temp copy: `just bench 5` or `just bench 3 "tcc cc cc-release"`.
|
||||||
bench runs="3" configs="tcc cc": tcc-build
|
bench runs="3" configs="tcc cc":
|
||||||
scripts/bench-build.sh {{runs}} "{{configs}}"
|
scripts/bench-build.sh {{runs}} "{{configs}}"
|
||||||
|
|
||||||
# Delete build output (compiled compositor, wasm modules, rendered frames) but keep the built tinycc in _build/tcc.
|
# Delete build output (compiled compositor, wasm modules, rendered frames) but keep the built tinycc in _build/tcc.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# incr rebuild after touching one source file (compositor/shell/shell.mbt, then lib/ui/ui.mbt)
|
# incr rebuild after touching one source file (compositor/shell/shell.mbt, then lib/ui/ui.mbt)
|
||||||
# Runs on a throwaway copy of the sources with its own target dir, so it never touches your
|
# Runs on a throwaway copy of the sources with its own target dir, so it never touches your
|
||||||
# _build/ or the files other people are editing. The tcc configs use the repo's vendored tinycc
|
# _build/ or the files other people are editing. The tcc configs use the repo's vendored tinycc
|
||||||
# (run `just tcc-build` first; its own one-time build is not part of these numbers).
|
# (any tcc scripts/tcc/tcc can find; see that script).
|
||||||
#
|
#
|
||||||
# scripts/bench-build.sh [runs=3] ["tcc cc cc-release"]
|
# scripts/bench-build.sh [runs=3] ["tcc cc cc-release"]
|
||||||
# tcc debug build, compiled and linked with the vendored tinycc (what `just build` does)
|
# tcc debug build, compiled and linked with the vendored tinycc (what `just build` does)
|
||||||
@@ -17,7 +17,7 @@ export PATH="$HOME/.moon/bin:$PATH"
|
|||||||
runs="${1:-3}"
|
runs="${1:-3}"
|
||||||
configs="${2:-tcc cc}"
|
configs="${2:-tcc cc}"
|
||||||
command -v moon >/dev/null || { echo "error: moon not found" >&2; exit 1; }
|
command -v moon >/dev/null || { echo "error: moon not found" >&2; exit 1; }
|
||||||
[ -x "$ROOT/_build/tcc/bin/tcc" ] || [ "$configs" = "cc" ] || { echo "error: run 'just tcc-build' first" >&2; exit 1; }
|
case " $configs " in *" tcc "*) "$ROOT/scripts/tcc/tcc" --which >/dev/null || exit 1 ;; esac
|
||||||
|
|
||||||
work="$(mktemp -d)"
|
work="$(mktemp -d)"
|
||||||
trap 'rm -rf "$work"' EXIT
|
trap 'rm -rf "$work"' EXIT
|
||||||
|
|||||||
+16
-2
@@ -1,12 +1,26 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# moon's C compiler/linker driver for debug builds: the vendored tinycc
|
# moon's C compiler/linker driver for debug builds. It never builds tcc; it uses one that exists:
|
||||||
# (third_party/tinycc, built by `just tcc` into _build/tcc).
|
# 1. $TCC, if set
|
||||||
|
# 2. the vendored tinycc, if already built (`just tcc-build` puts it in _build/tcc)
|
||||||
|
# 3. `tcc` on PATH (e.g. from `pixi install`, see pixi.toml)
|
||||||
|
# scripts/tcc/tcc --which prints the tcc it would use (exit 1 if none)
|
||||||
# moon adds -DMOONBIT_NATIVE_NO_SYS_HEADER whenever the compiler is tcc; that
|
# moon adds -DMOONBIT_NATIVE_NO_SYS_HEADER whenever the compiler is tcc; that
|
||||||
# mode compiles the system parts of the runtime out (it expects to be JIT-ed
|
# mode compiles the system parts of the runtime out (it expects to be JIT-ed
|
||||||
# inside moon), so a standalone executable would not link. Drop it.
|
# inside moon), so a standalone executable would not link. Drop it.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
if [ -n "${TCC:-}" ]; then
|
||||||
|
tcc="$TCC"
|
||||||
|
elif [ -x "$root/_build/tcc/bin/tcc" ]; then
|
||||||
tcc="$root/_build/tcc/bin/tcc"
|
tcc="$root/_build/tcc/bin/tcc"
|
||||||
|
elif tcc="$(command -v tcc)"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "error: no tcc found. Install one (pixi install, or your package manager), set TCC=/path/to/tcc," >&2
|
||||||
|
echo " or build the vendored one with: just tcc-build" >&2
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
if [ "${1:-}" = "--which" ]; then echo "$tcc"; exit 0; fi
|
||||||
args=()
|
args=()
|
||||||
for a in "$@"; do
|
for a in "$@"; do
|
||||||
[ "$a" = "-DMOONBIT_NATIVE_NO_SYS_HEADER" ] || args+=("$a")
|
[ "$a" = "-DMOONBIT_NATIVE_NO_SYS_HEADER" ] || args+=("$a")
|
||||||
|
|||||||
Reference in new issue
Block a user