Close the 3 gaps between "builds in the repo" and "installs from a tarball
like Go", so writeonce can ship to other developers.
- VERSION file at repo root single-sources the toolchain version (0.1.0).
- `woc version` -> "writeonce 0.1.0 linux/amd64"; `wovm --version` -> "wovm
0.1.0" (stamped by the Makefile from VERSION; --version handled only in the
plain-wovm path so a built app never shadows its own `version` arg).
- wo.toml `[runtime] wo = ">= X.Y"` is now ENFORCED: woc refuses a project
requiring a newer toolchain than itself (>= and bare version parsed;
unknown operators accepted forward-compatibly). Was parsed-and-ignored.
- woc self-locates wovm: --runtime > [build] runtime > $WO_RUNTIME > a `wovm`
beside the woc binary (Sys.executable_name) > runtime/wovm rel CWD. An
installed woc in <prefix>/bin finds its sibling wovm from any cwd.
- `just dist` (scripts/mkdist.sh) packages writeonce-<ver>-linux-amd64.tar.gz,
Go-shaped (archive root writeonce/, bin/{woc,wovm}, README, VERSION), with a
drift guard asserting VERSION == woc == wovm. dist/ gitignored.
- `just install-accept` (scripts/install-accept.sh) is the gate: extract, PATH,
version, build+run a project from an unrelated cwd, constraint refusal — 6/0.
Verified: install-accept 6/0; woc-test 565/0; wovm suites + cli_smoke;
log-watcher 7/0. Linux-amd64 only (a cross matrix is future work).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
43 lines
1.6 KiB
Bash
Executable file
43 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# scripts/mkdist.sh — package the writeonce toolchain as an installable tarball,
|
|
# Go-style. Archive root is `writeonce/` (version-less, like Go's `go/`), so
|
|
# `tar -C /usr/local -xzf ...` drops it at /usr/local/writeonce. Builds both
|
|
# release binaries, asserts VERSION == `woc version` == `wovm --version` (drift
|
|
# guard), stages an install README, and emits dist/<name>.tar.gz + a sha256.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
ver="$(cat VERSION)"
|
|
triple="linux-amd64" # the only target today; a cross matrix is future work
|
|
name="writeonce-${ver}-${triple}"
|
|
|
|
# release binaries
|
|
dune build --root compiler
|
|
make -C runtime wovm >/dev/null
|
|
|
|
woc="compiler/_build/default/bin/woc"
|
|
wovm="runtime/wovm"
|
|
|
|
# drift guard: the three version sources must agree, else the tarball would ship
|
|
# a `wo >= X` constraint nobody can honor
|
|
got_woc="$("$woc" version | awk '{print $2}')"
|
|
got_vm="$("$wovm" --version | awk '{print $2}')"
|
|
[[ "$got_woc" == "$ver" ]] || { echo "mkdist: woc reports $got_woc but VERSION says $ver" >&2; exit 1; }
|
|
[[ "$got_vm" == "$ver" ]] || { echo "mkdist: wovm reports $got_vm but VERSION says $ver" >&2; exit 1; }
|
|
|
|
stage="dist/writeonce"
|
|
rm -rf "$stage"
|
|
mkdir -p "$stage/bin"
|
|
install -m 0755 "$woc" "$stage/bin/woc"
|
|
install -m 0755 "$wovm" "$stage/bin/wovm"
|
|
cp VERSION "$stage/VERSION"
|
|
sed "s/@VER@/$ver/g; s/@TRIPLE@/$triple/g" scripts/install-readme.tmpl.md > "$stage/README.md"
|
|
|
|
tar -C dist -czf "dist/${name}.tar.gz" writeonce
|
|
rm -rf "$stage"
|
|
( cd dist && sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256" )
|
|
|
|
echo "built dist/${name}.tar.gz"
|
|
cat "dist/${name}.tar.gz.sha256"
|