patch to add support for legacy OpenGL (Thanks Rob Woolley)

| -- Found OpenGL: 
/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/freeglut/3.8.0/recipe-sysroot/usr/lib/libGL.so
  found components: OpenGL
| -- Found PkgConfig: 
/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/freeglut/3.8.0/recipe-sysroot-native/usr/bin/pkg-config
 (found version "0.29.2")
| CMake Error at 
/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/freeglut/3.8.0/recipe-sysroot-native/usr/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake:290
 (message):
|   Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY)

Changlog:

2025-11-16  John Tsiombikas <[email protected]>

        freeglut 3.8 changes:

        * New experimental Cocoa (native MacOS X) backend.
        * Add glutSwapInterval, to control vsync (currently X11 and win32 only).
        * glutExtensionSupported now also reports platform extensions (GLX/WGL).
        * Fix build issues with new cmake versions while maintaining
          compatibility with old cmake.
        * Fix handling of UTF8 window/icon titles.
        * Fix issue with some X11 window managers not properly restoring
          iconified windows (send _NET_ACTIVE_WINDOW EWMH client message).
        * Fix build issues with C23 compilers (empty argument list semantics).
        * Fix compatibility with older versions of windows which don't have
          RAWHID support (before XP), by loading the entry points dynamically.
        * Fix glutInitDisplayString parsing of "aux", and add =N parsing support
          to specify samples and auxbufs.
        * Various fixes and improvements in the GameCube/Wii backend.
        * Altbuild support for Solaris 2.6/SUN Workshop C.
        * Started conversion of documentation from the website to markdown in
          the source tree: doc/api.md
        * Added the original GLUT manpages, with permission from Mark Kilgard.
        * New demos: accum, vsync, and windows.
        * Cleanup of some old and no longer relevant, or redundant comments in
          the source code.
        * Removed some out of date README files, and updated others.

2024-06-08  John Tsiombikas <[email protected]>

        freeglut 3.6 changes:

        * New platforms: Nintendo Gamecube and Nintendo Wii.
        * Minimum cmake version raised to 3.1.
        * Make XInput an optional dependency.
        * Fix incorrect modifier bit mapped to GLUT_ACTIVE_SUPER on X11.
        * Add support for ARM64 MSVC targets.
        * Fix for unicode builds on windows.
        * Fix build on some versions of MinGW carrying an incorrect winuser.h.
        * Fix menu-related memory leak when an error occurs.
        * Various build improvements & fixes.

Signed-off-by: Jan Vermaete <[email protected]>
---
 .../0001-Add-support-for-legacy-OpenGL.patch  | 45 +++++++++++++++++++
 .../{freeglut_3.4.0.bb => freeglut_3.8.0.bb}  | 14 +++---
 2 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 
meta-oe/recipes-graphics/freeglut/freeglut/0001-Add-support-for-legacy-OpenGL.patch
 rename meta-oe/recipes-graphics/freeglut/{freeglut_3.4.0.bb => 
freeglut_3.8.0.bb} (73%)

diff --git 
a/meta-oe/recipes-graphics/freeglut/freeglut/0001-Add-support-for-legacy-OpenGL.patch
 
