summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2020-02-26 00:37:47 +0100
committerDavid Seifert <soap@gentoo.org>2020-02-26 00:37:47 +0100
commitf9102571b69d9fc05471a592fda252681fdfdef1 (patch)
treebc5453bda5c222b5796a34aff651274e10475f94 /media-libs/freeglut
parentkde-plasma: Drop KDE Plasma 5.18.1 (diff)
downloadgentoo-f9102571b69d9fc05471a592fda252681fdfdef1.tar.gz
gentoo-f9102571b69d9fc05471a592fda252681fdfdef1.tar.bz2
gentoo-f9102571b69d9fc05471a592fda252681fdfdef1.zip
media-libs/freeglut: Fix GCC 10 / -fno-common
Closes: https://bugs.gentoo.org/705840 Package-Manager: Portage-2.3.89, Repoman-2.3.20 Acked-by: Matt Turner <mattst88@gentoo.org> Signed-off-by: David Seifert <soap@gentoo.org>
Diffstat (limited to 'media-libs/freeglut')
-rw-r--r--media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch81
-rw-r--r--media-libs/freeglut/freeglut-3.2.1.ebuild1
2 files changed, 82 insertions, 0 deletions
diff --git a/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch b/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch
new file mode 100644
index 000000000000..655c01bf94b4
--- /dev/null
+++ b/media-libs/freeglut/files/freeglut-3.2.1-gcc10-fno-common.patch
@@ -0,0 +1,81 @@
+From 5791564dd934d193df771a0a7c52013e9f456aa1 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue, 21 Jan 2020 22:33:49 +0000
+Subject: [PATCH] fg_gl2: fix build failure against gcc-10
+
+On gcc-10 (and gcc-9 -fno-common) build fails as:
+
+```
+[ 31%] Linking C executable bin/Lorenz_static
+/usr/bin/cmake -E cmake_link_script CMakeFiles/Lorenz_static.dir/link.txt --verbose=1
+/usr/lib/ccache/bin/cc -Wall -pedantic -rdynamic CMakeFiles/Lorenz_static.dir/progs/demos/Lorenz/lorenz.c.o \
+ -o bin/Lorenz_static -lGLU -lGL -lm -lX11 -lXrandr -lXxf86vm -lXi -lm lib/libglut.a -lGL -lm -lX11 -lXrandr -lXxf86vm -lXi
+ld: lib/libglut.a(fg_gl2.c.o):(.bss+0x0):
+ multiple definition of `fghGenBuffers'; lib/libglut.a(fg_window.c.o):(.bss+0x0): first defined here
+ld: lib/libglut.a(fg_gl2.c.o):(.bss+0x8):
+ multiple definition of `fghDeleteBuffers'; lib/libglut.a(fg_window.c.o):(.bss+0x8): first defined here
+```
+
+Note: duplicate definition comes here from 'fg_gl2.h'.
+The fix is to move declaration to a 'fg_gl2.c' file.
+
+gcc-10 will change the default from -fcommon to fno-common:
+https://gcc.gnu.org/PR85678.
+
+The error also happens if CFLAGS=-fno-common passed explicitly.
+
+Bug: https://bugs.gentoo.org/705840
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/fg_gl2.c | 12 ++++++++++++
+ src/fg_gl2.h | 14 +++++++-------
+ 2 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/freeglut/freeglut/src/fg_gl2.c b/freeglut/freeglut/src/fg_gl2.c
+index 38b0acbb..f79c432a 100644
+--- a/src/fg_gl2.c
++++ b/src/fg_gl2.c
+@@ -27,6 +27,18 @@
+ #include "fg_internal.h"
+ #include "fg_gl2.h"
+
++#ifdef GL_ES_VERSION_2_0
++/* Use existing functions on GLES 2.0 */
++#else
++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/freeglut/freeglut/src/fg_gl2.h b/freeglut/freeglut/src/fg_gl2.h
+index ab8ba5c7..fb3d4676 100644
+--- 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
+
diff --git a/media-libs/freeglut/freeglut-3.2.1.ebuild b/media-libs/freeglut/freeglut-3.2.1.ebuild
index 5efa6e624137..dec72e4fdd67 100644
--- a/media-libs/freeglut/freeglut-3.2.1.ebuild
+++ b/media-libs/freeglut/freeglut-3.2.1.ebuild
@@ -27,6 +27,7 @@ DEPEND="${RDEPEND}
x11-base/xorg-proto"
BDEPEND="virtual/pkgconfig"
+PATCHES=( "${FILESDIR}"/${PN}-3.2.1-gcc10-fno-common.patch )
HTML_DOCS=( doc/. )
src_configure() {