interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / tools / bring / build.sh
| 1 | #!/bin/sh |
| 2 | # tools/bring/build.sh [linux|macos|x86linux|installer|all] OUTDIR: compose units and invoke the compilers only. |
| 3 | set -eu |
| 4 | export LC_ALL=C |
| 5 | cd "$(dirname "$0")" |
| 6 | OMV=${OMV:-$HOME/work/flux/omega-mv} |
| 7 | OMC=${OMC:-$OMV/seed/out/omc} |
| 8 | PIN=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194 |
| 9 | SHA2=$OMV/om/tls/sha2.om |
| 10 | SHA2PIN=5cf0f98116def6917d3a373f2bd4c3932d46e3ff84d9567bbae9e720366fdb33 |
| 11 | NG=${NG:-$HOME/work/hive/slop-collector/tool-scratch/ngb/ng} |
| 12 | NGPIN=5ed20188ba8582f27105393d7578cbbe13a420630bd9dc50bedbf06a1443170c |
| 13 | what=${1:-all}; out=${2:-out} |
| 14 | mkdir -p "$out" |
| 15 | sha() { sha256sum "$1" | cut -d" " -f1; } |
| 16 | [ "$(sha "$OMC")" = "$PIN" ] || { echo "build.sh: omc is not the pin" >&2; exit 2; } |
| 17 | [ "$(sha "$SHA2")" = "$SHA2PIN" ] || { echo "build.sh: sha2.om is not the pin" >&2; exit 2; } |
| 18 | core() { cat "$SHA2" src/10base.om src/20walk.om src/30tar.om src/35enc.om src/40net.om src/50patch.om src/90main.om; } |
| 19 | case $what in all|linux) |
| 20 | { echo om2; core; cat src/plat-linux.om src/arch-a64.om; } > "$out/interplane-linux-aarch64.om" |
| 21 | "$OMC" < "$out/interplane-linux-aarch64.om" > "$out/interplane-linux-aarch64" |
| 22 | chmod 755 "$out/interplane-linux-aarch64";; |
| 23 | esac |
| 24 | case $what in all|x86linux) |
| 25 | { echo "target x86linux"; echo om2; core; cat src/plat-linux.om src/arch-x86.om; } > "$out/interplane-linux-x86_64.om" |
| 26 | "$OMC" < "$out/interplane-linux-x86_64.om" > "$out/interplane-linux-x86_64" |
| 27 | chmod 755 "$out/interplane-linux-x86_64";; |
| 28 | esac |
| 29 | case $what in all|macos) |
| 30 | [ "$(sha "$NG")" = "$NGPIN" ] || { echo "build.sh: ng is not the pin" >&2; exit 2; } |
| 31 | { echo "target macos"; echo om2; core; cat src/plat-macos.om; } > "$out/interplane-macos-arm64.om" |
| 32 | { printf "@ng front-ir\n"; cat "$out/interplane-macos-arm64.om"; } | "$NG" > "$out/m.ir" |
| 33 | { printf "@ng opt\n"; cat "$out/m.ir"; } | "$NG" > "$out/m.o.ir" |
| 34 | { printf "@ng a64 macho\n"; cat "$out/m.o.ir"; } | "$NG" > "$out/interplane-macos-arm64" |
| 35 | rm -f "$out/m.ir" "$out/m.o.ir";; |
| 36 | esac |
| 37 | case $what in all|installer) |
| 38 | "$OMC" < installer.om > "$out/installer"; chmod 755 "$out/installer";; |
| 39 | esac |