commit:     c7c3e7b58a59b4a7d0f67046ac3f89ea6f1605a9
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sat Feb 21 20:05:38 2026 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Mar  5 22:23:47 2026 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c7c3e7b5

sci-ml/ollama: 9999 refactor blas handling

Use code for potential `blas-utils.eclass`.
Correctly forwarding the flexiblas dep to virtual/blas should fix failing
`BLAS=Generic` case.

Closes: https://bugs.gentoo.org/969379
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/metadata.xml       |  3 +++
 sci-ml/ollama/ollama-9999.ebuild | 40 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/sci-ml/ollama/metadata.xml b/sci-ml/ollama/metadata.xml
index a9e97c52bf..b385334a17 100644
--- a/sci-ml/ollama/metadata.xml
+++ b/sci-ml/ollama/metadata.xml
@@ -6,8 +6,11 @@
                <name>Paul Zander</name>
        </maintainer>
        <use>
+               <flag name="blis">Use <pkg>sci-libs/blis</pkg> as blas 
provider</flag>
                <flag name="cuda">Enable NVIDIA CUDA support</flag>
+               <flag name="flexiblas">Use <pkg>sci-libs/flexiblas</pkg> as 
blas provider</flag>
                <flag name="mkl">Use <pkg>sci-libs/mkl</pkg> for blas, lapack 
and sparse blas routines</flag>
+               <flag name="openblas">Use <pkg>sci-libs/openblas</pkg> as blas 
provider</flag>
                <flag name="rocm">Enable ROCm gpu computing support</flag>
        </use>
        <upstream>

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index aeb888ad55..e79e977ae2 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -26,9 +26,15 @@ fi
 LICENSE="MIT"
 SLOT="0"
 
-IUSE="blas cuda rocm mkl vulkan"
+IUSE="cuda rocm vulkan"
 # IUSE+=" opencl"
 
+BLAS_BACKENDS="blis mkl openblas"
+BLAS_REQUIRED_USE="blas? ( ?? ( ${BLAS_BACKENDS} ) )"
+
+IUSE+=" blas flexiblas ${BLAS_BACKENDS}"
+REQUIRED_USE+=" ${BLAS_REQUIRED_USE}"
+
 declare -rgA CPU_FEATURES=(
        [AVX2]="x86"
        [AVX512F]="x86"
@@ -51,14 +57,24 @@ add_cpu_features_use
 
 RESTRICT="mirror test"
 
+# FindBLAS.cmake
+# If Fortran is an enabled compiler it sets BLAS_mkl_THREADING to gnu. -> 
sci-libs/mkl[gnu-openmp]
+# If Fortran is not an enabled compiler it sets BLAS_mkl_THREADING to intel. 
-> sci-libs/mkl[llvm-openmp]
 COMMON_DEPEND="
        blas? (
-               !mkl? (
-                       virtual/blas
+               blis? (
+                       sci-libs/blis:=
+               )
+               flexiblas? (
+                       sci-libs/flexiblas[blis?,mkl?,openblas?]
                )
                mkl? (
                        sci-libs/mkl[llvm-openmp]
                )
+               openblas? (
+                       sci-libs/openblas
+               )
+               virtual/blas[flexiblas=]
        )
        cuda? (
                dev-util/nvidia-cuda-toolkit:=
@@ -264,10 +280,26 @@ src_configure() {
        )
 
        if use blas; then
-               if use mkl; then
+               if use flexiblas ; then
+                       mycmakeargs+=(
+                               -DGGML_BLAS_VENDOR="FlexiBLAS"
+                       )
+               elif use blis ; then
+                       mycmakeargs+=(
+                               -DGGML_BLAS_VENDOR="FLAME"
+                       )
+               elif use mkl ; then
                        mycmakeargs+=(
                                -DGGML_BLAS_VENDOR="Intel10_64lp"
                        )
+               # elif use nvhpc ; then
+               #       mycmakeargs+=(
+               #               -DGGML_BLAS_VENDOR="NVHPC"
+               #       )
+               elif use openblas ; then
+                       mycmakeargs+=(
+                               -DGGML_BLAS_VENDOR="OpenBLAS"
+                       )
                else
                        mycmakeargs+=(
                                -DGGML_BLAS_VENDOR="Generic"

Reply via email to