Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cortex/blob/main/build.sh # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / build.sh` 46 lines ยท 2317 bytes Raw Blame History 1 #!/bin/sh 2 # build.sh : compile the Omega Cortex server and importer with the pinned omc (PIN, tools/omc.sh). 3 # build/pincheck tools/pincheck.om, run first on `git ls-files`: a tracked file that restates 4 # the pin in PIN fails the build 5 # build/cortex server (one OM-2 unit, module order below; see spec/BUILD-CONTRACT.md) 6 # build/cortex-import cortex-rs SQLite -> Cortex log importer 7 # build/SHA256SUMS sha256 of both binaries, their units and the compiler 8 # A compile is accepted only with rc 0 and empty stderr. Exit 0 only when both builds are accepted. 9 set -u 10 if [ -z "${CXO_NICED:-}" ]; then CXO_NICED=1 exec nice -n 19 ionice -c3 sh "$0" "$@"; fi 11 R=$(cd "$(dirname "$0")" && pwd) 12 B=$R/build 13 OMC=$(sh "$R/tools/omc.sh") || exit 1 14 mkdir -p "$B" 15 { echo om2; cat "$R/tools/pincheck.om"; } > "$B/pincheck.unit.om" 16 "$OMC" < "$B/pincheck.unit.om" > "$B/pincheck.tmp" 2> "$B/pincheck.err" 17 if [ $? -ne 0 ] || [ -s "$B/pincheck.err" ]; then echo "build: pincheck FAILED: $(cat "$B/pincheck.err")" >&2; exit 1; fi 18 chmod +x "$B/pincheck.tmp" && mv "$B/pincheck.tmp" "$B/pincheck" 19 (cd "$R" && git ls-files | "$B/pincheck") || { echo "build: pincheck refused the tree (above)" >&2; exit 1; } 20 SERVER="f64 uni_rust json crc32c uni_fts flog fts like http store log api api2 api3 qs enc de brain srv main" 21 IMPORT="crc32c sqlite import_main" 22 unit() { # unit OUT MODULES... 23 out=$1; shift 24 { echo om2; for m in "$@"; do cat "$R/om/$m.om"; done; } > "$out.unit.om" 25 } 26 compile() { # compile NAME 27 rm -f "$B/$1" "$B/$1.tmp" 28 "$OMC" < "$B/$1.unit.om" > "$B/$1.tmp" 2> "$B/$1.err" 29 rc=$? 30 if [ "$rc" -ne 0 ] || [ -s "$B/$1.err" ]; then 31 echo "build: $1 FAILED rc=$rc: $(cat "$B/$1.err")" >&2 32 rm -f "$B/$1.tmp" 33 return 1 34 fi 35 chmod +x "$B/$1.tmp" && mv "$B/$1.tmp" "$B/$1" 36 echo "build: $1 ok fns=$(grep -c '^fn ' "$B/$1.unit.om")" 37 } 38 # shellcheck disable=SC2086 39 unit "$B/cortex" $SERVER 40 # shellcheck disable=SC2086 41 unit "$B/cortex-import" $IMPORT 42 compile cortex || exit 1 43 compile cortex-import || exit 1 44 (cd "$B" && sha256sum cortex cortex-import cortex.unit.om cortex-import.unit.om) > "$B/SHA256SUMS" 45 echo "omc $(sha256sum "$OMC" | cut -d' ' -f1) (omega-mv $(awk '$1 == "omega-mv" { print substr($2, 1, 8) }' "$R/PIN"), PIN)" >> "$B/SHA256SUMS" 46 cat "$B/SHA256SUMS"