b/meta-oe/recipes-graphics/freeglut/freeglut/0001-Add-support-for-legacy-OpenGL.patch
new file mode 100644
index 0000000000..b7dc2a58aa
--- /dev/null
+++ 
b/meta-oe/recipes-graphics/freeglut/freeglut/0001-Add-support-for-legacy-OpenGL.patch
@@ -0,0 +1,45 @@
+From a4c51ae7897f1ad82d10e593344511b3d7b81dbc Mon Sep 17 00:00:00 2001
+From: Jan Vermaete <[email protected]>
+Date: Wed, 24 Dec 2025 12:58:36 +0100
+Subject: [PATCH 1/1] Add support for legacy OpenGL
+
+Upstream-Status: Pending
+
+Signed-off-by: Rob Woolley <[email protected]>
+Commited-by: Jan Vermaete <[email protected]>
+---
+ CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 23741bf..31b3ac8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -378,13 +378,13 @@ IF(FREEGLUT_GLES)
+       FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL)
+       CMAKE_PATH(GET OPENGL_gles2_LIBRARY PARENT_PATH _OPENGL_LIBDIR)
+       FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR} REQUIRED)
+-      LIST(APPEND LIBS ${GLES1_LIBRARY} OpenGL::EGL OpenGL::GLES2 
OpenGL::OpenGL)
++      LIST(APPEND LIBS ${GLES1_LIBRARY} OpenGL::EGL OpenGL::GLES2 OpenGL::GL)
+     elseif(NOT CMAKE_VERSION VERSION_LESS "3.10")
+       FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL)
+       GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${OPENGL_egl_LIBRARY} DIRECTORY)
+       FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR})
+       FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR})
+-      LIST(APPEND LIBS ${GLES1_LIBRARY} ${GLES2_LIBRARY} OpenGL::EGL 
OpenGL::OpenGL)
++      LIST(APPEND LIBS ${GLES1_LIBRARY} ${GLES2_LIBRARY} OpenGL::EGL 
OpenGL::GL)
+     else()
+       FIND_PACKAGE(OpenGL REQUIRED)
+       LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB)
+@@ -433,7 +433,7 @@ IF(FREEGLUT_WAYLAND)
+   INCLUDE(FindPkgConfig)
+   if(NOT CMAKE_VERSION VERSION_LESS "3.10")
+     FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL)
+-    LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL)
++    LIST(APPEND LIBS OpenGL::EGL OpenGL::GL)
+   else()
+     FIND_PACKAGE(OpenGL REQUIRED)
+     LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB)
+-- 
+2.47.3
+
diff --git a/meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb 
b/meta-oe/recipes-graphics/freeglut/freeglut_3.8.0.bb
similarity index 73%
rename from meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb
rename to meta-oe/recipes-graphics/freeglut/freeglut_3.8.0.bb
index 13f3d111fe..5c6ab1a1d7 100644
--- a/meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb
+++ b/meta-oe/recipes-graphics/freeglut/freeglut_3.8.0.bb
@@ -4,21 +4,25 @@ HOMEPAGE = "https://freeglut.sourceforge.net";
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=89c0b58a3e01ce3d8254c9f59e78adfb"
 
-SRC_URI = 
"https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BPN}-${PV}.tar.gz";
-SRC_URI[sha256sum] = 
"3c0bcb915d9b180a97edaebd011b7a1de54583a838644dcd42bb0ea0c6f3eaec"
+SRC_URI = "\
+    
https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BPN}-${PV}.tar.gz \
+    file://0001-Add-support-for-legacy-OpenGL.patch \
+    "
+SRC_URI[sha256sum] = 
"674dcaff25010e09e450aec458b8870d9e98c46f99538db457ab659b321d9989"
 
 inherit cmake features_check pkgconfig
 
-EXTRA_OECMAKE = "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
-
 # depends on virtual/libgl and libxi
 REQUIRED_DISTRO_FEATURES = "opengl x11"
 
-PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11 glvnd', 
d)} \
+                  ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles', 
'', d)}"
+PACKAGECONFIG[glvnd] = 
"-DOpenGL_GL_PREFERENCE=GLVND,-DOpenGL_GL_PREFERENCE=LEGACY, libglvnd"
 PACKAGECONFIG[gles] = "-DFREEGLUT_GLES=ON,-DFREEGLUT_GLES=OFF,"
 PACKAGECONFIG[wayland] = 
"-DFREEGLUT_WAYLAND=ON,-DFREEGLUT_WAYLAND=OFF,libxkbcommon"
 PACKAGECONFIG[demos] = "-DFREEGLUT_BUILD_DEMOS=ON,-DFREEGLUT_BUILD_DEMOS=OFF,"
 PACKAGECONFIG[x11] = ",,virtual/libx11 libice libxmu libglu libxrandr libxext"
+
 # Add -Wno-implicit-function-declaration since it might be otherwise treated at
 # error by clang16+ and this is not really a problem
 CFLAGS += "-Wno-implicit-function-declaration"
-- 
2.47.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#122882): 
https://lists.openembedded.org/g/openembedded-devel/message/122882
Mute This Topic: https://lists.openembedded.org/mt/116928060/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to