omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / trit / build.sh
| 1 | #!/bin/sh |
| 2 | # build.sh -- compile tools/trit/trit.om with the seeded omc, after the seeded SHA-256 core. |
| 3 | # Run from the repo root: sh tools/trit/build.sh (OMC defaults to seed/out/omc) |
| 4 | # The composition mirrors seed/omega-from-seed.sh step 5 (diaggen): om2 line, the sha256.om core |
| 5 | # up to "fn sha256", then the program. Prints the sha256 of the composed source and the binary. |
| 6 | set -eu |
| 7 | R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 8 | cd "$R" |
| 9 | OMC=${OMC:-seed/out/omc} |
| 10 | B=${B:-build/trit} |
| 11 | mkdir -p "$B" |
| 12 | # omc refuses an `abstract` line after any `fn` (error 9), and the core ends in functions, so the |
| 13 | # trit type line is lifted ahead of the core. |
| 14 | { printf 'om2\n'; grep '^abstract ' tools/codebook/codebook.om; sed '/^fn sha256 /,$d' seed/trace/sha256.om; grep -v '^abstract ' tools/codebook/codebook.om; cat tools/trit/trit.om; } > "$B/trit.full.om" |
| 15 | "$OMC" < "$B/trit.full.om" > "$B/trit" |
| 16 | chmod +x "$B/trit" |
| 17 | sha256sum "$OMC" tools/codebook/codebook.om tools/trit/trit.om "$B/trit.full.om" "$B/trit" |