VideoTools/scripts/build-linux.sh
Stu 30899b3512 Add Windows 11 compatibility and cross-platform build system
Ports Windows compatibility improvements from VideoTools to enable
VT_Player to build and run on Windows 11 alongside VideoTools.

Build System Enhancements:
- Universal build script auto-detects platform (Linux/macOS/Windows)
- Platform-specific build routing (build-linux.sh for Unix)
- Windows: Builds vt_player.exe with GUI flags (-H windowsgui)
- Windows: Automatic FFmpeg PATH detection
- Shares dependencies with VideoTools installation

Windows Console Hiding:
- Created internal/utils/proc_windows.go (Windows-specific)
- Created internal/utils/proc_other.go (Linux/macOS no-op)
- ApplyNoWindow() hides FFmpeg/ffprobe console windows on Windows
- Provides clean GUI experience without console popups

Cross-Platform Support:
- Build flags adapt to target platform automatically
- Go build tags for platform-specific code
- CGO enabled for all platforms (required by Fyne)
- Tested on Linux, ready for Windows 11

Documentation:
- WINDOWS_COMPATIBILITY.md: Complete Windows setup guide
- Explains dependency sharing with VideoTools
- Troubleshooting section for common issues
- Platform-specific build flag documentation

Benefits for Jake's Windows 11 Environment:
- Uses same MinGW-w64 toolchain as VideoTools
- Uses same FFmpeg installation (already on PATH)
- No additional dependency installation needed
- Build process identical to VideoTools

Technical Details:
- Windows GUI binary: vt_player.exe (~45MB)
- Linux/macOS binary: vt_player (~32MB)
- All platforms use CGO for Fyne OpenGL bindings
- syscall.SysProcAttr{HideWindow: true} for Windows processes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:10:57 -05:00

64 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# VT_Player Build Script
# Cleans dependencies and builds the application with proper error handling
set -e
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_OUTPUT="$PROJECT_ROOT/vt_player"
echo "════════════════════════════════════════════════════════════════"
echo " VT_Player Build Script"
echo "════════════════════════════════════════════════════════════════"
echo ""
# Check if go is installed
if ! command -v go &> /dev/null; then
echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later."
exit 1
fi
echo "📦 Go version:"
go version
echo ""
# Change to project directory
cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous builds and cache..."
go clean -cache -modcache -testcache 2>/dev/null || true
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
echo "✓ Cache cleaned"
echo ""
echo "⬇️ Downloading and verifying dependencies..."
go mod download
go mod verify
echo "✓ Dependencies verified"
echo ""
echo "🔨 Building VT_Player..."
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
export CGO_ENABLED=1
if go build -o "$BUILD_OUTPUT" .; then
echo "✓ Build successful!"
echo ""
echo "════════════════════════════════════════════════════════════════"
echo "✅ BUILD COMPLETE"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "Output: $BUILD_OUTPUT"
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
echo ""
echo "To run:"
echo " $PROJECT_ROOT/vt_player"
echo ""
echo "Or use the convenience script:"
echo " source $PROJECT_ROOT/scripts/alias.sh"
echo " vt_player"
echo ""
else
echo "❌ Build failed!"
exit 1
fi