diff --git a/local-tool/scripts/bootstrap-windows.ps1 b/local-tool/scripts/bootstrap-windows.ps1 index c3a7888..15b371a 100644 --- a/local-tool/scripts/bootstrap-windows.ps1 +++ b/local-tool/scripts/bootstrap-windows.ps1 @@ -104,6 +104,24 @@ function Convert-ToMsysPath($winPath) { } $msysPython = Convert-ToMsysPath $realPython +# 找 Inno Setup Compiler (iscc.exe),winget 裝在 Program Files (x86) 不在 PATH 裡 +$isccCandidates = @( + "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe", + "$env:ProgramFiles\Inno Setup 6\iscc.exe", + "${env:ProgramFiles(x86)}\Inno Setup 5\iscc.exe" +) +$isccPath = $null +foreach ($p in $isccCandidates) { + if ($p -and (Test-Path $p)) { $isccPath = $p; break } +} +if ($isccPath) { + Log "偵測到 Inno Setup: $isccPath" + $msysIsccDir = Convert-ToMsysPath (Split-Path $isccPath -Parent) +} else { + Log 'WARN: 找不到 Inno Setup(iscc.exe),make exe 步驟會失敗' + $msysIsccDir = $null +} + # Makefile 需要 bash + make,透過 MSYS2 bash 執行 # 將 Windows 路徑 C:\foo\bar 轉成 MSYS2 路徑 /c/foo/bar $projectPath = (Get-Location).Path @@ -113,10 +131,13 @@ $msysPath = '/' + $projectPath.Substring(0,1).ToLower() + '/' + ` $bashParts = @( "cd '$msysPath'", 'export VISIONA_ALLOW_GPL_FFMPEG=1', - "export VISIONA_PYTHON='$msysPython'", - 'make vendor-python-windows vendor-wheels-windows vendor-ffmpeg-windows vendor-ytdlp-windows', - 'make payload-windows' + "export VISIONA_PYTHON='$msysPython'" ) +if ($msysIsccDir) { + $bashParts += "export PATH=`"$msysIsccDir`":`$PATH" +} +$bashParts += 'make vendor-python-windows vendor-wheels-windows vendor-ffmpeg-windows vendor-ytdlp-windows' +$bashParts += 'make payload-windows' switch ($Target) { 'payload-windows' { }