diff --git a/local-tool/Makefile b/local-tool/Makefile index bc0b195..5270df5 100644 --- a/local-tool/Makefile +++ b/local-tool/Makefile @@ -470,6 +470,8 @@ exe-only: ## 只跑 iscc 打包 installer(前置產物必須已存在),不 exe: wails-windows _run-iscc ## ⚠️ 必須在 Windows 上跑:Inno Setup → dist/visiona-local-*-windows-x64.exe _run-iscc: + @echo "DEBUG _run-iscc: ISCC='$$ISCC'" + @echo "DEBUG _run-iscc: PATH first entries: $$(echo $$PATH | tr ':' '\n' | head -5)" @ISCC_BIN="$$ISCC"; \ if [ -z "$$ISCC_BIN" ]; then \ if command -v iscc > /dev/null 2>&1; then ISCC_BIN=iscc; \ diff --git a/local-tool/scripts/bootstrap-windows.ps1 b/local-tool/scripts/bootstrap-windows.ps1 index 4fadc75..d135c5f 100644 --- a/local-tool/scripts/bootstrap-windows.ps1 +++ b/local-tool/scripts/bootstrap-windows.ps1 @@ -204,10 +204,25 @@ if ($fastPath -and ($Target -eq 'exe' -or -not $env:VISIONA_TARGET)) { } } -$bashCmd = $bashParts -join ' && ' +# 把 bash 指令寫成 script 檔再執行,避開 PS → bash 多層 quoting 地獄 +# (尤其是含空格的路徑如 "C:\Program Files (x86)\Inno Setup 6\") +$bashScriptLines = @('#!/usr/bin/env bash', 'set -e', '') +foreach ($line in $bashParts) { + $bashScriptLines += $line +} +$bashScriptContent = ($bashScriptLines -join "`n") + "`n" +$tmpScript = Join-Path (Get-Location) '.visiona-build.sh' +# 用 UTF8 無 BOM + LF 換行,bash 才吃得下 +[System.IO.File]::WriteAllText($tmpScript, $bashScriptContent, (New-Object System.Text.UTF8Encoding $false)) -& 'C:\msys64\usr\bin\bash.exe' -lc $bashCmd -if ($LASTEXITCODE -ne 0) { Fail "build 失敗,exit code=$LASTEXITCODE" } +Log "bash 執行腳本內容:" +Get-Content $tmpScript | ForEach-Object { Write-Host " $_" } + +$msysScript = Convert-ToMsysPath $tmpScript +& 'C:\msys64\usr\bin\bash.exe' -l $msysScript +$buildRc = $LASTEXITCODE +Remove-Item $tmpScript -ErrorAction SilentlyContinue +if ($buildRc -ne 0) { Fail "build 失敗,exit code=$buildRc" } # 驗證 dist 真的有 .exe 產出(exe target 是 phony,make 成功 != 產物存在) if ($Target -eq 'exe' -or $Target -eq 'default' -or -not $Target) {