commit:     ae2dae47a63f016b90020cf24b33e1876b65b429
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Sat Feb 22 19:43:22 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 24 21:26:09 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae2dae47

sci-mathematics/yafu: update EAPI 7 -> 8, fix build failure

Tricky problem with openmp types, consolidating seds, old patch and
fix-up for allowing toolchain functions and system environment into
one patch file

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

 .../yafu/files/yafu-1.34.3-Makefile.patch          | 11 ----
 .../yafu/files/yafu-1.34.3-fix-makefiles.patch     | 75 ++++++++++++++++++++++
 .../yafu/files/yafu-1.34.3-mpz_set.patch           | 14 ++++
 sci-mathematics/yafu/yafu-1.34.3-r1.ebuild         | 57 ----------------
 sci-mathematics/yafu/yafu-1.34.3-r2.ebuild         | 51 +++++++++++++++
 5 files changed, 140 insertions(+), 68 deletions(-)

diff --git a/sci-mathematics/yafu/files/yafu-1.34.3-Makefile.patch 
b/sci-mathematics/yafu/files/yafu-1.34.3-Makefile.patch
deleted file mode 100644
index bee579150c9d..000000000000
--- a/sci-mathematics/yafu/files/yafu-1.34.3-Makefile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -87,7 +87,7 @@ ifeq ($(CC),icc)
-       CFLAGS += -mtune=core2 -march=core2
- endif
- 
--LIBS += -lecm -lgmp
-+LIBS += -lecm -lgmp -lgomp
- 
- CFLAGS += $(OPT_FLAGS) $(WARN_FLAGS) $(INC)
-       

diff --git a/sci-mathematics/yafu/files/yafu-1.34.3-fix-makefiles.patch 
b/sci-mathematics/yafu/files/yafu-1.34.3-fix-makefiles.patch
new file mode 100644
index 000000000000..d077c7308bd2
--- /dev/null
+++ b/sci-mathematics/yafu/files/yafu-1.34.3-fix-makefiles.patch
@@ -0,0 +1,75 @@
+Conglomerates previous makefile fix, seds and fixes to let toolchain
+compiler and settings be used to the build system.
+Removes non-existing include and library directories that arose as result
+of initial development on mingw with hand-build dependencies.
+Replaces wrong default path to system ggnfs from "same directory" to "system 
binaries"
+Was sed:
+sed -i -e 
's~strcpy(fobj->nfs_obj.ggnfs_dir,"./");~strcpy(fobj->nfs_obj.ggnfs_dir,"/usr/bin/");~'
 factor/factor_common.c || die
+Must somehow include EPREFIX there...
+--- a/Makefile
++++ b/Makefile
+@@ -17,20 +17,13 @@
+ #                                        [email protected] 7/28/09
+ # ----------------------------------------------------------------------*/
+ 
+-CC = gcc
+ #CC = x86_64-w64-mingw32-gcc-4.5.1
+ #CFLAGS = -march=core2 -mtune=core2
+-CFLAGS = -g
+ WARN_FLAGS = -Wall # -Wconversion
+-OPT_FLAGS = -O3
+ INC = -I. -Iinclude
+ 
+ # modify these for your particular gmp/gmp-ecm installation
+-INC += -I../gmp/include
+-LIBS += -L../gmp/lib/linux/x86_64
+ 
+-INC += -I../gmp-ecm/include
+-LIBS += -L../gmp-ecm/lib/linux/x86_64
+ 
+ ifeq ($(STATIC),1)
+       CFLAGS += -static
+@@ -39,8 +32,6 @@
+ ifeq ($(PROFILE),1)
+       CFLAGS += -pg 
+       CFLAGS += -DPROFILING
+-else
+-      OPT_FLAGS += -fomit-frame-pointer
+ endif
+ 
+ # if this option is specified then compile *both* the sse2 and sse4.1 
versions of the
+@@ -87,7 +78,7 @@
+       CFLAGS += -mtune=core2 -march=core2
+ endif
+ 
+-LIBS += -lecm -lgmp
++LIBS += -lecm -lgmp -lgomp
+ 
+ CFLAGS += $(OPT_FLAGS) $(WARN_FLAGS) $(INC)
+       
+@@ -232,10 +223,10 @@
+       @echo "add 'PROFILE=1' to make with profiling enabled (slower) "
+ 
+ x86: $(MSIEVE_OBJS) $(YAFU_OBJS) $(YAFU_NFS_OBJS)
+-      $(CC) -m32 $(CFLAGS) $(MSIEVE_OBJS) $(YAFU_OBJS) $(YAFU_NFS_OBJS) -o 
yafu $(LIBS)
++      $(CC) $(LDFLAGS) -m32 $(CFLAGS) $(MSIEVE_OBJS) $(YAFU_OBJS) 
$(YAFU_NFS_OBJS) -o yafu $(LIBS)
+ 
+ x86_64: $(MSIEVE_OBJS) $(YAFU_OBJS) $(YAFU_NFS_OBJS)
+-      $(CC) $(CFLAGS) $(MSIEVE_OBJS) $(YAFU_OBJS) $(YAFU_NFS_OBJS) -o yafu 
$(LIBS)
++      $(CC) $(LDFLAGS) $(CFLAGS) $(MSIEVE_OBJS) $(YAFU_OBJS) $(YAFU_NFS_OBJS) 
-o yafu $(LIBS)
+ 
+ 
+ clean:
+
+--- a/factor/factor_common.c
++++ b/factor/factor_common.c
+@@ -296,7 +296,7 @@
+ #elif defined(WIN32)
+       strcpy(fobj->nfs_obj.ggnfs_dir,".\\");
+ #else
+-      strcpy(fobj->nfs_obj.ggnfs_dir,"./");
++      strcpy(fobj->nfs_obj.ggnfs_dir,"/usr/bin/");
+ #endif
+ 
+       //initialize autofactor object
+

