Skip to content

Commit 3dd6d51

Browse files
authored
fix(cli): use local z3 in dev wrapper (#805)
* fix(cli): use local z3 in dev wrapper Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com> * fix(docker): add openshell-prover to Dockerfile skeleton stages --------- Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
1 parent 79e6f73 commit 3dd6d51

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

deploy/docker/Dockerfile.images

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ COPY crates/openshell-router/Cargo.toml crates/openshell-router/Cargo.toml
5454
COPY crates/openshell-sandbox/Cargo.toml crates/openshell-sandbox/Cargo.toml
5555
COPY crates/openshell-server/Cargo.toml crates/openshell-server/Cargo.toml
5656
COPY crates/openshell-tui/Cargo.toml crates/openshell-tui/Cargo.toml
57+
COPY crates/openshell-prover/Cargo.toml crates/openshell-prover/Cargo.toml
5758
COPY crates/openshell-core/build.rs crates/openshell-core/build.rs
5859
COPY proto/ proto/
5960

@@ -67,6 +68,7 @@ RUN mkdir -p \
6768
crates/openshell-router/src \
6869
crates/openshell-sandbox/src \
6970
crates/openshell-server/src \
71+
crates/openshell-prover/src \
7072
crates/openshell-tui/src && \
7173
touch crates/openshell-bootstrap/src/lib.rs && \
7274
printf 'fn main() {}\n' > crates/openshell-cli/src/main.rs && \
@@ -79,6 +81,7 @@ RUN mkdir -p \
7981
printf 'fn main() {}\n' > crates/openshell-sandbox/src/main.rs && \
8082
touch crates/openshell-server/src/lib.rs && \
8183
printf 'fn main() {}\n' > crates/openshell-server/src/main.rs && \
84+
touch crates/openshell-prover/src/lib.rs && \
8285
touch crates/openshell-tui/src/lib.rs
8386

8487
FROM rust-builder-skeleton AS rust-deps

scripts/bin/openshell

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ else
4242
return 0 ;;
4343
crates/openshell-cli/*|crates/openshell-core/*|crates/openshell-bootstrap/*)
4444
return 0 ;;
45+
crates/openshell-prover/*)
46+
return 0 ;;
4547
crates/openshell-policy/*|crates/openshell-providers/*|crates/openshell-tui/*)
4648
return 0 ;;
4749
*)
@@ -89,7 +91,28 @@ fi
8991

9092
if [[ "$needs_build" == "1" ]]; then
9193
echo "Recompiling openshell..." >&2
92-
cargo build --package openshell-cli --quiet
94+
build_args=(--package openshell-cli --quiet)
95+
if ! command -v pkg-config >/dev/null 2>&1 || ! pkg-config --exists z3 >/dev/null 2>&1; then
96+
z3_prefix=""
97+
if command -v brew >/dev/null 2>&1; then
98+
z3_prefix=$(brew --prefix z3 2>/dev/null || true)
99+
fi
100+
101+
for candidate in "$z3_prefix" /opt/homebrew/opt/z3 /usr/local/opt/z3; do
102+
if [[ -n "$candidate" && -f "$candidate/include/z3.h" && -d "$candidate/lib" ]]; then
103+
echo "Using local Z3 from ${candidate} for CLI build." >&2
104+
export Z3_SYS_Z3_HEADER="${candidate}/include/z3.h"
105+
export Z3_LIBRARY_PATH_OVERRIDE="${candidate}/lib"
106+
break
107+
fi
108+
done
109+
110+
if [[ -z "${Z3_SYS_Z3_HEADER:-}" ]]; then
111+
echo "Falling back to bundled Z3 for local CLI build." >&2
112+
build_args+=(--features bundled-z3)
113+
fi
114+
fi
115+
cargo build "${build_args[@]}"
93116
# Persist state after successful build
94117
mkdir -p "$(dirname "$STATE_FILE")"
95118
cd "$PROJECT_ROOT"
@@ -110,6 +133,8 @@ if [[ "$needs_build" == "1" ]]; then
110133
return 0 ;;
111134
crates/openshell-cli/*|crates/openshell-core/*|crates/openshell-bootstrap/*)
112135
return 0 ;;
136+
crates/openshell-prover/*)
137+
return 0 ;;
113138
crates/openshell-policy/*|crates/openshell-providers/*|crates/openshell-tui/*)
114139
return 0 ;;
115140
*)

0 commit comments

Comments
 (0)