media-libs/opencv: 4.12.0 fix blas/lapack handling

Closes: https://bugs.gentoo.org/962527
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43729
Closes: https://github.com/gentoo/gentoo/pull/43729
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Paul Zander
2025-09-10 18:32:11 +02:00
committed by Andreas Sturmlechner
parent a24d678d14
commit a2a45a58b8
2 changed files with 38 additions and 8 deletions

View File

@@ -0,0 +1,20 @@
diff --git a/cmake/OpenCVFindLAPACK.cmake b/cmake/OpenCVFindLAPACK.cmake
index 2ec1889..ff6adf2 100644
--- a/cmake/OpenCVFindLAPACK.cmake
+++ b/cmake/OpenCVFindLAPACK.cmake
@@ -229,12 +229,13 @@ if(WITH_LAPACK)
if(NOT DEFINED CBLAS_INCLUDE_DIR)
find_path(CBLAS_INCLUDE_DIR "cblas.h")
endif()
- if(CBLAS_INCLUDE_DIR AND LAPACKE_INCLUDE_DIR)
+ find_package(CBLAS)
+ if(CBLAS_INCLUDE_DIR AND LAPACKE_INCLUDE_DIR AND CBLAS_FOUND)
ocv_lapack_check(IMPL "LAPACK/Generic"
CBLAS_H "cblas.h"
LAPACKE_H "lapacke.h"
INCLUDE_DIR "${CBLAS_INCLUDE_DIR}" "${LAPACKE_INCLUDE_DIR}"
- LIBRARIES "${LAPACK_LIBRARIES}")
+ LIBRARIES "${LAPACK_LIBRARIES};${CBLAS_LIBRARIES}")
elseif(APPLE)
ocv_lapack_check(IMPL "LAPACK/Apple"
CBLAS_H "Accelerate/Accelerate.h"

View File

@@ -239,7 +239,10 @@ COMMON_DEPEND="
)
lapack? (
atlas? ( sci-libs/atlas )
mkl? ( sci-libs/mkl )
mkl? (
sci-libs/mkl[tbb?]
openmp? ( sci-libs/mkl[gnu-openmp] )
)
!atlas? (
!mkl? (
virtual/cblas
@@ -365,6 +368,7 @@ PATCHES=(
"${FILESDIR}/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch"
"${FILESDIR}/${PN}-4.1.2-opencl-license.patch"
"${FILESDIR}/${PN}-4.4.0-disable-native-cpuflag-detect.patch"
"${FILESDIR}/${PN}-4.12.0-link-with-cblas-for-lapack.patch"
"${FILESDIR}/${PN}-4.8.1-use-system-flatbuffers.patch"
"${FILESDIR}/${PN}-4.8.1-use-system-opencl.patch"
@@ -1123,13 +1127,19 @@ multilib_src_configure() {
)
fi
if use mkl; then
mycmakeargs+=(
-DLAPACK_IMPL="MKL"
-DWITH_MKL="yes"
-DMKL_WITH_OPENMP="$(usex openmp)"
-DMKL_WITH_TBB="$(usex tbb)"
)
if multilib_native_use lapack; then
if use mkl; then
mycmakeargs+=(
-DWITH_MKL="yes"
-DMKL_WITH_OPENMP="$(usex openmp)"
-DMKL_WITH_TBB="$(usex tbb)"
)
else
mycmakeargs+=(
-DSKIP_OPENBLAS_PACKAGE="yes"
-DOPENCV_LAPACK_DISABLE_MKL="yes"
)
fi
fi
if use gtk3 || use qt6 || use wayland; then