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 0000000000000..7e26784cd91c6 --- /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 +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 ++#include ++#include ++ + extern "C" { + #include "pari.h" + #include "paripriv.h" + #include "rect.h" + } + +-#include +-#include +-#include +- + 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 87d6c983af01f..d67e5caa41c32 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