Fix Windows build flow

This commit is contained in:
SiYue
2026-04-12 21:27:40 +08:00
parent f6bceb29a3
commit 193e1a3cd0
2 changed files with 33 additions and 0 deletions
+17
View File
@@ -9,6 +9,11 @@ EXT=
ifeq ($(OS),Windows_NT)
POWERSHELL=powershell -NoProfile -Command
<<<<<<< HEAD
=======
GO=go
WEB_GO=go
>>>>>>> 83c79087 (Fix Windows build flow)
WINDOWS_GOARCH_RAW:=$(strip $(shell go env GOARCH 2>NUL))
endif
@@ -40,7 +45,10 @@ GOFLAGS?=-v -tags $(GO_BUILD_TAGS)
GOCACHE?=$(CURDIR)/.cache/go-build
GOMODCACHE?=$(CURDIR)/.cache/go-mod
GOTOOLCHAIN?=local
<<<<<<< HEAD
export CGO_ENABLED
=======
>>>>>>> 83c79087 (Fix Windows build flow)
export GOCACHE
export GOMODCACHE
export GOTOOLCHAIN
@@ -207,7 +215,16 @@ build-launcher:
@echo "Building picoclaw-launcher for $(PLATFORM)/$(ARCH)..."
ifeq ($(OS),Windows_NT)
@$(POWERSHELL) "New-Item -ItemType Directory -Force -Path '$(BUILD_DIR)' | Out-Null"
<<<<<<< HEAD
@$(MAKE) -C web build PLATFORM="$(PLATFORM)" ARCH="$(ARCH)" EXT="$(EXT)" OUTPUT="$(CURDIR)/$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)" GO_BUILD_TAGS="$(GO_BUILD_TAGS)"
=======
@$(MAKE) -C web build \
PLATFORM="$(PLATFORM)" \
ARCH="$(ARCH)" \
EXT="$(EXT)" \
OUTPUT="$(CURDIR)/$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)" \
GO_BUILD_TAGS="$(GO_BUILD_TAGS)"
>>>>>>> 83c79087 (Fix Windows build flow)
@$(POWERSHELL) "Copy-Item -LiteralPath '$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)' -Destination '$(BUILD_DIR)/picoclaw-launcher$(EXT)' -Force"
else
@mkdir -p $(BUILD_DIR)
+16
View File
@@ -10,7 +10,10 @@ GOFLAGS?=-v -tags $(GO_BUILD_TAGS)
GOCACHE?=$(abspath ../.cache/go-build)
GOMODCACHE?=$(abspath ../.cache/go-mod)
GOTOOLCHAIN?=local
<<<<<<< HEAD
export CGO_ENABLED
=======
>>>>>>> 83c79087 (Fix Windows build flow)
export GOCACHE
export GOMODCACHE
export GOTOOLCHAIN
@@ -30,6 +33,11 @@ LAUNCHER_GUI_LDFLAG=
ifeq ($(OS),Windows_NT)
POWERSHELL=powershell -NoProfile -Command
<<<<<<< HEAD
=======
GO=go
WEB_GO=go
>>>>>>> 83c79087 (Fix Windows build flow)
WINDOWS_GOARCH_RAW:=$(strip $(shell go env GOARCH 2>NUL))
endif
@@ -164,6 +172,7 @@ endif
build-frontend:
ifeq ($(OS),Windows_NT)
<<<<<<< HEAD
@$(POWERSHELL) "$$frontend='$(FRONTEND_DIR)'; $$stamp='$(FRONTEND_INSTALL_STAMP)'; $$pkg='$(FRONTEND_DIR)/package.json'; $$lock='$(FRONTEND_DIR)/pnpm-lock.yaml'; $$expected=((Get-FileHash -LiteralPath $$pkg -Algorithm SHA256).Hash + ':' + (Get-FileHash -LiteralPath $$lock -Algorithm SHA256).Hash); $$nodeModules=$$frontend + '/node_modules'; $$tsc=$$nodeModules + '/.bin/tsc'; $$current=''; if (Test-Path -LiteralPath $$stamp) { $$current=(Get-Content -LiteralPath $$stamp -Raw).Trim() }; if ((-not (Test-Path -LiteralPath $$nodeModules)) -or (-not (Test-Path -LiteralPath $$tsc)) -or ($$current -ne $$expected)) { Write-Host 'Installing frontend dependencies...'; Push-Location $$frontend; try { $$env:CI='true'; pnpm install --frozen-lockfile } finally { Pop-Location; Remove-Item Env:CI -ErrorAction SilentlyContinue }; Set-Content -LiteralPath $$stamp -Value $$expected -NoNewline }"
else
@expected_stamp="$$(cat $(FRONTEND_DIR)/package.json $(FRONTEND_DIR)/pnpm-lock.yaml | cksum | awk '{print $$1 ":" $$2}')"; \
@@ -171,6 +180,13 @@ else
[ ! -x $(FRONTEND_DIR)/node_modules/.bin/tsc ] || \
[ ! -f $(FRONTEND_INSTALL_STAMP) ] || \
[ "$$(cat $(FRONTEND_INSTALL_STAMP) 2>/dev/null)" != "$$expected_stamp" ]; then \
=======
@if not exist "$(FRONTEND_DIR)\node_modules" (echo Installing frontend dependencies... && cd $(FRONTEND_DIR) && pnpm install --frozen-lockfile --store-dir .pnpm-store) else echo Frontend dependencies already installed.
else
@if [ ! -d $(FRONTEND_DIR)/node_modules ] || \
[ $(FRONTEND_DIR)/package.json -nt $(FRONTEND_DIR)/node_modules ] || \
[ $(FRONTEND_DIR)/pnpm-lock.yaml -nt $(FRONTEND_DIR)/node_modules ]; then \
>>>>>>> 83c79087 (Fix Windows build flow)
echo "Installing frontend dependencies..."; \
(cd $(FRONTEND_DIR) && CI=true pnpm install --frozen-lockfile) && \
printf '%s\n' "$$expected_stamp" > $(FRONTEND_INSTALL_STAMP); \