# 포터블 LiveSub.exe 빌드 (Windows 전용) # # powershell -ExecutionPolicy Bypass -File packaging\build-portable.ps1 # # 결과: dist\LiveSub.exe — 설치 없이 이 파일 하나만 있으면 실행됩니다. # 모델은 exe 에 없고 첫 실행 때 %APPDATA%\LiveSub\models 로 내려받습니다. $ErrorActionPreference = "Stop" $root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) Push-Location $root try { $venv = Join-Path $root ".venv-portable" if (-not (Test-Path $venv)) { Write-Host "포터블 전용 가상환경을 만듭니다 (torch 없이)..." -ForegroundColor Cyan py -3.12 -m venv $venv } $py = Join-Path $venv "Scripts\python.exe" & $py -m pip install --upgrade pip --quiet & $py -m pip install -r packaging\requirements-portable.txt # torch 가 섞여 들어가면 exe 가 3GB 로 불어난다. 빌드 전에 확인한다. & $py -c "import importlib.util,sys; sys.exit(1 if importlib.util.find_spec('torch') else 0)" if ($LASTEXITCODE -ne 0) { Write-Error "이 환경에 torch 가 있습니다. 포터블 빌드는 torch 없는 별도 venv 에서 하세요." } # 프로세스별 캡처 보조 프로그램이 있으면 같이 담긴다 (없어도 빌드는 된다). $capture = Join-Path $root "src\livesub\resources\bin\livesub_capture.exe" if (-not (Test-Path $capture)) { Write-Warning "livesub_capture.exe 가 없습니다. 포터블은 '출력 장치 전체' 캡처만 됩니다." Write-Warning "프로그램별 캡처를 넣으려면 native\process_loopback\build.ps1 을 먼저 실행하세요." } Remove-Item -Recurse -Force build, dist -ErrorAction SilentlyContinue & $py -m PyInstaller packaging\livesub.spec --noconfirm $out = Join-Path $root "dist\LiveSub.exe" if (Test-Path $out) { $mb = [math]::Round((Get-Item $out).Length / 1MB, 1) Write-Host "" Write-Host "빌드 완료: $out ($mb MB)" -ForegroundColor Green Write-Host "이 파일 하나만 복사하면 됩니다. 설치 필요 없습니다." -ForegroundColor Green } else { Write-Error "빌드는 끝났지만 dist\LiveSub.exe 를 찾지 못했습니다." } } finally { Pop-Location }