summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2025-04-09 19:33:46 +0200
committerSebastian Rasmussen <sebras@gmail.com>2025-04-09 23:55:16 +0200
commit9586102c806cc859d3d0e4de7e1cf65d1e414be2 (patch)
tree4d96cfe325b0a2cb35f13d51197743a7bbe404ad
parent631414cb25920fa1308f7b03c8fc6794c6683c10 (diff)
Always get GL cflags/libs from the system.
-rw-r--r--Makelists5
-rw-r--r--Makerules13
-rw-r--r--Makethird8
3 files changed, 15 insertions, 11 deletions
diff --git a/Makelists b/Makelists
index d1f4d1eef..c3d7d0ba0 100644
--- a/Makelists
+++ b/Makelists
@@ -362,6 +362,7 @@ GLUT_BUILD_CFLAGS += -Ithirdparty/freeglut/src
GLUT_BUILD_CFLAGS += -DHAVE_UNISTD_H
GLUT_BUILD_CFLAGS += -DHAVE_STDINT_H
GLUT_BUILD_CFLAGS += -DHAVE_X11_EXTENSIONS_XRANDR_H
+GLUT_BUILD_CFLAGS += $(SYS_GL_CFLAGS)
GLUT_SRC += thirdparty/freeglut/src/fg_callbacks.c
GLUT_SRC += thirdparty/freeglut/src/fg_cursor.c
@@ -406,9 +407,7 @@ GLUT_SRC += thirdparty/freeglut/src/x11/fg_window_x11.c
GLUT_SRC += thirdparty/freeglut/src/x11/fg_window_x11_glx.c
GLUT_SRC += thirdparty/freeglut/src/x11/fg_xinput_x11.c
-GLUT_LIBS += -lGL
-GLUT_LIBS += -lX11
-GLUT_LIBS += -lXrandr
+GLUT_LIBS += $(SYS_GL_LIBS)
# --- LEPTONICA (optional, used by Tesseract) ---
diff --git a/Makerules b/Makerules
index f50f5d0d2..bbe48821e 100644
--- a/Makerules
+++ b/Makerules
@@ -265,12 +265,17 @@ else
HAVE_GLUT := yes
ifeq ($(HAVE_GLUT),yes)
- ifeq ($(shell pkg-config --exists glut gl && echo yes),yes)
- SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut gl)
- SYS_GLUT_LIBS := $(shell pkg-config --libs glut gl)
+ ifneq ($(shell pkg-config --exists gl x11 xrandr && echo yes),yes)
+ $(error GLUT depends on gl, x11 and xrandr from the system, but some are missing)
+ endif
+ SYS_GL_CFLAGS := $(shell pkg-config --cflags gl x11 xrandr)
+ SYS_GL_LIBS := $(shell pkg-config --libs gl x11 xrandr)
+ ifeq ($(shell pkg-config --exists glut && echo yes),yes)
+ SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut)
+ SYS_GLUT_LIBS := $(shell pkg-config --libs glut)
else
SYS_GLUT_CFLAGS :=
- SYS_GLUT_LIBS := -lglut -lGL
+ SYS_GLUT_LIBS := -lglut
endif
endif
diff --git a/Makethird b/Makethird
index c3bfc02b2..623a1be77 100644
--- a/Makethird
+++ b/Makethird
@@ -240,11 +240,11 @@ endif
# --- FreeGLUT ---
ifeq ($(USE_SYSTEM_GLUT),yes)
- THIRD_GLUT_CFLAGS += $(SYS_GLUT_CFLAGS)
- THIRD_GLUT_LIBS += $(SYS_GLUT_LIBS)
+ THIRD_GLUT_CFLAGS += $(SYS_GLUT_CFLAGS) $(SYS_GL_CFLAGS)
+ THIRD_GLUT_LIBS += $(SYS_GLUT_LIBS) $(SYS_GL_LIB)S
else
- THIRD_GLUT_CFLAGS += $(GLUT_CFLAGS)
- THIRD_GLUT_LIBS += $(GLUT_LIBS)
+ THIRD_GLUT_CFLAGS += $(GLUT_CFLAGS) $(SYS_GL_CFLAGS)
+ THIRD_GLUT_LIBS += $(GLUT_LIBS) $(SYS_GL_LIBS)
THIRD_GLUT_SRC += $(GLUT_SRC)
$(OUT)/thirdparty/freeglut/%.o: thirdparty/freeglut/%.c
$(CC_CMD) $(LIB_CFLAGS) $(GLUT_CFLAGS) $(GLUT_BUILD_CFLAGS)