@echo off setlocal EnableExtensions cd /d "%~dp0" if /I "%~1"=="clean" goto clean if not exist "config.h" ( echo [ERROR] config.h is missing from the source root. echo Please extract the full source ZIP before building. exit /b 1 ) findstr /n /c:"#define snprintf" "%~dp0libmultihash\multihash.h" "%~dp0libfriidump\win32compat.h" >nul 2>nul if not errorlevel 1 ( echo [ERROR] Legacy snprintf macro still present. Overwrite libmultihash\multihash.h and libfriidump\win32compat.h from this package. exit /b 1 ) if not exist "build-msvc32" mkdir "build-msvc32" call "%~dp0.vscode\msvc32.cmd" cl @"%~dp0msvc32_friidump.rsp" if errorlevel 1 exit /b %ERRORLEVEL% set "HELP_LOG=%TEMP%\friidump-help-%RANDOM%-%RANDOM%.txt" "%~dp0friidump.exe" --help > "%HELP_LOG%" 2>&1 type "%HELP_LOG%" findstr /c:"FriiDump " "%HELP_LOG%" >nul if errorlevel 1 ( echo [ERROR] FriiDump help/version smoke test failed. del /q "%HELP_LOG%" >nul 2>nul if exist "friidump.log" del /q "friidump.log" exit /b 1 ) findstr /c:"Available command line options:" "%HELP_LOG%" >nul if errorlevel 1 ( echo [ERROR] FriiDump command-line help smoke test failed. del /q "%HELP_LOG%" >nul 2>nul if exist "friidump.log" del /q "friidump.log" exit /b 1 ) del /q "%HELP_LOG%" >nul 2>nul if exist "friidump.log" del /q "friidump.log" powershell -NoProfile -ExecutionPolicy Bypass -Command "Compress-Archive -Force -Path friidump.exe,docs,README,AUTHORS,COPYING,config.h,msvc32_friidump.rsp,build_msvc32.cmd,.vscode -DestinationPath friidump_msvc32_build_results.zip" exit /b %ERRORLEVEL% :clean if exist "friidump.exe" del /q "friidump.exe" if exist "build-msvc32" rmdir /s /q "build-msvc32" if exist "friidump_msvc32_build_results.zip" del /q "friidump_msvc32_build_results.zip" if exist "friidump.log" del /q "friidump.log" exit /b 0