Viewing files at commit c10cefe7abe5Commit detailsView latest

Browse files
oakmark/build-engine.sh 39 lines · 1.5 KB · bash
1
#!/usr/bin/env bash
2
# Build the oak-engine protocol-transport binary.
3
#
4
# oakvcs-core is consumed by PATH (not confirmed on crates.io). oak-engine's
5
# manifest is a committed template (Cargo.toml.in); this script resolves a local
6
# oak `core/` checkout, renders a gitignored Cargo.toml with its ABSOLUTE path
7
# (required so Cargo resolves oakvcs-core's workspace-inherited deps against the
8
# oak workspace root), and runs the release build.
9
#
10
# Usage:  ./build-engine.sh [OAK_CORE_PATH]
11
#   OAK_CORE_PATH  path to an oak `core/` dir (the crate `oakvcs-core`).
12
#                  Falls back to $OAK_CORE_PATH, then autodetection.
13
set -euo pipefail
14
cd "$(dirname "$0")"
15
16
CORE="${1:-${OAK_CORE_PATH:-}}"
17
if [[ -z "$CORE" ]]; then
18
  # Autodetect: a sibling oak checkout, the canonical checkout, then any
19
  # worker-*/oak/core. First hit that has Cargo.toml wins.
20
  for cand in \
21
    ../../oak/core \
22
    /Users/mrmrs/o/oak/core \
23
    $(ls -dt /Users/mrmrs/o/worker-*/oak/core 2>/dev/null); do
24
    if [[ -f "$cand/Cargo.toml" ]]; then CORE="$cand"; break; fi
25
  done
26
fi
27
if [[ -z "$CORE" || ! -f "$CORE/Cargo.toml" ]]; then
28
  echo "error: could not find an oak core/ checkout. Pass one:" >&2
29
  echo "  ./build-engine.sh /path/to/oak/core" >&2
30
  exit 1
31
fi
32
CORE="$(cd "$CORE" && pwd)"
33
echo "oak-engine: using oakvcs-core at $CORE"
34
35
# Render the gitignored manifest from the template.
36
sed "s#@OAK_CORE@#$CORE#g" oak-engine/Cargo.toml.in > oak-engine/Cargo.toml
37
38
cargo build --release --manifest-path oak-engine/Cargo.toml
39
echo "oak-engine: built → oak-engine/target/release/oak-engine"