interplane.Get Omega
Read in your language

omega-dnn

aien-dev/omega-dnn

Brought by drakestapleton

branch main Branches Tags History

omega-dnn / tools / build.sh

26 lines · 1436 bytes Raw Blame History
1#!/bin/sh
2# Build build/libomega_native.so + bindings from om/dnn.om with the pinned compilers and omega-bridge.
3# Usage: tools/build.sh (fetches the pins into .deps/ when OMEGA_MV / OMEGA_BRIDGE are unset)
4# OMEGA_MV=<omega-mv clone> OMEGA_BRIDGE=<omega-bridge clone> tools/build.sh
5# The pins (parent omega-mv, bridge ABI v2) are in PINS; a compiler whose sha256 differs is refused.
6set -eu
7ROOT=$(cd "$(dirname "$0")/.." && pwd)
8. "$ROOT/PINS"
9DEPS=$ROOT/.deps
10fetch() { # repo sha dir
11 [ -d "$3/.git" ] || git clone -q --filter=blob:none --no-checkout "https://github.com/aien-dev/$1" "$3"
12 git -C "$3" fetch -q origin "$2" 2>/dev/null || git -C "$3" fetch -q origin
13 git -C "$3" checkout -q "$2"
14}
15if [ -z "${OMEGA_MV:-}" ]; then OMEGA_MV=$DEPS/omega-mv; fetch omega-mv "$OMEGA_MV_SHA" "$OMEGA_MV"; fi
16if [ -z "${OMEGA_BRIDGE:-}" ]; then OMEGA_BRIDGE=$DEPS/omega-bridge; fetch omega-bridge "$OMEGA_BRIDGE_SHA" "$OMEGA_BRIDGE"; fi
17OMC1=$OMEGA_MV/evidence/SEED-0/omc/omc.elf
18OMC2=$OMEGA_MV/seed/out/omc
19chmod +x "$OMC1" "$OMC2"
20check() { got=$(sha256sum < "$1" | cut -d' ' -f1); [ "$got" = "$2" ] || { echo "build.sh: $1 sha256 $got, pinned $2" >&2; exit 1; }; }
21check "$OMC1" "$OMC1_SHA256"
22check "$OMC2" "$OMC2_SHA256"
23SRC=${OMEGA_DNN_SRC:-$ROOT/om/dnn.om}
24OUT=${OMEGA_DNN_OUT:-$ROOT/build}
25"$OMC2" < "$SRC" > /dev/null
26OMEGA_NATIVE_OMC=$OMC1 OMEGA_NATIVE_OMC2=$OMC2 "$OMEGA_BRIDGE/tools/native" "$OUT" "$SRC"