commit:     3086ccda6f92ed547d6361be5b15870ad8c5da61
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Wed Mar 26 10:36:34 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 12 20:57:20 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3086ccda

sci-mathematics/msieve: Port to C23

Closes: https://bugs.gentoo.org/920312
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/41303
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../msieve/files/msieve-1.53-gzfile.patch          | 25 +++++++++
 sci-mathematics/msieve/msieve-1.53-r2.ebuild       | 61 ++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/sci-mathematics/msieve/files/msieve-1.53-gzfile.patch 
b/sci-mathematics/msieve/files/msieve-1.53-gzfile.patch
new file mode 100644
index 000000000000..981a747eadd6
--- /dev/null
+++ b/sci-mathematics/msieve/files/msieve-1.53-gzfile.patch
@@ -0,0 +1,25 @@
+Don't double-pointer and then assign from single-pointer
+Fixes compilation with GCC-15
+https://bugs.gentoo.org/920312
+--- a/common/savefile.c
++++ b/common/savefile.c
+@@ -152,7 +152,7 @@
+                       fclose(fp);
+               }
+               if (s->is_a_FILE) {
+-                      s->fp = (gzFile *)fopen(s->name, "a");
++                      s->fp = (gzFile)fopen(s->name, "a");
+               } else {
+                       s->fp = gzopen(s->name, "a");
+                       s->isCompressed = 1;
+--- a/include/msieve.h
++++ b/include/msieve.h
+@@ -101,7 +101,7 @@
+       uint32 read_size;
+       uint32 eof;
+ #else
+-      gzFile *fp;
++      gzFile fp;
+       char isCompressed;
+       char is_a_FILE;
+ #endif

diff --git a/sci-mathematics/msieve/msieve-1.53-r2.ebuild 
b/sci-mathematics/msieve/msieve-1.53-r2.ebuild
new file mode 100644
index 000000000000..7989eeb85b3c
--- /dev/null
+++ b/sci-mathematics/msieve/msieve-1.53-r2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="A C library implementing a suite of algorithms to factor large 
integers"
+HOMEPAGE="https://sourceforge.net/projects/msieve/";
+SRC_URI="https://downloads.sourceforge.net/${PN}/${PN}/Msieve%20v${PV}/${PN}${PV/./}_src.tar.gz
 -> ${P}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="zlib +ecm mpi"
+
+RDEPEND="
+       ecm? ( sci-mathematics/gmp-ecm )
+       mpi? ( virtual/mpi )
+       zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       # TODO: Integrate ggnfs properly
+       "${FILESDIR}"/${PN}-1.51-reduce-printf.patch
+       "${FILESDIR}"/${PN}-1.53-fix-version.patch
+       "${FILESDIR}"/${PN}-1.53-makefile.patch
+       "${FILESDIR}"/${PN}-1.53-gzfile.patch
+)
+
+src_configure() {
+       tc-export AR CC RANLIB
+
+       use ecm && export ECM=1
+
+       if use mpi; then
+               export MPI=1
+               export CC=mpicc
+       fi
+
+       use zlib && export ZLIB=1
+}
+
+src_compile() {
+       emake all
+}
+
+src_test() {
+       "${S}"/msieve 3595 || die Failed to factor small semiprime
+}
+
+src_install() {
+       dobin msieve
+
+       insinto /usr/include/msieve
+       doins -r include/.
+
+       dolib.a libmsieve.a
+
+       dodoc Readme*
+}

Reply via email to