Improve Windows build script with comprehensive dependency checking

Enhanced build.bat to automatically detect and offer to install all
required dependencies for users with minimal Windows dev environment:

- Check for winget availability (required for auto-installation)
- Detect and offer to install Git (recommended for development)
- Improved GCC/MinGW detection with fallback instructions
- Better error messages for users without winget
- Graceful degradation when automatic installation is not available

This ensures Jake and other users with just Go installed can run the
build script and get prompted to install everything needed automatically.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-04 17:19:43 -05:00
parent 3c21eb43e8
commit 82ae40e0ec

View File

@ -20,6 +20,56 @@ echo 📦 Go version:
go version go version
echo. echo.
REM ----------------------------
REM Check for winget (required for auto-install)
REM ----------------------------
set WINGET_AVAILABLE=0
where winget >nul 2>&1
if %ERRORLEVEL% equ 0 (
set WINGET_AVAILABLE=1
echo ✓ winget found (automatic installation available)
) else (
echo ⚠️ winget not found (manual installation will be required)
echo To enable automatic installation, update to Windows 10 1809+ or Windows 11
)
echo.
REM ----------------------------
REM Check for Git (recommended for development)
REM ----------------------------
where git >nul 2>&1
if %ERRORLEVEL% equ 0 (
echo ✓ Git found
git --version
) else (
echo ⚠️ Git not found (recommended for development)
if !WINGET_AVAILABLE! equ 1 (
echo.
echo Would you like to install Git automatically? (Y/N):
set /p install_git=
if /I "!install_git!"=="Y" (
echo.
echo 📥 Installing Git via winget...
winget install -e --id=Git.Git
set GIT_INSTALL_RESULT=!ERRORLEVEL!
if !GIT_INSTALL_RESULT! equ 0 (
echo ✓ Git installed successfully!
echo Please restart your terminal and run this script again.
exit /b 0
) else (
echo ❌ Failed to install Git automatically.
echo Please install manually from: https://git-scm.com/
)
)
) else (
echo Please install Git from: https://git-scm.com/
)
)
echo.
REM ---------------------------- REM ----------------------------
REM Check for GCC (required for CGO) REM Check for GCC (required for CGO)
REM ---------------------------- REM ----------------------------
@ -29,15 +79,17 @@ if %ERRORLEVEL% neq 0 (
echo. echo.
echo VideoTools requires MinGW-w64 to build on Windows. echo VideoTools requires MinGW-w64 to build on Windows.
echo. echo.
echo Would you like to install MinGW-w64 automatically? (Y/N):
set /p install_gcc=
if /I "!install_gcc!"=="Y" ( if !WINGET_AVAILABLE! equ 1 (
echo. echo Would you like to install MinGW-w64 automatically? (Y/N):
echo 📥 Installing MinGW-w64 via winget... set /p install_gcc=
echo This may take a few minutes...
winget install -e --id=MSYS2.MSYS2 if /I "!install_gcc!"=="Y" (
set MSYS2_INSTALL_RESULT=!ERRORLEVEL! echo.
echo 📥 Installing MinGW-w64 via winget...
echo This may take a few minutes...
winget install -e --id=MSYS2.MSYS2
set MSYS2_INSTALL_RESULT=!ERRORLEVEL!
if !MSYS2_INSTALL_RESULT! equ 0 ( if !MSYS2_INSTALL_RESULT! equ 0 (
echo ✓ MSYS2 installed successfully! echo ✓ MSYS2 installed successfully!
@ -64,19 +116,24 @@ if %ERRORLEVEL% neq 0 (
echo Visit: https://www.msys2.org/ echo Visit: https://www.msys2.org/
exit /b 1 exit /b 1
) )
) else (
echo Skipping automatic installation.
)
) else ( ) else (
echo. echo winget is not available on this system.
echo ❌ GCC is required to build VideoTools on Windows. )
echo.
echo Please install MinGW-w64: REM Show manual installation instructions if we get here
echo 1. Install MSYS2 from https://www.msys2.org/ echo.
echo 2. Run: pacman -S mingw-w64-x86_64-gcc echo ❌ GCC is required to build VideoTools on Windows.
echo 3. Add C:\msys64\mingw64\bin to your PATH echo.
echo. echo Please install MinGW-w64 manually:
echo Or install via winget: echo 1. Install MSYS2 from https://www.msys2.org/
echo winget install MSYS2.MSYS2 echo 2. Run: pacman -S mingw-w64-x86_64-gcc
echo C:\msys64\usr\bin\bash.exe -lc "pacman -S --noconfirm mingw-w64-x86_64-gcc" echo 3. Add C:\msys64\mingw64\bin to your PATH
exit /b 1 echo 4. Restart your terminal and run this script again
echo.
exit /b 1
) )
) else ( ) else (
echo ✓ GCC found: echo ✓ GCC found: