Files
sausage/userland/brush/build.nu
T
surma 57a47b069e host: process table, shell, coreutils and harness (T8, T9)
T8: sausage:process WIT (spawn, wait, kill), one store per process over the
shared root, /proc/processes, /run, pipeline and cancellation groups, Exec.
brush and 78 uutils commands; the shared cwd-init object sets the cwd from PWD
and keeps numeric exit codes. The corpus matches native bash.

T9: V8 (deno_core) runs pi-durable, pi-ai and chord; SQLite storage in
<dir>/host/harness.sqlite (WAL, synchronous=FULL); file tools on the VFS, bash
through Exec; resumes after SIGKILL.
2026-11-06 16:34:34 +00:00

39 lines
2.2 KiB
Nu

#!/usr/bin/env nu
# Build the pinned brush source with only its WASI launcher seam replaced.
def copy-if-changed [source: path, destination: path] {
if not ($destination | path exists) or (open --raw $source) != (open --raw $destination) {
cp $source $destination
}
}
def main [] {
let here = $env.FILE_PWD
let source = ($here | path join source)
let revision = '943553433ae04f5b3bd55d2cf207e39eb9ef2af7'
if not ($source | path exists) {
^git clone --no-checkout https://github.com/reubeno/brush $source
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'brush clone failed'} }
^git -C $source checkout $revision
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'brush checkout failed'} }
}
if (^git -C $source rev-parse HEAD | str trim) != $revision { error make {msg: 'unexpected brush revision'} }
let core = ($source | path join brush-core)
copy-if-changed ($here | path join process.rs) ($core | path join src sys wasm process.rs)
mkdir ($core | path join sausage-process)
let wit = ($here | path join .. .. host wit | path expand)
copy-if-changed ($wit | path join process.wit) ($core | path join sausage-process process.wit)
mkdir ($core | path join sausage-process deps)
copy-if-changed ($wit | path join deps io.wit) ($core | path join sausage-process deps io.wit)
let manifest = ($core | path join Cargo.toml)
let text = (open --raw $manifest)
let marker = "[target.'cfg(target_family = \"wasm\")'.dependencies]"
if not ($text | str contains 'wit-bindgen =') {
$text | str replace $marker ($marker + "\nwit-bindgen = \"0.46\"") | save -f $manifest
}
copy-if-changed ($here | path join Cargo.lock) ($source | path join Cargo.lock)
$env.SAUSAGE_CWD_INIT = ($here | path join .. cwd-init init.o | path expand)
$env.CARGO_TARGET_WASM32_WASIP2_LINKER = ($here | path join .. cwd-init link.nu | path expand)
$env.CARGO_TARGET_WASM32_WASIP2_RUSTFLAGS = '-C link-arg=sausage-cwd-init'
^cargo build --manifest-path ($source | path join Cargo.toml) -p brush-shell --release --features minimal --no-default-features --target wasm32-wasip2 --locked
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'brush build failed'} }
}