interplane.Get Omega
Read in your language

cortex

aien-dev/cortex

Brought by drakestapleton

branch main Branches Tags History

cortex / tests / import / omcbuild.sh

18 lines · 724 bytes Raw Blame History
1#!/bin/sh
2# omcbuild.sh OUTBIN SRC.om... : concatenate sources as one OM-2 unit (the server build prepends
3# `om2` too) and compile with the pinned omc. Fails unless compile rc is 0 and stderr is empty.
4set -u
5OMC=$(sh "$(dirname "$0")/../../tools/omc.sh") || exit 1
6out=$1; shift
7unit="$out.unit.om"
8{ echo om2; cat "$@"; } > "$unit"
9rm -f "$out"
10"$OMC" < "$unit" > "$out.tmp" 2> "$out.err"
11rc=$?
12if [ "$rc" -ne 0 ] || [ -s "$out.err" ]; then
13 echo "omcbuild: $out compile rc=$rc: $(cat "$out.err")" >&2
14 rm -f "$out.tmp"
15 exit 1
16fi
17mv "$out.tmp" "$out" && chmod +x "$out"
18echo "omcbuild: $out ok sha256=$(sha256sum "$out" | cut -d' ' -f1) unit_sha256=$(sha256sum "$unit" | cut -d' ' -f1) fns=$(grep -c '^fn ' "$unit")"