API image is Go-only (compose target api). Python rebuild is profile index. bin/cgo/zig pins Zig 0.14.1, liblbug, and tokenizers.
36 lines
845 B
Bash
Executable File
36 lines
845 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# bin/kb/search — deprecated wrapper. Use bin/brain/search.go.
|
|
# CGO via Zig (bin/cgo/zig), not gcc. Builds a binary then execs it.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)"
|
|
BIN="$ROOT/var/bin/brain-search"
|
|
SRC="$ROOT/internal/brain"
|
|
CMD="$ROOT/bin/brain"
|
|
|
|
mkdir -p "$ROOT/var/bin"
|
|
|
|
need_build=0
|
|
if [ ! -x "$BIN" ]; then
|
|
need_build=1
|
|
else
|
|
while IFS= read -r -d '' f; do
|
|
if [ "$f" -nt "$BIN" ]; then
|
|
need_build=1
|
|
break
|
|
fi
|
|
done < <(find "$SRC" "$CMD" -name '*.go' -print0 2>/dev/null)
|
|
fi
|
|
|
|
if [ "$need_build" -eq 1 ]; then
|
|
echo "Building brain/search (zig cc)..." >&2
|
|
(
|
|
cd "$ROOT" &&
|
|
eval "$("$ROOT/bin/cgo/zig" env)" &&
|
|
go build -tags system_ladybug -o "$BIN" ./bin/brain
|
|
) || exit 1
|
|
fi
|
|
|
|
echo "bin/kb/search is deprecated; use bin/brain/search.go" >&2
|
|
exec "$BIN" "$@"
|