From 5e902262c5c83561faeff39e3d6e23c24efdaf85 Mon Sep 17 00:00:00 2001 From: Stu Date: Tue, 9 Dec 2025 12:08:58 -0500 Subject: [PATCH] Improve build script: remove aggressive cache cleaning and add auto dependency check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: - Removed -modcache flag that was deleting Go modules unnecessarily - Changed from -cache -modcache -testcache to just go clean - Added automatic system dependency detection (X11 libs) - Will attempt to install missing deps automatically if found - Keeps Go module cache intact between builds for faster compilation This fixes the issue where builds would fail after cache cleaning due to missing Go modules, while still checking for required system libraries. ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/build-linux.sh | 52 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 80a7f81..ba61c99 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -1,6 +1,6 @@ #!/bin/bash # VT_Player Build Script -# Cleans dependencies and builds the application with proper error handling +# Builds the application with proper dependency checking set -e @@ -25,16 +25,54 @@ 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" +# Check for system dependencies (X11 development libraries) +echo "๐Ÿ” Checking system dependencies..." +MISSING_DEPS=() + +# Check for essential X11 libraries needed by Fyne/GLFW +if ! pkg-config --exists x11 2>/dev/null; then + MISSING_DEPS+=("libX11-devel") +fi +if ! pkg-config --exists xcursor 2>/dev/null; then + MISSING_DEPS+=("libXcursor-devel") +fi +if ! pkg-config --exists xrandr 2>/dev/null; then + MISSING_DEPS+=("libXrandr-devel") +fi +if ! pkg-config --exists gl 2>/dev/null; then + MISSING_DEPS+=("mesa-libGL-devel") +fi + +if [ ${#MISSING_DEPS[@]} -gt 0 ]; then + echo "โš ๏ธ Missing system dependencies: ${MISSING_DEPS[*]}" + echo "๐Ÿ“ฅ Attempting to install dependencies..." + + if [ -f "$PROJECT_ROOT/scripts/install-deps-linux.sh" ]; then + bash "$PROJECT_ROOT/scripts/install-deps-linux.sh" || { + echo "โŒ Failed to install dependencies automatically" + echo "Please run: sudo bash $PROJECT_ROOT/scripts/install-deps-linux.sh" + exit 1 + } + else + echo "โŒ Dependency installer not found" + echo "Please install missing packages manually: ${MISSING_DEPS[*]}" + exit 1 + fi +else + echo "โœ“ System dependencies OK" +fi echo "" -echo "โฌ‡๏ธ Downloading and verifying dependencies..." +echo "๐Ÿงน Cleaning previous build..." +rm -f "$BUILD_OUTPUT" 2>/dev/null || true +go clean 2>/dev/null || true +echo "โœ“ Cleaned" +echo "" + +echo "โฌ‡๏ธ Ensuring Go modules are downloaded..." go mod download go mod verify -echo "โœ“ Dependencies verified" +echo "โœ“ Dependencies ready" echo "" echo "๐Ÿ”จ Building VT_Player..."