commit:     1c0fb921bac5558cb6115397ca0b6ce76fa96ca9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  8 19:09:41 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 22 18:40:16 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c0fb921

sci-libs/flexiblas: New package, v3.4.5

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sci-libs/flexiblas/Manifest               |   1 +
 sci-libs/flexiblas/flexiblas-3.4.5.ebuild | 100 ++++++++++++++++++++++++++++++
 sci-libs/flexiblas/metadata.xml           |  12 ++++
 3 files changed, 113 insertions(+)

diff --git a/sci-libs/flexiblas/Manifest b/sci-libs/flexiblas/Manifest
new file mode 100644
index 000000000000..327f749153db
--- /dev/null
+++ b/sci-libs/flexiblas/Manifest
@@ -0,0 +1 @@
+DIST flexiblas-3.4.5.tar.xz 16793688 BLAKE2B 
a01c2d02c96d67ccfd560e6623fb1f7f5058fb272b097591b5a62424c04bcf3927669e3b6bf2714adce80822655b9a3a415550365a46a26c8047635e944e8685
 SHA512 
7a6367d452775d29426c1811b00188030c0e192330357d99a75ec8336d1da923450717c18bcc0949f86d7c8584552c3ad7d662e433437fc98f5490c403f072d1

diff --git a/sci-libs/flexiblas/flexiblas-3.4.5.ebuild 
b/sci-libs/flexiblas/flexiblas-3.4.5.ebuild
new file mode 100644
index 000000000000..e0f645dd43ff
--- /dev/null
+++ b/sci-libs/flexiblas/flexiblas-3.4.5.ebuild
@@ -0,0 +1,100 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake toolchain-funcs
+
+DESCRIPTION="A BLAS and LAPACK wrapper library with runtime exchangable 
backends"
+HOMEPAGE="
+       https://www.mpi-magdeburg.mpg.de/projects/flexiblas/
+       https://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release/
+"
+SRC_URI="https://csc.mpi-magdeburg.mpg.de/mpcsc/software/flexiblas/${P}.tar.xz";
+
+LICENSE="LGPL-3+"
+SLOT="0"
+KEYWORDS="~amd64"
+# TODO: mkl, 64bit-index
+IUSE="blis openblas openmp test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       sci-libs/lapack:=[deprecated]
+       blis? ( sci-libs/blis:=[-64bit-index] )
+       openblas? ( sci-libs/openblas:= )
+"
+RDEPEND="
+       ${DEPEND}
+"
+# for testing, we need the config files installed already
+# (issue reported upstream)
+BDEPEND="
+       test? ( ${CATEGORY}/${PN}[blis?,openblas?] )
+"
+
+pkg_pretend() {
+       if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
+               tc-check-openmp
+       fi
+}
+
+pkg_setup() {
+       if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
+               tc-check-openmp
+       fi
+}
+
+src_prepare() {
+       cmake_src_prepare
+
+       # remove bundled netlib blas/lapack
+       rm -r contributed || die
+}
+
+src_configure() {
+       EXTRA_BACKENDS=( $(usev blis) $(usev openblas) )
+       local extra=${EXTRA_BACKENDS[*]}
+       local libdir="${ESYSROOT}/usr/$(get_libdir)"
+       local mycmakeargs=(
+               -DTESTS=$(usex test)
+               -DCBLAS=ON
+               # TODO: ILP64 variant
+               -DINTEGER8=OFF
+               -DLAPACK=ON
+               -DLINK_OPENMP=$(usex openmp)
+               -DEXAMPLES=OFF
+               # disable autodetection, we don't want automagic deps
+               # plus openblas/blis gets hardcoded as openmp/pthread/serial
+               -DBLAS_AUTO_DETECT=OFF
+               -DEXTRA="${extra// /;}"
+               # respect CFLAGS
+               -DLTO=OFF
+               # use system sci-libs/lapack
+               -DSYS_BLAS_LIBRARY="${libdir}/libblas.so"
+               -DSYS_LAPACK_LIBRARY="${libdir}/liblapack.so"
+               # these are used only with -DEXTRA
+               -Dblis_LIBRARY="${libdir}/libblis.so"
+               -Dopenblas_LIBRARY="${libdir}/libopenblas.so"
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       # We run tests in parallel, so avoid having n^2 threads.
+       local -x BLIS_NUM_THREADS=1
+       local -x OMP_NUM_THREADS=1
+       local -x OPENBLAS_NUM_THREADS=1
+
+       local backend
+       for backend in netlib "${EXTRA_BACKENDS[@]}"; do
+               local -x FLEXIBLAS_TEST=${backend}
+               local log=${BUILD_DIR}/Testing/Temporary/LastTest.log
+               einfo "Testing backend ${backend}"
+               cmake_src_test
+               if grep -q 'BLAS backend .* not found' "${log}"; then
+                       die "Backend ${backend} failed to load while testing, 
see ${log}"
+               fi
+       done
+}

diff --git a/sci-libs/flexiblas/metadata.xml b/sci-libs/flexiblas/metadata.xml
new file mode 100644
index 000000000000..c91166300541
--- /dev/null
+++ b/sci-libs/flexiblas/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Michał Górny</name>
+       </maintainer>
+       <use>
+               <flag name="blis">Support <pkg>sci-libs/blis</pkg> 
provider</flag>
+               <flag name="openblas">Support <pkg>sci-libs/openblas</pkg> 
provider</flag>
+       </use>
+</pkgmetadata>

Reply via email to