Collapse nested kbsearch/chats go.mod into the root module. Ranking stays cgo-free under internal/brain/rank so CI does not need ladybug. bin/kb/search is a deprecation wrapper that still sets CGO and builds the binary.
38 lines
948 B
Bash
Executable File
38 lines
948 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# bin/kb/search — deprecated wrapper. Use bin/brain/search.go.
|
|
# Sets CGO for ladybug, builds a binary (embed daemon needs a real executable),
|
|
# then execs it. Prints one deprecation line.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(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..." >&2
|
|
(
|
|
cd "$ROOT" &&
|
|
CGO_CFLAGS="-I$ROOT/lib-ladybug" \
|
|
CGO_LDFLAGS="-L$ROOT/lib-ladybug -Wl,-rpath,$ROOT/lib-ladybug" \
|
|
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" "$@"
|