babel
aien-dev/babel
Brought by drakestapleton
babel / build.sh
| 1 | #!/bin/sh |
| 2 | # Build build/babel from src/*.om with the pinned OM-2 compiler. |
| 3 | # usage: OMEGA_MV=<aien-dev/omega-mv clone> ./build.sh |
| 4 | # Pins (aien-dev/omega-mv 0b77e6ea2, both Apache-2.0): |
| 5 | # omc = seed/out/omc sha256 2c824805...029f |
| 6 | # sha256 unit = om/sha256/sha256-om2.om sha256 dbf002dd...94bb (FIPS 180-4 SHA-256 in OM-2) |
| 7 | set -eu |
| 8 | : "${OMEGA_MV:?set OMEGA_MV to an aien-dev/omega-mv clone}" |
| 9 | cd "$(dirname "$0")" |
| 10 | mkdir -p build |
| 11 | git -C "$OMEGA_MV" show 0b77e6ea2:seed/out/omc > build/omc |
| 12 | git -C "$OMEGA_MV" show 0b77e6ea2:om/sha256/sha256-om2.om > build/sha256-om2.om |
| 13 | sha256sum -c - <<EOF |
| 14 | 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f build/omc |
| 15 | dbf002dd6aa36585632b9d01d98ac3f0bd2fa0f0475082940de53638847994bb build/sha256-om2.om |
| 16 | EOF |
| 17 | chmod +x build/omc |
| 18 | # sha256-om2.om carries the `om2` header line, so it goes first. Its four `export fn` entries are |
| 19 | # library-mode markers, refused next to `fn main` (error 9); babel calls them as ordinary functions, |
| 20 | # so the marker is dropped and nothing else in the unit changes. |
| 21 | { sed 's/^export fn /fn /' build/sha256-om2.om; cat src/*.om; } > build/babel.om |
| 22 | build/omc < build/babel.om > build/babel |
| 23 | chmod +x build/babel |
| 24 | sha256sum build/babel |