build: add Windows plugin packages
This commit is contained in:
parent
1a15d57033
commit
22c842d5e3
|
|
@ -1,4 +1,5 @@
|
|||
dist/
|
||||
dist-windows/
|
||||
release/
|
||||
node_modules/
|
||||
# compiled backend binaries (built from source)
|
||||
|
|
|
|||
14
README.md
14
README.md
|
|
@ -28,6 +28,20 @@ cd ../verstak-desktop
|
|||
./scripts/install-dev-plugins.sh
|
||||
```
|
||||
|
||||
## Windows test packages from Linux
|
||||
|
||||
Install a MinGW cross-compiler, then build a separate Windows amd64 package
|
||||
tree:
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-mingw-w64-x86-64
|
||||
./scripts/build-windows.sh
|
||||
```
|
||||
|
||||
The result is `dist-windows/`. Go sidecars, when a plugin has one, are emitted
|
||||
as `backend/<plugin-id>.exe`; frontends and manifests are the same packaged
|
||||
files used on Linux. This is a local test output and is not a GitHub Release.
|
||||
|
||||
## Alpha behaviour
|
||||
|
||||
- Browser Inbox archives processed captures and can restore them; permanent
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
WINDOWS_DIST="${VERSTAK_WINDOWS_PLUGIN_DIST:-$ROOT/dist-windows}"
|
||||
WINDOWS_CC="${VERSTAK_WINDOWS_CC:-x86_64-w64-mingw32-gcc}"
|
||||
GO_BIN="${GO_BIN:-go}"
|
||||
|
||||
if ! command -v "$WINDOWS_CC" >/dev/null; then
|
||||
echo "Windows cross-compiler not found: $WINDOWS_CC" >&2
|
||||
echo "Install x86_64-w64-mingw32-gcc (for example: sudo apt install gcc-mingw-w64-x86-64)." >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v "$GO_BIN" >/dev/null; then
|
||||
echo "go is required to build Windows plugin backends" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$ROOT"
|
||||
echo "=== verstak official plugins Windows amd64 build ==="
|
||||
|
||||
# Reuse the canonical frontend and manifest packager, then replace every Go
|
||||
# sidecar with its Windows executable in a separate dist-windows tree.
|
||||
./scripts/build.sh
|
||||
rm -rf "$WINDOWS_DIST"
|
||||
mkdir -p "$WINDOWS_DIST"
|
||||
cp -R "$ROOT/dist/." "$WINDOWS_DIST/"
|
||||
|
||||
backend_count=0
|
||||
for plugin_dir in "$ROOT"/plugins/*/; do
|
||||
[[ -d "$plugin_dir" ]] || continue
|
||||
plugin_name="$(basename "$plugin_dir")"
|
||||
backend_dir="$plugin_dir/backend"
|
||||
[[ -d "$backend_dir" ]] || continue
|
||||
if [[ ! -f "$backend_dir/go.mod" && ! -f "$backend_dir/main.go" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
package_backend="$WINDOWS_DIST/$plugin_name/backend"
|
||||
rm -rf "$package_backend"
|
||||
mkdir -p "$package_backend"
|
||||
echo " → Windows backend: $plugin_name.exe"
|
||||
(
|
||||
cd "$backend_dir"
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC="$WINDOWS_CC" \
|
||||
"$GO_BIN" build -o "$package_backend/$plugin_name.exe" .
|
||||
)
|
||||
backend_count=$((backend_count + 1))
|
||||
done
|
||||
|
||||
echo "Windows plugin packages: $WINDOWS_DIST"
|
||||
echo "Windows backends built: $backend_count"
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
BUILDER="$ROOT/scripts/build-windows.sh"
|
||||
|
||||
if [[ ! -x "$BUILDER" ]]; then
|
||||
echo "Windows plugin builder is missing or not executable: $BUILDER" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bash -n "$BUILDER"
|
||||
grep -Fq 'GOOS=windows' "$BUILDER"
|
||||
grep -Fq 'GOARCH=amd64' "$BUILDER"
|
||||
grep -Fq 'dist-windows' "$BUILDER"
|
||||
grep -Fq '.exe' "$BUILDER"
|
||||
grep -Fq 'x86_64-w64-mingw32-gcc' "$BUILDER"
|
||||
|
||||
echo "Windows plugin build script contract passed"
|
||||
Loading…
Reference in New Issue