feat(build): add Windows ARM64 cross-compile script

For testing on UTM Windows VMs. Scans common shared folder
locations and presents interactive picker when multiple found.

  make build-windows SHARED=~/Downloads
  mise run build:windows ~/Downloads
This commit is contained in:
Willie
2026-02-26 00:38:30 +08:00
parent afa7dfd568
commit 01d133bb13
3 changed files with 58 additions and 1 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
.PHONY: help build build-meta run test test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check check install clean ui-install ui-build ui-dev build-all
.PHONY: help build build-meta build-windows run test test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check check install clean ui-install ui-build ui-dev build-all
help:
@echo "Common tasks:"
@@ -35,6 +35,9 @@ build:
build-meta:
./scripts/build.sh
build-windows:
./scripts/build-windows.sh $(SHARED)
run: build
./bin/skillshare --help
+4
View File
@@ -40,6 +40,10 @@ run = "mkdir -p bin && go build -o bin/skillshare ./cmd/skillshare"
description = "Build with version metadata"
run = "./scripts/build.sh"
[tasks."build:windows"]
description = "Cross-compile for Windows ARM64 and copy to shared folder"
run = "./scripts/build-windows.sh ${1:-}"
[tasks.run]
description = "Run skillshare help using the local binary"
depends = ["build"]
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Cross-compile skillshare for Windows ARM64 and copy to UTM shared folder.
# Usage: ./scripts/build-windows.sh [shared_folder]
set -euo pipefail
if [ -n "${1:-}" ]; then
SHARED="$1"
else
# Scan common shared folder locations
candidates=()
for dir in "$HOME/Downloads" "$HOME/Public" "$HOME/Desktop" "$HOME/Shared"; do
[ -d "$dir" ] && candidates+=("$dir")
done
# Also check UTM shared mount points (VirtioFS typically shows up here)
for dir in /Volumes/Shared* /Volumes/UTM*; do
[ -d "$dir" ] 2>/dev/null && candidates+=("$dir")
done
if [ ${#candidates[@]} -eq 0 ]; then
echo "✗ No shared folder found. Usage: $0 <path>" >&2
exit 1
elif [ ${#candidates[@]} -eq 1 ]; then
SHARED="${candidates[0]}"
else
echo "Select shared folder:"
for i in "${!candidates[@]}"; do
printf " %d) %s\n" $((i + 1)) "${candidates[$i]}"
done
printf " q) Cancel\n"
printf "> "
read -r choice
case "$choice" in
q|Q) echo "Cancelled."; exit 0 ;;
*) SHARED="${candidates[$((choice - 1))]}" ;;
esac
fi
fi
if [ ! -d "$SHARED" ]; then
echo "✗ Directory not found: $SHARED" >&2
exit 1
fi
echo "Building Windows ARM64..."
GOOS=windows GOARCH=arm64 go build -o bin/skillshare-arm64.exe ./cmd/skillshare/
cp bin/skillshare-arm64.exe "$SHARED/skillshare.exe"
echo "✓ $(file bin/skillshare-arm64.exe | cut -d: -f2 | xargs)"
echo "→ $SHARED/skillshare.exe ($(du -h "$SHARED/skillshare.exe" | cut -f1 | xargs))"