commit:     48ff51bb8f9b932178872c45c4d3ec68ea9ae987
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 13 15:24:23 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep 16 17:35:16 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48ff51bb

sci-libs/lapack: Support installing ILP64 libraries

Add an index64 flag to install ILP64 libraries in addition to the LP64
libraries.

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

 .../lapack/files/lapack-3.12.1-lapack64-pc.patch   | 34 ++++++++++++++++++++++
 sci-libs/lapack/lapack-3.12.1-r1.ebuild            | 17 +++++++++--
 sci-libs/lapack/metadata.xml                       |  1 +
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/sci-libs/lapack/files/lapack-3.12.1-lapack64-pc.patch 
b/sci-libs/lapack/files/lapack-3.12.1-lapack64-pc.patch
new file mode 100644
index 000000000000..0bdde1ab09e3
--- /dev/null
+++ b/sci-libs/lapack/files/lapack-3.12.1-lapack64-pc.patch
@@ -0,0 +1,34 @@
+https://github.com/Reference-LAPACK/lapack/pull/1154
+
+From b73a7c9e4de884ea7550832cb28ad518bab0c178 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Sun, 14 Sep 2025 11:27:26 +0200
+Subject: [PATCH] fix library names in `lapack64.pc`
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add substitutions to `lapack.pc.in`, in order to ensure that
+the generated `lapack64.pc` file correctly references the index64
+library and BLAS dependency.  It seems that other pkg-config templates
+have been updated as part of #462 but this one was omitted.
+As a result, finding a lapack64 via pkg-config gave non-index64
+libraries.
+
+Signed-off-by: Michał Górny <[email protected]>
+---
+ lapack.pc.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lapack.pc.in b/lapack.pc.in
+index 316c871011..27cd99f7c8 100644
+--- a/lapack.pc.in
++++ b/lapack.pc.in
+@@ -5,5 +5,5 @@ Name: LAPACK
+ Description: FORTRAN reference implementation of LAPACK Linear Algebra PACKage
+ Version: @LAPACK_VERSION@
+ URL: http://www.netlib.org/lapack/
+-Libs: -L${libdir} -llapack
+-Requires.private: blas
++Libs: -L${libdir} -l@LAPACKLIB@
++Requires.private: @BLASLIB@

diff --git a/sci-libs/lapack/lapack-3.12.1-r1.ebuild 
b/sci-libs/lapack/lapack-3.12.1-r1.ebuild
index 9799c01c0f29..db089b5df7c4 100644
--- a/sci-libs/lapack/lapack-3.12.1-r1.ebuild
+++ b/sci-libs/lapack/lapack-3.12.1-r1.ebuild
@@ -14,8 +14,7 @@ 
SRC_URI="https://github.com/Reference-LAPACK/lapack/archive/v${PV}.tar.gz -> ${P
 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="lapacke deprecated doc eselect-ldso index64 test"
 RESTRICT="!test? ( test )"
 
 RDEPEND="
@@ -37,6 +36,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.12.1-broken-flow.patch
        "${FILESDIR}"/${PN}-3.12.1-broken-flow-deux.patch
        "${FILESDIR}"/${PN}-3.12.1-broken-flow-trois.patch
+       "${FILESDIR}"/${PN}-3.12.1-lapack64-pc.patch
 )
 
 pkg_setup() {
@@ -60,10 +60,23 @@ src_configure() {
        )
 
        cmake_src_configure
+
+       if use index64; then
+               mycmakeargs+=(
+                       -DBUILD_INDEX64=ON
+               )
+               BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_configure
+       fi
+}
+
+src_compile() {
+       cmake_src_compile
+       use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_compile
 }
 
 src_install() {
        cmake_src_install
+       use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_install
 
        use eselect-ldso || return
        # Create private lib directory for eselect::blas (ld.so.conf)

diff --git a/sci-libs/lapack/metadata.xml b/sci-libs/lapack/metadata.xml
index 7d9a2d7b3cab..539164e91398 100644
--- a/sci-libs/lapack/metadata.xml
+++ b/sci-libs/lapack/metadata.xml
@@ -28,6 +28,7 @@ This package installs the reference FORTRAN 77 implementation 
from Netlib.
        </longdescription>
        <use>
                <flag name="deprecated">Also build deprecated functions</flag>
+               <flag name="index64">Build a separate ILP64 library in addition 
to LP64</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