@echo off REM Actual per-build packaging. Triggered by watch_build.bat once REM install.bat's one-time provisioning has already put MSYS2/GTK4/ REM libadwaita/WiX in place. Reads source from Z:\src, writes REM FEnigma-.msi to Z:\dist, and Z:\BUILD_DONE (or REM Z:\BUILD_FAILED, with the log copied alongside it) when finished. REM REM UNTESTED (see install.bat's note) -- the WiX harvest/link step in REM particular is likely to need iteration: bulk-copying all of REM mingw64\ is the "make it work first" approach, not a lean one, and REM heat.exe's default harvest options may need tuning to actually REM produce a working component set for a tree this size. setlocal enabledelayedexpansion set LOG=Z:\build.log echo [build.bat] starting > %LOG% if exist Z:\BUILD_VERSION ( set /p APPVER=> %LOG% rd /s /q C:\build 2>nul mkdir C:\build\src mkdir C:\build\dist\src mkdir C:\build\dist\mingw64 echo [build.bat] copying source from Z:\src ... >> %LOG% xcopy /e /i /q Z:\src C:\build\src >> %LOG% 2>&1 echo [build.bat] sanity import check ... >> %LOG% set PYTHONPATH=C:\build\src\src C:\msys64\mingw64\bin\python3.exe -c "import fenigma.app" >> %LOG% 2>&1 if errorlevel 1 ( echo [build.bat] FAILED: fenigma.app failed to import, see log >> %LOG% copy %LOG% Z:\build.log.failed >nul echo FAILED > Z:\BUILD_FAILED exit /b 1 ) echo [build.bat] assembling dist tree ... >> %LOG% xcopy /e /i /q C:\build\src\src C:\build\dist\src >> %LOG% 2>&1 REM Bulk-copy the whole mingw64 runtime rather than hand-tracing the DLL/ REM typelib/icon-theme/schema dependency closure -- bloated (likely 1GB+) REM but reliable; trimming this down is a known follow-up, not attempted REM here (see this file's top-of-file note). robocopy C:\msys64\mingw64 C:\build\dist\mingw64 /e /xd include share\doc share\man share\gtk-doc /nfl /ndl /njh /njs >> %LOG% 2>&1 echo [build.bat] harvesting WiX components ... >> %LOG% REM -platform x64 alone is NOT enough (confirmed live: still every REM component ICE80'd afterward) -- WiX v3 heat.exe's -platform flag REM doesn't actually stamp Win64="yes" on harvested components itself, REM it only affects registry-key harvesting. Kept anyway (harmless, REM correct in spirit), but the real fix is candle.exe's -arch x64 REM below, see its own comment. C:\wix\heat.exe dir C:\build\dist -platform x64 -cg AppFiles -gg -scom -sreg -sfrag -srd -sw5150 -dr INSTALLFOLDER -var var.DistDir -out C:\build\files.wxs >> %LOG% 2>&1 if errorlevel 1 ( echo [build.bat] FAILED: heat.exe harvest failed >> %LOG% copy %LOG% Z:\build.log.failed >nul echo FAILED > Z:\BUILD_FAILED exit /b 1 ) copy /y C:\FenigmaBuild\product.wxs C:\build\product.wxs >nul echo [build.bat] compiling (candle) ... >> %LOG% REM -arch x64: the actual fix for the ICE80 "32BitComponent uses REM 64BitDirectory" failure (confirmed live -- heat.exe's own -platform REM x64 above does NOT set this, only affects registry harvesting). REM -arch sets the default Win64/Platform for every component compiled REM from EITHER source file, hand-authored (product.wxs) or harvested REM (files.wxs) alike, without needing per-component authoring -- the REM standard WiX v3 way to make a whole package consistently 64-bit, REM matching product.wxs's own ProgramFiles64Folder. C:\wix\candle.exe -arch x64 -dDistDir=C:\build\dist -dAppVersion=%APPVER% -out C:\build\ C:\build\product.wxs C:\build\files.wxs >> %LOG% 2>&1 if errorlevel 1 ( echo [build.bat] FAILED: candle.exe failed >> %LOG% copy %LOG% Z:\build.log.failed >nul echo FAILED > Z:\BUILD_FAILED exit /b 1 ) echo [build.bat] linking (light) ... >> %LOG% C:\wix\light.exe -ext WixUIExtension -sice:ICE60 -sice:ICE61 -out C:\build\FEnigma-%APPVER%.msi C:\build\product.wixobj C:\build\files.wixobj >> %LOG% 2>&1 if errorlevel 1 ( echo [build.bat] FAILED: light.exe failed >> %LOG% copy %LOG% Z:\build.log.failed >nul echo FAILED > Z:\BUILD_FAILED exit /b 1 ) if not exist Z:\dist mkdir Z:\dist copy /y C:\build\FEnigma-%APPVER%.msi Z:\dist\ >> %LOG% 2>&1 copy /y %LOG% Z:\dist\build.log >nul echo [build.bat] done >> %LOG% echo DONE > Z:\BUILD_DONE endlocal