From cac3383d4f192004573916be0ca05c1506c56a1e Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 17 Nov 2025 14:26:46 +0100 Subject: [PATCH] [godot] Fix compile_commands.json generation on Ubuntu without X11 The setup.sh script was always trying to generate compile_commands.json for IDE integration, which triggered SCons platform auto-detection. On Ubuntu runners without X11 libraries (used for Android/Web builds), this caused the build to fail. Changes: - Only generate compile_commands.json in dev mode (CI uses dev=false) - Explicitly specify the platform parameter for SCons - On Linux, check if X11 libraries are available before attempting generation - Skip generation gracefully if X11 is not available This fixes the Android and Web template builds in GitHub Actions. --- spine-godot/build/setup.sh | 60 ++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/spine-godot/build/setup.sh b/spine-godot/build/setup.sh index c25a78c1a..1739bb673 100755 --- a/spine-godot/build/setup.sh +++ b/spine-godot/build/setup.sh @@ -72,31 +72,47 @@ fi popd -# Generate compile_commands.json for IDE integration -echo "Generating compile_commands.json for IDE integration..." -pushd ../godot > /dev/null +# Generate compile_commands.json for IDE integration (only in dev mode) +if [ $dev = "true" ]; then + echo "Generating compile_commands.json for IDE integration..." + pushd ../godot > /dev/null -# Detect architecture for macOS -arch="" -if [[ "$OSTYPE" == "darwin"* ]]; then - if [ `uname -m` == "arm64" ]; then - arch="arch=arm64" + # Detect architecture for macOS + arch="" + platform="" + if [[ "$OSTYPE" == "darwin"* ]]; then + if [ `uname -m` == "arm64" ]; then + arch="arch=arm64" + else + arch="arch=x86_64" + fi + platform="platform=osx" + elif [[ "$OSTYPE" == "msys"* ]] || [[ "$OSTYPE" == "win32"* ]]; then + platform="platform=windows" else - arch="arch=x86_64" + # Linux - only generate if X11 dev libraries are available + if pkg-config --exists x11 2>/dev/null; then + platform="platform=x11" + else + echo "Skipping compile_commands.json generation (X11 libraries not available)" + popd > /dev/null + popd > /dev/null + exit 0 + fi fi + + # Generate compilation database without building + scons compiledb=yes custom_modules="../spine_godot" opengl3=yes $platform $arch compiledb + + # Copy to parent directory for easy IDE access + if [ -f compile_commands.json ]; then + cp compile_commands.json .. + echo "compile_commands.json generated successfully and copied to spine-godot/" + else + echo "Warning: Failed to generate compile_commands.json" + fi + + popd > /dev/null fi -# Generate compilation database without building -scons compiledb=yes custom_modules="../spine_godot" opengl3=yes $arch compiledb - -# Copy to parent directory for easy IDE access -if [ -f compile_commands.json ]; then - cp compile_commands.json .. - echo "compile_commands.json generated successfully and copied to spine-godot/" -else - echo "Warning: Failed to generate compile_commands.json" -fi - -popd > /dev/null - popd > /dev/null \ No newline at end of file