summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-05-10 16:47:05 +0200
committerMarius Bakke <marius@gnu.org>2021-05-13 17:03:47 +0200
commit03b6cfa0c2e449e633681c69899bd1f14e99fb81 (patch)
tree2c42af8627f4d23372cad89df0dcba128895f976
parentbc0a78c003c63bf6886bc29f786a8ee82e95acff (diff)
downloadguix-03b6cfa0c2e449e633681c69899bd1f14e99fb81.tar.gz
gnu: freeglut: Fix build with GCC 10.
* gnu/packages/patches/freeglut-gcc-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/gl.scm (freeglut)[source](patches): New field.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/gl.scm1
-rw-r--r--gnu/packages/patches/freeglut-gcc-compat.patch53
3 files changed, 55 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 95f4626143..0e1e83b3d5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1018,6 +1018,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/fplll-std-fenv.patch     		\
   %D%/packages/patches/freedink-engine-fix-sdl-hints.patch	\
   %D%/packages/patches/freebayes-devendor-deps.patch		\
+  %D%/packages/patches/freeglut-gcc-compat.patch		\
   %D%/packages/patches/freeimage-unbundle.patch		\
   %D%/packages/patches/fuse-overlapping-headers.patch				\
   %D%/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch	\
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index b86f8218b2..ca16d2da69 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -107,6 +107,7 @@ as ASCII text.")
               (uri (string-append
                     "mirror://sourceforge/freeglut/freeglut/"
                     version "/freeglut-" version ".tar.gz"))
+              (patches (search-patches "freeglut-gcc-compat.patch"))
               (sha256
                (base32
                 "0s6sk49q8ijgbsrrryb7dzqx2fa744jhx1wck5cz5jia2010w06l"))))
diff --git a/gnu/packages/patches/freeglut-gcc-compat.patch b/gnu/packages/patches/freeglut-gcc-compat.patch
new file mode 100644
index 0000000000..126bbd89f4
--- /dev/null
+++ b/gnu/packages/patches/freeglut-gcc-compat.patch
@@ -0,0 +1,53 @@
+Fix build failure with GCC 10.
+
+Taken from upstream:
+https://github.com/dcnieho/FreeGLUT/commit/b9998bbc1e1c329f6bf69c24606a2be7a4973b8c
+
+diff --git a/src/fg_gl2.c b/src/fg_gl2.c
+--- a/src/fg_gl2.c
++++ b/src/fg_gl2.c
+@@ -27,6 +27,20 @@
+ #include "fg_internal.h"
+ #include "fg_gl2.h"
+ 
++#ifndef GL_ES_VERSION_2_0
++/* GLES2 has the corresponding entry points built-in, and these fgh-prefixed
++ * names are defined in fg_gl2.h header to reference them, for any other case,
++ * define them as function pointers here.
++ */
++FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++FGH_PFNGLBUFFERDATAPROC fghBufferData;
++FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++#endif
++
+ void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) {
+   if (fgStructure.CurrentWindow != NULL)
+     fgStructure.CurrentWindow->Window.attribute_v_coord = attrib;
+diff --git a/src/fg_gl2.h b/src/fg_gl2.h
+--- a/src/fg_gl2.h
++++ b/src/fg_gl2.h
+@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+ typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);
+ typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+ 
+-FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
+-FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
+-FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
+-FGH_PFNGLBUFFERDATAPROC fghBufferData;
+-FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
+-FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
+-FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++extern FGH_PFNGLBUFFERDATAPROC fghBufferData;
++extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
+ 
+ #    endif
+