interplane.Get Omega
Read in your language

aien

aien-dev/aien

Brought by drakestapleton

branch main Branches Tags History

aien / scripts / goal_microjobs / build.sh

45 lines · 2147 bytes Raw Blame History
1#!/usr/bin/env bash
2# SPDX-License-Identifier: AGPL-3.0-or-later
3# Build the Allen #13 microjob kernel with the pinned seeded Omega compiler.
4# Usage: OMEGA_WORKTREE=... build.sh [SOURCE.om] [OUTPUT]
5set -euo pipefail
6
7repo=$(cd "$(dirname "$0")/../.." && pwd)
8: "${OMEGA_WORKTREE:?Set OMEGA_WORKTREE to the isolated seeded-Omega compiler worktree}"
9
10# Same pins as scripts/harness_evolution/gate.sh on feat/harness-evolution-alpha (Allen #12).
11omega_pin=c434565c67552c0b01df2d7f76c1a04287c70560
12compiler_pin=191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9
13seed_source_pin=8608fa11f6a2cf1c50db22d871eef16b00d5bc719bc1a222cc3e456984ac5ebf
14
15compiler="$OMEGA_WORKTREE/build/L574/toolchain/build/bootstrap/omc"
16verify_elf="$OMEGA_WORKTREE/build/L574/toolchain/tools/verify-elf.sh"
17blocked() { printf 'BLOCKED: %s\n' "$*" >&2; exit 3; }
18test "$(git -C "$OMEGA_WORKTREE" rev-parse HEAD)" = "$omega_pin" ||
19 blocked "Omega checkout must be $omega_pin"
20# This historical toolchain was an untracked build artifact, not part of the
21# Omega commit. A fresh clone alone cannot supply it. Never substitute a newer
22# compiler or run an unchecked binary.
23test -x "$compiler" && test -f "$verify_elf" &&
24 test -f "$OMEGA_WORKTREE/build/L574/toolchain/seed/omc/omc.om" ||
25 blocked "missing historical build/L574/toolchain artifacts; obtain the archived toolchain listed in docs/GOAL_MICROJOBS.md"
26test "$(sha256sum "$compiler" | cut -d' ' -f1)" = "$compiler_pin" ||
27 blocked "historical compiler digest differs from $compiler_pin"
28test "$(sha256sum "$OMEGA_WORKTREE/build/L574/toolchain/seed/omc/omc.om" | cut -d' ' -f1)" = "$seed_source_pin" ||
29 blocked "historical compiler source digest differs from $seed_source_pin"
30
31src=${1:-"$repo/src/goal_microjobs/kernel.om"}
32out=${2:-"${GM_BUILD_DIR:-$repo/target/goal_microjobs}/kernel"}
33mkdir -p "$(dirname "$out")"
34tmp="$out.tmp.$$"
35if ! "$compiler" < "$src" > "$tmp" 2> "$tmp.stderr"; then
36 cat "$tmp.stderr" >&2
37 rm -f "$tmp" "$tmp.stderr"
38 echo 'seeded .om compile failed' >&2
39 exit 65
40fi
41rm -f "$tmp.stderr"
42sh "$verify_elf" "$tmp"
43chmod 700 "$tmp"
44mv "$tmp" "$out"
45printf '%s\n' "$out"