commit:     45cf1293a82467182b30c7117ac4ee083c78795f
Author:     Dima Pasechnik <dima <AT> pasechnik <DOT> info>
AuthorDate: Thu Jul 31 07:42:13 2025 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Jul 31 14:07:00 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45cf1293

sci-mathematics/flint: add 3.3.1

this needs patched Singular 4.4.1

Closes: https://github.com/gentoo/gentoo/pull/43256
Signed-off-by: Dima Pasechnik <dima <AT> pasechnik.info>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 sci-mathematics/flint/Manifest                     |   1 +
 .../flint/files/flint-3.3.1-find-cblas.patch       |  45 +++++++++
 sci-mathematics/flint/flint-3.3.1.ebuild           | 109 +++++++++++++++++++++
 3 files changed, 155 insertions(+)

diff --git a/sci-mathematics/flint/Manifest b/sci-mathematics/flint/Manifest
index 0db85da6eb5e..2f0382b55748 100644
--- a/sci-mathematics/flint/Manifest
+++ b/sci-mathematics/flint/Manifest
@@ -1 +1,2 @@
 DIST flint-3.1.3_p1.tar.xz 5657304 BLAKE2B 
7a76cbd7e3ea6ecfb4728545c427eba48ab476b257316792305522770e03b335d558cc104bac50b1faf2e8e25663f6ade20eef99e85999f7209091bf3c6e674a
 SHA512 
430e83be2d94c059066b7201319dbbbe414ccd10a4f359a865e54f3912b8b8e8f10dfd36ee81c96335553ee2736cf2ef9e1ffdf488c9706360b9e0e8a50a4eea
+DIST flint-3.3.1.tar.xz 5921132 BLAKE2B 
343c4e242232024c4177808c838068e75b7a18741bf0be2378e4245e490c1a110632033bdaaea4e4f6388e2ca0a324650539c657394291e0d1af144c87926ccc
 SHA512 
48013c36a4d1d79ac73b6a08f3b5238bade9110aee1aa2dd3f29e3257ee48bbdb8a18598de907511829d73ee9360cece52263475ceeb556a26c9b2f4d3065ef1

diff --git a/sci-mathematics/flint/files/flint-3.3.1-find-cblas.patch 
b/sci-mathematics/flint/files/flint-3.3.1-find-cblas.patch
new file mode 100644
index 000000000000..d76ab8c5c403
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-3.3.1-find-cblas.patch
@@ -0,0 +1,45 @@
+From: Michael Orlitzky <[email protected]>
+Date: Sat, 23 Dec 2023 14:38:46 -0500
+Subject: [PATCH 1/1] CMake/FindCBLAS.cmake: search only for cblas
+
+On Gentoo, users can "eselect cblas" to choose a cblas implementation
+at runtime. Packages build against the reference cblas, but the others
+are (by design) compatible, so we can force one to take precedence at
+runtime with an ld.so.conf entry. But that only works when consumers
+link to libcblas.so. If they link directly to (say) openblas, then
+changing how libcblas.so resolves won't help.
+
+When Flint tries to find "cblas," it looks for accelerate and openblas
+before plain cblas. That runs afoul of the scheme described above. To
+remedy it, we patch the search function so that only "cblas" is
+considered. Since virtual/cblas always pulls in the reference
+implementation, there'd be no point in altering the search order to
+consider e.g. openblas after cblas.
+
+Modified 2025/07/30 by Dima Pasechnik <dima@pasechnik,info> to take into 
account
+a small change in the file to be patched.
+---
+ CMake/FindCBLAS.cmake | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/CMake/FindCBLAS.cmake b/CMake/FindCBLAS.cmake
+index 90d796c..328ed1f 100644
+--- a/CMake/FindCBLAS.cmake
++++ b/CMake/FindCBLAS.cmake
+@@ -11,13 +11,11 @@
+ find_path(CBLAS_INCLUDE_DIR NAMES cblas.h
+   HINTS CBLAS_ROOT ENV CBLAS_ROOT
+   PATHS ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}/include
+-  PATH_SUFFIXES openblas cblas blis flexiblas
+   )
+ 
+-find_library(CBLAS_LIBRARY NAMES accelerate openblas cblas blas blis flexiblas
++find_library(CBLAS_LIBRARY NAMES cblas
+   HINTS CBLAS_ROOT ENV CBLAS_ROOT
+   PATHS ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX}/lib
+-  PATH_SUFFIXES openblas cblas blis flexiblas
+   )
+ 
+ include(FindPackageHandleStandardArgs)
+-- 
+2.41.0

