Files
SonicForgeStudio/build_install.ps1
T

57 lines
2.5 KiB
PowerShell

# build_install.ps1 - Build install/ (portable package) tu source, Windows
# Chay: powershell -ExecutionPolicy Bypass -File build_install.ps1
#
# install/ = portable package (chay truc tiep, khong can cai dat):
# daw_vst_bridge.exe native host bridge (C++) - DA COMMIT san
# libfluidsynth-3.dll FluidSynth runtime - DA COMMIT san
# sonicforge-daw.exe Tauri app shell - DA COMMIT san
# daw_engine/ Python engine (PyInstaller onedir, ~1.8GB)
# - KHONG commit -> script nay tu build
#
# 3 binary C++/Tauri da commit de nguoi pull khong can toolchain
# (VS2019/2022 + vcpkg + vst3sdk submodule + sfizz-src). Chay lai
# build_windows.ps1 neu muon build lai bridge/app tu source.
# LUU Y: file nay chi dung ky tu ASCII (PowerShell 5.1).
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
Write-Host "== [1/4] Kill tien trinh cu =="
Get-Process -Name "daw_engine","sonicforge-daw","daw_vst_bridge" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 500
Write-Host "== [2/4] Frontend bundle (app.jsx -> app.precompiled.js) =="
npm install --no-audit --no-fund
if (-not (Test-Path "node_modules\@babel\standalone")) {
npm install @babel/standalone --no-audit --no-fund
}
node build.mjs
Write-Host "== [3/4] Build daw_engine.exe (PyInstaller onedir) =="
python -m pip install -r requirements.txt pyinstaller pywin32
pyinstaller engine.spec --clean --noconfirm
if (-not (Test-Path "dist\daw_engine\daw_engine.exe")) {
Write-Host "ERROR: dist\daw_engine\daw_engine.exe khong ton tai" -ForegroundColor Red
exit 1
}
python tools\verify_bundle.py
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: bundle thieu asset" -ForegroundColor Red
exit 1
}
Write-Host "== [4/4] Copy vao install\ =="
New-Item -ItemType Directory -Force "install" | Out-Null
if (Test-Path "install\daw_engine") { Remove-Item -Recurse -Force "install\daw_engine" }
Copy-Item "dist\daw_engine\*" "install\daw_engine\" -Recurse -Force
# 3 binary (bridge/lib/app) da commit san trong install/ - khong ghi de,
# neu user da build lai bridge/app thi tu copy vao day.
Write-Host ""
Write-Host "== DONE =="
Write-Host " install\daw_engine\daw_engine.exe (moi build)"
Write-Host " install\daw_vst_bridge.exe (commit san)"
Write-Host " install\libfluidsynth-3.dll (commit san)"
Write-Host " install\sonicforge-daw.exe (commit san)"
Write-Host ""
Write-Host "Chay: install\sonicforge-daw.exe"