
louise
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#1197 · main · 10 min 35 s
1Étoiles
0Forks
0Issues
| 1 | #!/usr/bin/env bash |
| 2 | # Build louise_rt as a staticlib and run the M0 ABI spike against it. |
| 3 | # Usage: scripts/spike.sh [--release] [--asan] |
| 4 | set -euo pipefail |
| 5 | |
| 6 | root="$(cd "$(dirname "$0")/.." && pwd)" |
| 7 | profile=debug cargo_flags=() cflags=(-O2) target="$root/target" |
| 8 | for arg in "$@"; do |
| 9 | case "$arg" in |
| 10 | --release) profile=release cargo_flags+=(--release) ;; |
| 11 | --asan) |
| 12 | cflags=(-O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer) |
| 13 | # ASan sees only the system allocator's blocks: build the runtime |
| 14 | # without mimalloc, apart from the usual one. |
| 15 | target="$root/target/sanitize" |
| 16 | cargo_flags+=(--no-default-features --features stats --target-dir "$target") ;; |
| 17 | *) echo "unknown flag: $arg" >&2; exit 64 ;; |
| 18 | esac |
| 19 | done |
| 20 | |
| 21 | # CARGO_TARGET_DIR relocates the build (ci.sh isolates the release |
| 22 | # spike's and sweeps it: peak disk on a bounded runner store). --asan |
| 23 | # already has its own. |
| 24 | if [ -n "${CARGO_TARGET_DIR:-}" ] && [ "$target" = "$root/target" ]; then |
| 25 | case "$CARGO_TARGET_DIR" in |
| 26 | /*) target="$CARGO_TARGET_DIR" ;; |
| 27 | *) target="$root/$CARGO_TARGET_DIR" ;; |
| 28 | esac |
| 29 | cargo_flags+=(--target-dir "$target") |
| 30 | fi |
| 31 | |
| 32 | cargo build --quiet -p louise_rt "${cargo_flags[@]}" --manifest-path "$root/Cargo.toml" |
| 33 | mkdir -p "$root/build" |
| 34 | cc="${CC:-cc}" |
| 35 | [[ " ${cflags[*]} " == *sanitize* && -z "${CC:-}" ]] && cc=clang # gcc often lacks libasan |
| 36 | "$cc" -std=c11 -Wall -Wextra -Werror "${cflags[@]}" \ |
| 37 | -I "$root/runtime/louise_rt/include" \ |
| 38 | "$root/runtime/spike/spike.c" "$target/$profile/liblouise_rt.a" \ |
| 39 | -lpthread -ldl -lm -o "$root/build/spike" |
| 40 | "$root/build/spike" |