glew: add patch for mesa >= 24.0.0 (#50401)

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Veselin Dobrev 2025-05-15 23:19:23 -07:00 committed by GitHub
parent 600336eba5
commit 6e98f88c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,57 @@
diff -r -u a/src/glew.c b/src/glew.c
--- a/src/glew.c 2020-03-15 04:53:59.000000000 -0700
+++ b/src/glew.c 2025-05-10 09:30:10.610259000 -0700
@@ -38,7 +38,15 @@
#if defined(GLEW_OSMESA)
# define GLAPI extern
+# ifndef APIENTRY
+# define APIENTRY
+# define GLEW_APIENTRY_DEFINED
+# endif
# include <GL/osmesa.h>
+# ifdef GLEW_APIENTRY_DEFINED
+# undef APIENTRY
+# undef GLEW_APIENTRY_DEFINED
+# endif
#elif defined(GLEW_EGL)
# include <GL/eglew.h>
#elif defined(_WIN32)
diff -r -u a/src/glewinfo.c b/src/glewinfo.c
--- a/src/glewinfo.c 2020-03-15 04:53:59.000000000 -0700
+++ b/src/glewinfo.c 2025-05-10 09:45:02.853885000 -0700
@@ -38,7 +38,15 @@
#include <GL/eglew.h>
#elif defined(GLEW_OSMESA)
#define GLAPI extern
+#ifndef APIENTRY
+# define APIENTRY
+# define GLEW_APIENTRY_DEFINED
+#endif
#include <GL/osmesa.h>
+#ifdef GLEW_APIENTRY_DEFINED
+# undef APIENTRY
+# undef GLEW_APIENTRY_DEFINED
+#endif
#elif defined(_WIN32)
#include <GL/wglew.h>
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
diff -r -u a/src/visualinfo.c b/src/visualinfo.c
--- a/src/visualinfo.c 2020-03-15 04:53:59.000000000 -0700
+++ b/src/visualinfo.c 2025-05-10 09:45:38.136185000 -0700
@@ -36,7 +36,15 @@
#include <GL/glew.h>
#if defined(GLEW_OSMESA)
#define GLAPI extern
+#ifndef APIENTRY
+# define APIENTRY
+# define GLEW_APIENTRY_DEFINED
+#endif
#include <GL/osmesa.h>
+#ifdef GLEW_APIENTRY_DEFINED
+# undef APIENTRY
+# undef GLEW_APIENTRY_DEFINED
+#endif
#elif defined(GLEW_EGL)
#include <GL/eglew.h>
#elif defined(_WIN32)

View File

@ -28,6 +28,9 @@ class Glew(CMakePackage):
# glu is already forcibly disabled in the CMakeLists.txt. This prevents
# it from showing up in the .pc file
patch("remove-pkgconfig-glu-dep.patch")
# Define APIENTRY in osmesa build if not defined, see
# https://github.com/nigels-com/glew/pull/407
patch("mesa-24.0.0-osmesa.patch", when="^mesa@24.0.0:")
def cmake_args(self):
spec = self.spec