commit:     bbc1cc4fdc520d6dc814d0af9dc3f1a808995137
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 13 02:15:12 2025 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Mon Jan 13 02:27:54 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbc1cc4f

sci-mathematics/pari: fix build with gcc-15

Closes: https://bugs.gentoo.org/947939
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/pari-2.17.1-gcc15-swap-conflict.patch    | 53 ++++++++++++++++++++++
 sci-mathematics/pari/pari-2.17.1.ebuild            |  2 +
 2 files changed, 55 insertions(+)

diff --git a/sci-mathematics/pari/files/pari-2.17.1-gcc15-swap-conflict.patch 
b/sci-mathematics/pari/files/pari-2.17.1-gcc15-swap-conflict.patch
new file mode 100644
index 000000000000..7e26784cd91c
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.17.1-gcc15-swap-conflict.patch
@@ -0,0 +1,53 @@
+From 4cce8c7b9107053ffd1bb0d6510797dafd632151 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Sun, 12 Jan 2025 21:02:40 -0500
+Subject: [PATCH] src/graph/plotfltk.c: swap PARI and FLTK includes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+PARI defines a swap() macro that conflicts with the swap() function
+declared in some C++ headers used by FLTK. This can lead to build
+failures like
+
+  /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/alloc_traits.h
+  :1005:46:error: macro ‘swap’ requires 2 arguments, but only 1 given
+   1005 |                 __c.get_allocator()).swap(__c);
+        |                                              ^
+
+when using the forthcoming g++-15 to build PARI. Basically this fails
+because the macro is defined before the C++ headers are included. If
+we swap the includes, then the macro clobbers the function, but that's
+okay because PARI only expects the macro to be in scope.
+---
+ src/graph/plotfltk.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/graph/plotfltk.c b/src/graph/plotfltk.c
+index f81515d..e95275e 100644
+--- a/src/graph/plotfltk.c
++++ b/src/graph/plotfltk.c
+@@ -18,16 +18,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
MA 02110-1301 USA. */
+ //
+ //  Based on plotQt by Nils-Peter Skoruppa (www.countnumber.de)
+ /////////////////////////////////////////////////////////////////////////////
++#include <FL/Fl.H>
++#include <FL/Fl_Window.H>
++#include <FL/fl_draw.H>
++
+ extern "C" {
+ #include "pari.h"
+ #include "paripriv.h"
+ #include "rect.h"
+ }
+ 
+-#include <FL/Fl.H>
+-#include <FL/Fl_Window.H>
+-#include <FL/fl_draw.H>
+-
+ class Plotter: public Fl_Window {
+ 
+ public:
+-- 
+2.47.1
+

diff --git a/sci-mathematics/pari/pari-2.17.1.ebuild 
b/sci-mathematics/pari/pari-2.17.1.ebuild
index 87d6c983af01..d67e5caa41c3 100644
--- a/sci-mathematics/pari/pari-2.17.1.ebuild
+++ b/sci-mathematics/pari/pari-2.17.1.ebuild
@@ -33,6 +33,8 @@ DEPEND="
        X? ( x11-libs/libX11:0= )"
 RDEPEND="${DEPEND}"
 
+PATCHES=( "${FILESDIR}/${P}-gcc15-swap-conflict.patch" )
+
 src_prepare() {
        default
 

Reply via email to