Files
marqdo/scripts/build-web-plugin.sh
T
cflmyandCursor ca40c698a2 refactor(web): start Go ABI rewrite of plugins/web (W-G0)
Archive the Rust web plugin and add a Go c-shared skeleton with ABI v2
bridge, build script, design doc/ADR, and smoke test so multi-language
plugins and full web parity can proceed wave by wave.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 14:47:43 +08:00

25 lines
1018 B
Bash
Executable File

#!/usr/bin/env bash
# Build Marqdo web plugin (Go → C shared library).
# Output: plugins/web/build/libweb.so (Linux) / libweb.dylib / web.dll
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT/plugins/web"
mkdir -p build
export PATH="${HOME}/.local/go/bin:/usr/local/go/bin:${PATH}"
if ! command -v go >/dev/null 2>&1; then
echo "error: go not found (install Go 1.22+ or set PATH)" >&2
exit 1
fi
OUT="build/libweb.so"
case "$(uname -s)" in
Darwin) OUT="build/libweb.dylib" ;;
MINGW*|MSYS*|CYGWIN*|Windows_NT) OUT="build/web.dll" ;;
esac
echo "building $OUT (go $(go version | awk '{print $3}'))…"
CGO_ENABLED=1 go build -buildmode=c-shared -o "$OUT" .
# Do NOT copy over target/{debug,release}/libweb.so — rust archive crate still
# builds there during migration. Canonical Go artifact is plugins/web/build/.
echo "ok: $ROOT/plugins/web/$OUT"
echo "hint: export MARQDO_WEB_PLUGIN=$ROOT/plugins/web/$OUT"
echo " (or use plugins/web/build before ~/.marqdo/ext/native in resolution)"