diff --git a/sci-mathematics/flint/flint-3.3.1.ebuild 
b/sci-mathematics/flint/flint-3.3.1.ebuild
new file mode 100644
index 000000000000..67c213e4bad0
--- /dev/null
+++ b/sci-mathematics/flint/flint-3.3.1.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit flag-o-matic python-any-r1
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="https://www.flintlib.org/";
+
+SRC_URI="https://github.com/flintlib/flint/releases/download/v${PV}/flint-${PV}.tar.xz
 -> ${P}.tar.xz"
+LICENSE="LGPL-2.1+"
+
+# Based off the soname, e.g. /usr/lib64/libflint.so -> libflint.so.15
+SLOT="0/19"
+
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="doc ntl test"
+
+RESTRICT="!test? ( test )"
+
+BDEPEND="${PYTHON_DEPS}
+       doc? (
+               app-text/texlive-core
+               dev-python/sphinx
+               dev-tex/latexmk
+               dev-texlive/texlive-latex
+               dev-texlive/texlive-latexextra
+       )
+       ntl? ( dev-libs/ntl )
+"
+
+# NTL is never linked
+DEPEND="dev-libs/gmp:=
+       dev-libs/mpfr:=
+       virtual/cblas"
+
+# Flint 3.x includes arb. We include some version of NTL here if USE=ntl
+# is set so that consumers can depend on flint[ntl] to get a usable
+# Flint-NTL interface. But otherwise, NTL isn't actually needed at
+# runtime, even if Flint was built with USE=ntl.
+RDEPEND="${DEPEND}
+       ntl? ( dev-libs/ntl )
+       !sci-mathematics/arb"
+
+# The rst files are API docs, but they're very low-effort compared to
+# the PDF and HTML docs, so we ship them unconditionally and hide only
+# the painful parts behind USE=doc.
+DOCS="AUTHORS README.md doc/source/*.rst"
+
+PATCHES=(
+       "${FILESDIR}/flint-3.3.1-find-cblas.patch"
+)
+
+src_configure() {
+       # Test failures:
+       # * https://bugs.gentoo.org/934463
+       # * https://github.com/flintlib/flint/issues/2029
+       filter-flags -floop-nest-optimize \
+                                -ftree-loop-linear \
+                                -floop-strip-mine \
+                                -floop-block \
+                                -fgraphite-identity
+
+       # ABI needs to be unset because flint uses it internally for
+       # an incompatible purpose.
+       # --disable-assembly in an attempt to fix bug 946501
+       # --enable-debug just adds -g to your CFLAGS
+       # --enable-avx2 and --enable-avx512 just add "-mfoo" to CFLAGS
+       # --enable-gc affects thread-safety
+       local myeconfargs=(
+               ABI=""
+               --disable-assembly
+               --disable-debug
+               --with-blas
+               --with-gmp
+               --with-mpfr
+               --without-gc
+       )
+
+       # The NTL interface consists of a single header, NTL-interface.h,
+       # that is always installed. USE=ntl only determines whether or not
+       # the corresponding tests (which actually use NTL) are built and
+       # run. As a result, we don't care about USE=ntl without USE=test.
+       use test && myeconfargs+=( $(use_with ntl) )
+       econf "${myeconfargs[@]}"
+
+       if use doc; then
+               # Avoid the "html/_sources" directory that will contain a copy
+               # of the rst sources we've already installed, and also avoid
+               # installing html/objects.inv.
+               HTML_DOCS="doc/build/html/*.html
+                       doc/build/html/*.js
+                       doc/build/html/_static"
+               DOCS+=" doc/build/latex/Flint.pdf"
+       fi
+}
+
+src_compile() {
+       default
+
+       if use doc; then
+               pushd doc
+               emake html
+               emake latexpdf
+               popd
+       fi
+}

Reply via email to