Introduce a USE=flexiblas that adds a "-reference" suffix to all
the libraries, and moves the headers into a "lapack-reference"
subdirectory.  This is meant to make it possible to symlink the system
BLAS/LAPACK libraries into sci-libs/flexiblas instead.

Signed-off-by: Michał Górny <[email protected]>
---
 ...12.1-r1.ebuild => lapack-3.12.1-r2.ebuild} | 22 ++++++++++++++++++-
 sci-libs/lapack/metadata.xml                  |  3 +++
 2 files changed, 24 insertions(+), 1 deletion(-)
 copy sci-libs/lapack/{lapack-3.12.1-r1.ebuild => lapack-3.12.1-r2.ebuild} (88%)

diff --git a/sci-libs/lapack/lapack-3.12.1-r1.ebuild 
b/sci-libs/lapack/lapack-3.12.1-r2.ebuild
similarity index 88%
copy from sci-libs/lapack/lapack-3.12.1-r1.ebuild
copy to sci-libs/lapack/lapack-3.12.1-r2.ebuild
index 9799c01c0f29..af0ace5b1338 100644
--- a/sci-libs/lapack/lapack-3.12.1-r1.ebuild
+++ b/sci-libs/lapack/lapack-3.12.1-r2.ebuild
@@ -15,7 +15,8 @@ LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos"
 # TODO: static-libs 64bit-index
-IUSE="lapacke deprecated doc eselect-ldso test"
+IUSE="flexiblas lapacke deprecated doc eselect-ldso test"
+REQUIRED_USE="flexiblas? ( deprecated !eselect-ldso )"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -32,6 +33,11 @@ BDEPEND="
        virtual/pkgconfig
        test? ( ${PYTHON_DEPS} )
 "
+PDEPEND="
+       flexiblas? (
+               sci-libs/flexiblas[system-blas(-)]
+       )
+"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-3.12.1-broken-flow.patch
@@ -44,6 +50,15 @@ pkg_setup() {
        use test && python-any-r1_pkg_setup
 }
 
+src_prepare() {
+       cmake_src_prepare
+
+       if use flexiblas; then
+               # install libraries renamed to '*-reference'
+               sed -i -e '/set([A-Z]*LIB/s:"):-reference"):' CMakeLists.txt || 
die
+       fi
+}
+
 src_configure() {
        # bug #878891
        filter-lto
@@ -58,6 +73,11 @@ src_configure() {
                # Breaks cross
                -DTEST_FORTRAN_COMPILER=OFF
        )
+       if use flexiblas; then
+               mycmakeargs+=(
+                       -DCMAKE_INSTALL_INCLUDEDIR=include/lapack-reference
+               )
+       fi
 
        cmake_src_configure
 }
diff --git a/sci-libs/lapack/metadata.xml b/sci-libs/lapack/metadata.xml
index e9670e6df2cf..bcf87bcf1e52 100644
--- a/sci-libs/lapack/metadata.xml
+++ b/sci-libs/lapack/metadata.xml
@@ -24,6 +24,9 @@ This package installs the reference FORTRAN 77 implementation 
from Netlib.
   </longdescription>
   <use>
     <flag name="deprecated">Also build deprecated functions</flag>
+    <flag name="flexiblas">
+        Install renamed, for system FlexiBLAS compatibility.
+    </flag>
     <flag name="lapacke">Build LAPACKE</flag>
     <flag name="eselect-ldso">Enable runtime library switching by
     eselect and ld.so.</flag>

Reply via email to