From 134f257521d39b8f7ed585db2a85bfbe7ceb40d6 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Wed, 5 Feb 2020 09:45:22 +0100 Subject: [PATCH] fix build with gcc 10 --- 0001-fix-build-with-gcc-10.patch | 66 ++++++++++++++++++++++++++++++++ mupdf.spec | 9 ++++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 0001-fix-build-with-gcc-10.patch diff --git a/0001-fix-build-with-gcc-10.patch b/0001-fix-build-with-gcc-10.patch new file mode 100644 index 0000000..7ca64d1 --- /dev/null +++ b/0001-fix-build-with-gcc-10.patch @@ -0,0 +1,66 @@ +From 33349b6cebcca0ac9db79177c046fa153c073470 Mon Sep 17 00:00:00 2001 +Message-Id: <33349b6cebcca0ac9db79177c046fa153c073470.1580897265.git.mjg@fedoraproject.org> +From: Michael J Gruber +Date: Wed, 5 Feb 2020 11:07:38 +0100 +Subject: [PATCH] fix build with gcc 10 + +gcc 10 uses -fno-common by default, so that mupdf fails to build: the +linker raises "multiple definition" errors the the definitions in +fg_gl2.h which were supposed to be declarations. Mark them as such and +move the definition to fg_gl2.c. + +Signed-off-by: Michael J Gruber +--- + src/fg_gl2.c | 10 ++++++++++ + src/fg_gl2.h | 14 +++++++------- + 2 files changed, 17 insertions(+), 7 deletions(-) + +diff --git a/src/fg_gl2.c b/src/fg_gl2.c +index 38b0acb..a9ccdf1 100644 +--- a/src/fg_gl2.c ++++ b/src/fg_gl2.c +@@ -27,6 +27,16 @@ + #include "fg_internal.h" + #include "fg_gl2.h" + ++#ifndef GL_ES_VERSION_2_0 ++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 +index ab8ba5c..fb3d467 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 + +-- +2.25.0.231.gf1b37f75f4 + diff --git a/mupdf.spec b/mupdf.spec index a35d959..44777ee 100644 --- a/mupdf.spec +++ b/mupdf.spec @@ -1,6 +1,6 @@ Name: mupdf Version: 1.16.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A lightweight PDF viewer and toolkit License: AGPLv3+ URL: http://mupdf.com/ @@ -22,6 +22,7 @@ Provides: bundled(freeglut-devel) = 3.0.0 # version so bundling them is the safer choice. Provides: bundled(mujs-devel) = 1.0.5 Patch0: 0001-fix-build-on-big-endian.patch +Patch1: 0001-fix-build-with-gcc-10.patch %description MuPDF is a lightweight PDF viewer and toolkit written in portable C. @@ -54,6 +55,7 @@ do rm -rf thirdparty/$d done %patch0 -p1 -d thirdparty/lcms2 +%patch1 -p1 -d thirdparty/freeglut echo > user.make "\ USE_SYSTEM_FREETYPE := yes USE_SYSTEM_HARFBUZZ := yes @@ -64,7 +66,7 @@ echo > user.make "\ USE_SYSTEM_MUJS := no # build needs source anyways USE_SYSTEM_OPENJPEG := yes USE_SYSTEM_ZLIB := yes - USE_SYSTEM_GLUT := no # need freeglut2-art frok + USE_SYSTEM_GLUT := no # need freeglut2-art fork USE_SYSTEM_CURL := yes " @@ -100,6 +102,9 @@ cd %{buildroot}/%{_bindir} && ln -s %{name}-x11 %{name} %{_libdir}/lib%{name}*.a %changelog +* Wed Feb 05 2020 Michael J Gruber - 1.16.1-3 +- fix build with gcc 10 + * Wed Jan 29 2020 Fedora Release Engineering - 1.16.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild