From 6692e3d93620d4cafb65c4a1aac7e710496d0d3f Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 21 Mar 2026 09:56:26 -0700 Subject: [PATCH] imgui: add libGL --- imgui/build.sh | 16 ++++++++++++++++ imgui/imgui/__init__.py | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/imgui/build.sh b/imgui/build.sh index b777a42..c1497f9 100755 --- a/imgui/build.sh +++ b/imgui/build.sh @@ -105,5 +105,21 @@ cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/" cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/" cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/" +# Bundle GLVND dispatchers so Linux users don't need system libGL +if [[ "$(uname)" == "Linux" ]]; then + MESA_DIR="$INSTALL_DIR/lib/mesa" + mkdir -p "$MESA_DIR" + ldconfig 2>/dev/null || true + for lib in libGL.so.1 libGLX.so.0 libEGL.so.1 libOpenGL.so.0 libGLdispatch.so.0; do + src="$(ldconfig -p 2>/dev/null | grep -F "$lib" | awk '{print $NF}' | head -1)" + if [ -n "$src" ] && [ -f "$src" ]; then + cp -L "$src" "$MESA_DIR/" + # Create unversioned symlink for the linker + base="${lib%%.so.*}" + ln -sf "$lib" "$MESA_DIR/${base}.so" + fi + done +fi + echo "Installed imgui to $INSTALL_DIR" du -sh "$INSTALL_DIR" diff --git a/imgui/imgui/__init__.py b/imgui/imgui/__init__.py index 8a528c6..9603aa5 100644 --- a/imgui/imgui/__init__.py +++ b/imgui/imgui/__init__.py @@ -1,9 +1,11 @@ import os +import platform as _platform DIR = os.path.join(os.path.dirname(__file__), "install") INCLUDE_DIR = os.path.join(DIR, "include") SRC_DIR = os.path.join(DIR, "src") LIB_DIR = os.path.join(DIR, "lib") +MESA_DIR = os.path.join(DIR, "lib", "mesa") def smoketest(): @@ -11,3 +13,5 @@ def smoketest(): assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found" assert os.path.isfile(os.path.join(LIB_DIR, "libglfw3.a")), "libglfw3.a not found" assert os.path.isfile(os.path.join(INCLUDE_DIR, "GLFW", "glfw3.h")), "GLFW/glfw3.h not found" + if _platform.system() == "Linux": + assert os.path.isfile(os.path.join(MESA_DIR, "libGL.so.1")), "libGL.so.1 not found"