cortex
aien-dev/cortex
Brought by drakestapleton
cortex / tests / import / omcbuild.sh
| 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. |
| 4 | set -u |
| 5 | OMC=$(sh "$(dirname "$0")/../../tools/omc.sh") || exit 1 |
| 6 | out=$1; shift |
| 7 | unit="$out.unit.om" |
| 8 | { echo om2; cat "$@"; } > "$unit" |
| 9 | rm -f "$out" |
| 10 | "$OMC" < "$unit" > "$out.tmp" 2> "$out.err" |
| 11 | rc=$? |
| 12 | if [ "$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 |
| 16 | fi |
| 17 | mv "$out.tmp" "$out" && chmod +x "$out" |
| 18 | echo "omcbuild: $out ok sha256=$(sha256sum "$out" | cut -d' ' -f1) unit_sha256=$(sha256sum "$unit" | cut -d' ' -f1) fns=$(grep -c '^fn ' "$unit")" |