interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tools / source-aware / build-v2

44 lines · 2538 bytes Raw Blame History
1#!/bin/bash
2# Host build orchestration only for the source-aware v2 codec (spec/universal/source-aware-v2.md).
3# Same pinned source-born seed chain as tools/source-aware/build; the v1 core and build/L574 are untouched.
4set -euo pipefail
5cd "$(dirname "$0")/../.."
6build=${SA_BUILD:-build/L832}
7case "$build" in build/L832|build/L832/*) ;; *) echo 'unsafe source-aware build path' >&2; exit 73;; esac
8case "/$build/" in */../*|*/./*|*//*) echo 'unsafe source-aware build path' >&2; exit 73;; esac
9[ ! -L build ] && [ ! -L build/L832 ] || exit 73
10if [ -d build/L832 ]; then
11 unsafe=$(find build/L832 \( -type l -o -type f -links +1 -o ! -type d ! -type f \) -print)
12 [ -z "$unsafe" ] || { echo 'unsafe source-aware build tree' >&2; exit 73; }
13fi
14mkdir -p "$build"
15# No stale success after any failed build. Test receipts are caller-owned scratch.
16rm -f "$build/PASS.json" "$build/sa" "$build/sa.tmp"
17trap 'rm -f "$build/sa.tmp"' EXIT
18seed_repo=${SA_SEED_REPO:-/home/drakestapleton/workspace/omega-bridge-native-development}
19pin=0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9
20expected=191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9
21sourcehash=8608fa11f6a2cf1c50db22d871eef16b00d5bc719bc1a222cc3e456984ac5ebf
22# A different committed repository may be used, never an untracked binary overlay.
23git -C "$seed_repo" cat-file -e "$pin^{commit}"
24[ "$(git -C "$seed_repo" show "$pin:seed/omc/omc.om" | sha256sum | cut -d' ' -f1)" = "$sourcehash" ]
25if [ ! -d "$build/toolchain" ]; then
26 mkdir "$build/toolchain"
27 git -C "$seed_repo" archive "$pin" | tar -x -C "$build/toolchain"
28fi
29# Verify the original lock and all imported seed source before every compile.
30(cd "$build/toolchain" && tools/verify-sources.sh)
31if [ ! -f "$build/toolchain/build/bootstrap/omc" ]; then
32 (cd "$build/toolchain" && tools/bootstrap.sh --offline) > "$build/bootstrap.log" 2>&1
33fi
34compiler="$build/toolchain/build/bootstrap/omc"
35[ "$(sha256sum "$compiler" | cut -d' ' -f1)" = "$expected" ]
36[ "$(sha256sum "$build/toolchain/seed/omc/omc.om" | cut -d' ' -f1)" = "$sourcehash" ]
37sh "$build/toolchain/tools/verify-elf.sh" "$compiler"
38sha256sum -c tools/source-aware/imports.sha256 > "$build/imports.log"
39cat src/source-aware/vendor/sha256.om src/source-aware/core-v2.om src/source-aware/main.om > "$build/sa.om"
40"$compiler" < "$build/sa.om" > "$build/sa.tmp"
41sh "$build/toolchain/tools/verify-elf.sh" "$build/sa.tmp"
42chmod +x "$build/sa.tmp"
43mv "$build/sa.tmp" "$build/sa"
44sha256sum "$compiler" "$build/sa.om" "$build/sa" > "$build/toolchain.sha256"