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
omega-mv / research / atemporal / at1 / oracle / build.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Build the AT-1 reference oracle with a direct rustc invocation (no cargo, no crates). |
| 18 | # Usage: ./build.sh -> target/at1-oracle |
| 19 | # ./build.sh test -> builds and runs target/at1-oracle-test |
| 20 | set -eu |
| 21 | cd "$(dirname "$0")" |
| 22 | mkdir -p target |
| 23 | RUSTC_VERSION="$(rustc -V)" |
| 24 | RUSTC_HOST="$(rustc -vV | sed -n 's/^host: //p')" |
| 25 | FLAGS="--edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C panic=abort -D warnings" |
| 26 | # source provenance is captured at build time (AT0_RESULT_V2 section 7: the commit the |
| 27 | # binary was built from, and whether this directory, the only source it compiles, had |
| 28 | # uncommitted changes); a record from a dirty or non-git build says source_tree_clean NO |
| 29 | SRC_COMMIT="$(git rev-parse HEAD 2>/dev/null || true)" |
| 30 | SRC_CLEAN=NO |
| 31 | if [ -n "$SRC_COMMIT" ] && [ -z "$(git status --porcelain -- . 2>/dev/null)" ]; then SRC_CLEAN=YES; fi |
| 32 | export AT1_RUSTC_VERSION="$RUSTC_VERSION" AT1_RUSTC_HOST="$RUSTC_HOST" AT1_BUILD_FLAGS="$FLAGS" |
| 33 | export AT1_SOURCE_COMMIT="$SRC_COMMIT" AT1_SOURCE_CLEAN="$SRC_CLEAN" |
| 34 | case "${1:-build}" in |
| 35 | build) |
| 36 | rustc $FLAGS --crate-name at1_oracle src/main.rs -o target/at1-oracle |
| 37 | echo "built target/at1-oracle with $RUSTC_VERSION ($RUSTC_HOST)" ;; |
| 38 | test) |
| 39 | # tests need unwinding panics; everything else identical |
| 40 | rustc --edition 2021 -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -D warnings --test --crate-name at1_oracle src/main.rs -o target/at1-oracle-test |
| 41 | ./target/at1-oracle-test "${2:-}" ;; |
| 42 | lib) |
| 43 | # compute crate alone, for the isolation gate (no main.rs, so no I/O layer) |
| 44 | rustc $FLAGS --crate-type lib --crate-name at1 src/at1/mod.rs -o target/libat1.rlib |
| 45 | echo "built target/libat1.rlib" ;; |
| 46 | *) echo "usage: $0 [build|test|lib]" >&2; exit 1 ;; |
| 47 | esac |