interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / tools / bring / build.sh

39 lines · 2049 bytes Raw Blame History
1#!/bin/sh
2# tools/bring/build.sh [linux|macos|x86linux|installer|all] OUTDIR: compose units and invoke the compilers only.
3set -eu
4export LC_ALL=C
5cd "$(dirname "$0")"
6OMV=${OMV:-$HOME/work/flux/omega-mv}
7OMC=${OMC:-$OMV/seed/out/omc}
8PIN=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194
9SHA2=$OMV/om/tls/sha2.om
10SHA2PIN=5cf0f98116def6917d3a373f2bd4c3932d46e3ff84d9567bbae9e720366fdb33
11NG=${NG:-$HOME/work/hive/slop-collector/tool-scratch/ngb/ng}
12NGPIN=5ed20188ba8582f27105393d7578cbbe13a420630bd9dc50bedbf06a1443170c
13what=${1:-all}; out=${2:-out}
14mkdir -p "$out"
15sha() { 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; }
18core() { cat "$SHA2" src/10base.om src/20walk.om src/30tar.om src/35enc.om src/40net.om src/50patch.om src/90main.om; }
19case $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";;
23esac
24case $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";;
28esac
29case $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";;
36esac
37case $what in all|installer)
38 "$OMC" < installer.om > "$out/installer"; chmod 755 "$out/installer";;
39esac