diff --git a/sci-mathematics/yafu/files/yafu-1.34.3-mpz_set.patch 
b/sci-mathematics/yafu/files/yafu-1.34.3-mpz_set.patch
new file mode 100644
index 000000000000..523fef69745e
--- /dev/null
+++ b/sci-mathematics/yafu/files/yafu-1.34.3-mpz_set.patch
@@ -0,0 +1,14 @@
+Correct way to assign value to mpz_t is to use openmp's funcion-like macro,
+because it's horrible one-element array.
+https://bugs.gentoo.org/920324
+--- a/top/eratosthenes/soe_util.c
++++ b/top/eratosthenes/soe_util.c
+@@ -131,7 +131,7 @@
+                       sdata->pbound = sieve_p[num_sp - 1];
+                       sdata->pboundi = num_sp;
+               }
+-              sdata->offset = offset;
++              mpz_set(*(sdata->offset), offset);
+               mpz_clear(tmpz);
+               sdata->sieve_range = 1;
+       }

diff --git a/sci-mathematics/yafu/yafu-1.34.3-r1.ebuild 
b/sci-mathematics/yafu/yafu-1.34.3-r1.ebuild
deleted file mode 100644
index 0a965899b443..000000000000
--- a/sci-mathematics/yafu/yafu-1.34.3-r1.ebuild
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic
-
-MY_PV="$(ver_cut 1-2)"
-DESCRIPTION="Yet another factoring utility"
-HOMEPAGE="https://sourceforge.net/projects/yafu/";
-SRC_URI="https://downloads.sourceforge.net/${PN}/${MY_PV}/${PN}-${MY_PV}-src.zip";
-
-SLOT="0"
-LICENSE="public-domain"
-KEYWORDS="~amd64 ~x86"
-
-DEPEND="
-       || (
-               >=sys-devel/gcc-4.2:*[openmp]
-               llvm-core/clang-runtime:*[openmp]
-       )
-       dev-libs/gmp:0=
-       sci-mathematics/gmp-ecm"
-RDEPEND="${DEPEND}"
-BDEPEND="app-arch/unzip"
-
-PATCHES=( "${FILESDIR}"/${P}-Makefile.patch )
-
-src_prepare() {
-       default
-       sed -i \
-               -e 's:../gmp/include:gmp:' \
-               -e 's:../gmp-ecm/include:gmp-ecm:' \
-               -e 's:# LIBS += -L../msieve/lib/linux/x86_64:LIBS += -lmsieve 
-lz -ldl:' \
-               -e 's:CFLAGS = -g:#CFLAGS = -g:' \
-               -e '/$(LIBS)$/s:$(CC):$(CC) $(LDFLAGS):g' Makefile || die
-       sed -i -e 's:\"config.h\":<gmp-ecm/config.h>:g' top/driver.c || die
-
-       # proper ggnfs default path
-       sed -i -e 
's~strcpy(fobj->nfs_obj.ggnfs_dir,"./");~strcpy(fobj->nfs_obj.ggnfs_dir,"/usr/bin/");~'
 factor/factor_common.c || die
-}
-
-src_configure() {
-       append-cflags -fcommon
-       default
-}
-
-src_compile() {
-       local VAR
-       use amd64 && emake $VAR x86_64
-       use x86 && emake $VAR x86
-}
-
-src_install() {
-       dobin "${S}"/yafu
-       dodoc docfile.txt README yafu.ini
-}

diff --git a/sci-mathematics/yafu/yafu-1.34.3-r2.ebuild 
b/sci-mathematics/yafu/yafu-1.34.3-r2.ebuild
new file mode 100644
index 000000000000..342b94dbcb06
--- /dev/null
+++ b/sci-mathematics/yafu/yafu-1.34.3-r2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic edos2unix toolchain-funcs
+
+MY_PV="$(ver_cut 1-2)"
+DESCRIPTION="Yet another factoring utility"
+HOMEPAGE="https://sourceforge.net/projects/yafu/";
+SRC_URI="https://downloads.sourceforge.net/${PN}/${MY_PV}/${PN}-${MY_PV}-src.zip";
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="
+       || (
+               >=sys-devel/gcc-4.2:*[openmp]
+               llvm-core/clang-runtime:*[openmp]
+       )
+       dev-libs/gmp:0=
+       sci-mathematics/gmp-ecm"
+RDEPEND="${DEPEND}"
+BDEPEND="app-arch/unzip"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-fix-makefiles.patch
+       "${FILESDIR}"/${P}-mpz_set.patch
+)
+
+src_prepare() {
+       edos2unix top/eratosthenes/soe_util.c factor/factor_common.c
+       default
+}
+
+src_compile() {
+       tc-export CC
+       append-cflags -fcommon
+       use amd64 && emake x86_64
+       use x86 && emake x86
+}
+
+src_test() {
+       "${S}"/yafu "factor(121)" || die
+}
+
+src_install() {
+       dobin "${S}"/yafu
+       dodoc docfile.txt README yafu.ini
+}

Reply via email to