diff --git a/sci-libs/flexiblas/Manifest b/sci-libs/flexiblas/Manifest index 9ce4eebeb5bae..2e66ccc4bd44b 100644 --- a/sci-libs/flexiblas/Manifest +++ b/sci-libs/flexiblas/Manifest @@ -1,4 +1 @@ -DIST flexiblas-release-v3.4.82.tar.bz2 80430275 BLAKE2B 60791aa3a77ce7ad1e9e0ad1a6739e7c9d187328b78bb49014cfbf6d57316b8edd721141a8687e783d0cb78bbd8f6e0911b2557afaba1c262d9771d68c1679bf SHA512 2af8159e7a43265e4276cf759a75526c2294682276e186c73e22551dbbb1804d1e9e9414f9213c80589fb81d96510156bedd11db0c1e5ff10091da9e624b9f89 -DIST flexiblas-release-v3.4.83.tar.bz2 82671100 BLAKE2B bf836c690e7e2fe6ac3b79bbfac20abf68831e73a19010920c6d8a195a831e6c348736bb4763c54cbaebf3c94602f137bfc839e8f88c810434123c82871a4ba5 SHA512 51f1ecaa0ad2858558ddb47693ba2157ea252227aa05d04dd7c91ebfdfa0cb10cd449a8a8f75f851ab9b0f714a7d40456abd73238f007615fcf29313a24eafe3 -DIST flexiblas-release-v3.4.84.tar.bz2 82672070 BLAKE2B 492bdc14eb71a638c280540f2cf5b2d7908b8ee0c79822b735f10c2dd021605b18edf1217407d5476159653f115c74190c4647ad02ee65597294b348ab438590 SHA512 a6929507043970dc6d6d2ee072adcd996b2f48139ab55b74adc2b613ac3e5aaa6be0207b59cad98e240ffa641d80a28de4949d919822ab72ef0063a71532682f DIST flexiblas-release-v3.5.0.tar.bz2 82678136 BLAKE2B e7f6b53df70ca27d95ab8606c14b84e3e174c376e7ec91017d67bdc46971314beacc9c9bb90f9d9efac695aa9c237fc612f87238d1628654e309bbcedd227330 SHA512 8e2dc3edb054cef487b83d66132fc56f906a447f3cdc1ca2e32021a171813655829bca4a81877b675f0027ea318a3bf052610573eae60699ef1a5ff5a89ec499 diff --git a/sci-libs/flexiblas/files/flexiblas-3.4.82-xerbla-array.patch b/sci-libs/flexiblas/files/flexiblas-3.4.82-xerbla-array.patch deleted file mode 100644 index 4df5e904eb9a4..0000000000000 --- a/sci-libs/flexiblas/files/flexiblas-3.4.82-xerbla-array.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/src/xerbla.c b/src/xerbla.c -index a12fc78e..209c0f23 100644 ---- a/src/xerbla.c -+++ b/src/xerbla.c -@@ -42,6 +42,7 @@ void flexiblas_internal_xerbla(char *SNAME, Int *Info, flexiblas_fortran_charlen - #ifdef __ELF__ - #pragma weak xerbla_ - #pragma weak xerbla -+#pragma weak XERBLA - void xerbla_(char *, Int *, flexiblas_fortran_charlen_t) __attribute__ (( alias ("flexiblas_internal_xerbla"))); - void xerbla(char *, Int *, flexiblas_fortran_charlen_t) __attribute__ (( alias ("flexiblas_internal_xerbla"))); - void XERBLA(char *, Int *, flexiblas_fortran_charlen_t) __attribute__ (( alias ("flexiblas_internal_xerbla"))); -@@ -130,6 +131,33 @@ void flexiblas_internal_xerbla(char *SNAME, Int *Info, flexiblas_fortran_charlen - return; - } - -+/* XERBLA_ARRAY handler */ -+ -+void xerbla_array_ (char *srname_array, Int *srname_len, Int *info, flexiblas_fortran_charlen_t srname_array_len) -+{ -+ size_t k = 0; -+ size_t len = 0; -+ if (*srname_len > 0 ) len = (int) *srname_len; -+ (void) srname_array_len; -+ char tmp[len+1]; -+ tmp[len] = '\0'; -+ -+ for(k = 0; k < len; k++) tmp[k] = srname_array[k]; -+ -+ flexiblas_internal_xerbla(tmp, info, len); -+ return; -+} -+ -+void xerbla_array(char *srname_array, Int *srname_len, Int *info, flexiblas_fortran_charlen_t srname_array_len) -+{ -+ xerbla_array_(srname_array, srname_len, info, srname_array_len); -+} -+ -+void XERBLA_ARRAY(char *srname_array, Int *srname_len, Int *info, flexiblas_fortran_charlen_t srname_array_len) -+{ -+ xerbla_array_(srname_array, srname_len, info, srname_array_len); -+} -+ - - - /* -@@ -155,7 +183,7 @@ void internal_cblas_xerbla(CBLAS_INT _info, const char *rout, const char *form, - va_list argptr; - - va_start(argptr, form); -- Int info = _info; -+ Int info = _info; - - if (RowMajorStrg) - { diff --git a/sci-libs/flexiblas/flexiblas-3.4.82-r4.ebuild b/sci-libs/flexiblas/flexiblas-3.4.82-r4.ebuild deleted file mode 100644 index 6b53fa3ec3e55..0000000000000 --- a/sci-libs/flexiblas/flexiblas-3.4.82-r4.ebuild +++ /dev/null @@ -1,273 +0,0 @@ -# Copyright 2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake multilib toolchain-funcs - -MY_P=flexiblas-release-v${PV} -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://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release/-/archive/v${PV}/${MY_P}.tar.bz2 -" -S=${WORKDIR}/${MY_P} - -# BSD for vendored cblas/lapacke -LICENSE="LGPL-3+ BSD" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" -IUSE="blis index64 mkl openblas openmp system-blas tbb test" -RESTRICT="!test? ( test )" - -# flexiblas only supports gnu-openmp using clang/gcc -DEPEND=" - sci-libs/lapack:=[deprecated,index64(-)?] - blis? ( sci-libs/blis:=[-64bit-index(-),index64(-)?] ) - mkl? ( - sci-libs/mkl:=[tbb?] - openmp? ( sci-libs/mkl[gnu-openmp] ) - ) - openblas? ( sci-libs/openblas:=[index64(-)?] ) - system-blas? ( sci-libs/lapack[flexiblas(-)] ) -" -RDEPEND=" - ${DEPEND} - system-blas? ( - !app-eselect/eselect-blas - !app-eselect/eselect-cblas - !app-eselect/eselect-lapack - !sci-libs/lapack[-flexiblas(-)] - !=sci-libs/blas-lapack-aux-wrapper-0-r0 - ) -" -PDEPEND=" - system-blas? ( - >=sci-libs/blas-lapack-aux-wrapper-0-r1[index64?] - ) -" - -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() { - local PATCHES=( - # extracted from - # https://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release/-/commit/04021ceada30f136036a22dc6c811b3d352b199d - "${FILESDIR}/${P}-xerbla-array.patch" - ) - - cmake_src_prepare - - # remove bundled netlib blas/lapack - # (we still need vendored cblas/lapacke) - rm -r contributed/lapack-* || die -} - -src_configure() { - BACKENDS=( $(usev blis) $(usev openblas) ) - local extra=${BACKENDS[*]} - local libdir="${ESYSROOT}/usr/$(get_libdir)" - local mycmakeargs=( - -DTESTS=$(usex test) - -DCBLAS=ON - -DINTEGER8=OFF - -DLAPACK=ON - -DLINK_OPENMP=$(usex openmp) - -DEXAMPLES=OFF - # prefer OpenBLAS if available - -DFLEXIBLAS_DEFAULT=$(usex openblas openblas netlib) - # we need to enable autodetection for mkl - -DBLAS_AUTO_DETECT=ON - # ...so we need to explicitly disable autodetecting other libraries - # that would be pinned to their openmp/pthread/serial variants - -DOpenBLASSerial=OFF - -DOpenBLASPThread=OFF - -DOpenBLASOpenMP=OFF - -DOpenBLASSerial64=OFF - -DOpenBLASPThread64=OFF - -DOpenBLASOpenMP64=OFF - -DBlisSerial=OFF - -DBlisPThread=OFF - -DBlisOpenMP=OFF - -DBlisSerial64=OFF - -DBlisPThread64=OFF - -DBlisOpenMP64=OFF - # variants we use autodetection for - -DMklSerial=$(usex mkl ON OFF) - -DMklOpenMP=$(usex mkl "$(usex openmp ON OFF)" OFF) - -DMklTBB=$(usex mkl "$(usex tbb ON OFF)" OFF) - # unsupported - -DCMAKE_DISABLE_FIND_PACKAGE_nvpl=ON - -DATLAS=OFF - -DTATLAS=OFF - # and then enable our custom names via EXTRA - -DEXTRA="${extra// /;}" - # respect CFLAGS - -DLTO=OFF - # these are used only with -DEXTRA - -Dblis_LIBRARY="${libdir}/libblis.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas.so" - ) - - # use system sci-libs/lapack - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack.so" - ) - fi - - cmake_src_configure - - if use index64; then - mycmakeargs+=( - -DINTEGER8=ON - -Dblis_LIBRARY="${libdir}/libblis64.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas64.so" - ) - - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64.so" - ) - fi - - BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_configure - fi - - BACKENDS+=( netlib ) - BACKENDS_ILP64=( "${BACKENDS[@]}" ) - if use mkl; then - BACKENDS+=( - MklSerial - $(usev openmp MklOpenMP) - $(usev tbb MklTBB) - ) - BACKENDS_ILP64+=( - MklSerial64 - $(usev openmp MklOpenMP64) - $(usev tbb MklTBB64) - ) - fi -} - -src_compile() { - cmake_src_compile - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_compile -} - -my_test() { - # We run tests in parallel, so avoid having n^2 threads. - local -x BLIS_NUM_THREADS=1 - local -x MKL_NUM_THREADS=1 - local -x OMP_NUM_THREADS=1 - local -x OPENBLAS_NUM_THREADS=1 - - local backend - for backend in "${@}"; do - local args=() - if [[ ${backend} == Mkl* ]]; then - # XFAIL - args+=( -E 'cblat[23]' ) - fi - - local -x FLEXIBLAS_TEST=${backend} - local log=${BUILD_DIR}/Testing/Temporary/LastTest.log - einfo "Testing backend ${backend}" - cmake_src_test "${args[@]}" - if grep -q 'BLAS backend .* not found' "${log}"; then - die "Backend ${backend} failed to load while testing, see ${log}" - fi - done -} - -src_test() { - my_test "${BACKENDS[@]}" - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 my_test "${BACKENDS_ILP64[@]}" -} - -verify_backends() { - local lib=${1} - shift - cd "${ED}/usr/$(get_libdir)/${lib}" || die - - local missing=() - local backend - for backend in "${@}"; do - if [[ ! -f libflexiblas_${backend,,}$(get_libname) ]]; then - missing+=( "${backend}" ) - fi - done - - if [[ ${missing[@]} ]]; then - die "Not all requested ${lib} backends built. Missing: ${missing[*]}" - fi -} - -src_install() { - cmake_src_install - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_install - - # Verify built backends. - verify_backends flexiblas "${BACKENDS[@]}" - use index64 && verify_backends flexiblas64 "${BACKENDS_ILP64[@]}" - - # Install symlinks for system BLAS / LAPACK use. - if use system-blas; then - local libdir="/usr/$(get_libdir)" - local fn suffix - for fn in cblas.h lapack.h lapacke{,_config,_mangling,_utils}.h; do - dosym "flexiblas/${fn}" "/usr/include/${fn}" - done - - for suffix in '' $(usev index64 64); do - for fn in blas cblas lapack lapacke; do - dosym "libflexiblas${suffix}.so.3" \ - "${libdir}/lib${fn}${suffix}.so.3" - done - done - fi -} - -pkg_postinst() { - if use system-blas; then - # eselect-{blas,lapack} doesn't clean up its configs - local prev_opt=$(shopt -p nullglob) - shopt -s nullglob - local files=( - "${EROOT}"/etc/ld.so.conf.d/81-blas-*.conf - "${EROOT}"/etc/ld.so.conf.d/82-lapack-*.conf - ) - ${prev_opt} - - if [[ ${files[@]} ]]; then - rm -v "${files[@]}" - fi - fi -} diff --git a/sci-libs/flexiblas/flexiblas-3.4.83.ebuild b/sci-libs/flexiblas/flexiblas-3.4.83.ebuild deleted file mode 100644 index 8bbc65c26a867..0000000000000 --- a/sci-libs/flexiblas/flexiblas-3.4.83.ebuild +++ /dev/null @@ -1,267 +0,0 @@ -# Copyright 2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake multilib toolchain-funcs - -MY_P=flexiblas-release-v${PV} -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://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release/-/archive/v${PV}/${MY_P}.tar.bz2 -" -S=${WORKDIR}/${MY_P} - -# BSD for vendored cblas/lapacke -LICENSE="LGPL-3+ BSD" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" -IUSE="blis index64 mkl openblas openmp system-blas tbb test" -RESTRICT="!test? ( test )" - -# flexiblas only supports gnu-openmp using clang/gcc -DEPEND=" - sci-libs/lapack:=[deprecated,index64(-)?] - blis? ( sci-libs/blis:=[-64bit-index(-),index64(-)?] ) - mkl? ( - sci-libs/mkl:=[tbb?] - openmp? ( sci-libs/mkl[gnu-openmp] ) - ) - openblas? ( sci-libs/openblas:=[index64(-)?] ) - system-blas? ( sci-libs/lapack[flexiblas(-)] ) -" -RDEPEND=" - ${DEPEND} - system-blas? ( - !app-eselect/eselect-blas - !app-eselect/eselect-cblas - !app-eselect/eselect-lapack - !sci-libs/lapack[-flexiblas(-)] - !=sci-libs/blas-lapack-aux-wrapper-0-r0 - ) -" -PDEPEND=" - system-blas? ( - >=sci-libs/blas-lapack-aux-wrapper-0-r1[index64?] - ) -" - -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 - # (we still need vendored cblas/lapacke) - rm -r contributed/lapack-* || die -} - -src_configure() { - BACKENDS=( $(usev blis) $(usev openblas) ) - local extra=${BACKENDS[*]} - local libdir="${ESYSROOT}/usr/$(get_libdir)" - local mycmakeargs=( - -DTESTS=$(usex test) - -DCBLAS=ON - -DINTEGER8=OFF - -DLAPACK=ON - -DLINK_OPENMP=$(usex openmp) - -DEXAMPLES=OFF - # prefer OpenBLAS if available - -DFLEXIBLAS_DEFAULT=$(usex openblas openblas netlib) - # we need to enable autodetection for mkl - -DBLAS_AUTO_DETECT=ON - # ...so we need to explicitly disable autodetecting other libraries - # that would be pinned to their openmp/pthread/serial variants - -DOpenBLASSerial=OFF - -DOpenBLASPThread=OFF - -DOpenBLASOpenMP=OFF - -DOpenBLASSerial64=OFF - -DOpenBLASPThread64=OFF - -DOpenBLASOpenMP64=OFF - -DBlisSerial=OFF - -DBlisPThread=OFF - -DBlisOpenMP=OFF - -DBlisSerial64=OFF - -DBlisPThread64=OFF - -DBlisOpenMP64=OFF - # variants we use autodetection for - -DMklSerial=$(usex mkl ON OFF) - -DMklOpenMP=$(usex mkl "$(usex openmp ON OFF)" OFF) - -DMklTBB=$(usex mkl "$(usex tbb ON OFF)" OFF) - # unsupported - -DCMAKE_DISABLE_FIND_PACKAGE_nvpl=ON - -DATLAS=OFF - -DTATLAS=OFF - # and then enable our custom names via EXTRA - -DEXTRA="${extra// /;}" - # respect CFLAGS - -DLTO=OFF - # these are used only with -DEXTRA - -Dblis_LIBRARY="${libdir}/libblis.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas.so" - ) - - # use system sci-libs/lapack - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack.so" - ) - fi - - cmake_src_configure - - if use index64; then - mycmakeargs+=( - -DINTEGER8=ON - -Dblis_LIBRARY="${libdir}/libblis64.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas64.so" - ) - - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64.so" - ) - fi - - BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_configure - fi - - BACKENDS+=( netlib ) - BACKENDS_ILP64=( "${BACKENDS[@]}" ) - if use mkl; then - BACKENDS+=( - MklSerial - $(usev openmp MklOpenMP) - $(usev tbb MklTBB) - ) - BACKENDS_ILP64+=( - MklSerial64 - $(usev openmp MklOpenMP64) - $(usev tbb MklTBB64) - ) - fi -} - -src_compile() { - cmake_src_compile - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_compile -} - -my_test() { - # We run tests in parallel, so avoid having n^2 threads. - local -x BLIS_NUM_THREADS=1 - local -x MKL_NUM_THREADS=1 - local -x OMP_NUM_THREADS=1 - local -x OPENBLAS_NUM_THREADS=1 - - local backend - for backend in "${@}"; do - local args=() - if [[ ${backend} == Mkl* ]]; then - # XFAIL - args+=( -E 'cblat[23]' ) - fi - - local -x FLEXIBLAS_TEST=${backend} - local log=${BUILD_DIR}/Testing/Temporary/LastTest.log - einfo "Testing backend ${backend}" - cmake_src_test "${args[@]}" - if grep -q 'BLAS backend .* not found' "${log}"; then - die "Backend ${backend} failed to load while testing, see ${log}" - fi - done -} - -src_test() { - my_test "${BACKENDS[@]}" - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 my_test "${BACKENDS_ILP64[@]}" -} - -verify_backends() { - local lib=${1} - shift - cd "${ED}/usr/$(get_libdir)/${lib}" || die - - local missing=() - local backend - for backend in "${@}"; do - if [[ ! -f libflexiblas_${backend,,}$(get_libname) ]]; then - missing+=( "${backend}" ) - fi - done - - if [[ ${missing[@]} ]]; then - die "Not all requested ${lib} backends built. Missing: ${missing[*]}" - fi -} - -src_install() { - cmake_src_install - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_install - - # Verify built backends. - verify_backends flexiblas "${BACKENDS[@]}" - use index64 && verify_backends flexiblas64 "${BACKENDS_ILP64[@]}" - - # Install symlinks for system BLAS / LAPACK use. - if use system-blas; then - local libdir="/usr/$(get_libdir)" - local fn suffix - for fn in cblas.h lapack.h lapacke{,_config,_mangling,_utils}.h; do - dosym "flexiblas/${fn}" "/usr/include/${fn}" - done - - for suffix in '' $(usev index64 64); do - for fn in blas cblas lapack lapacke; do - dosym "libflexiblas${suffix}.so.3" \ - "${libdir}/lib${fn}${suffix}.so.3" - done - done - fi -} - -pkg_postinst() { - if use system-blas; then - # eselect-{blas,lapack} doesn't clean up its configs - local prev_opt=$(shopt -p nullglob) - shopt -s nullglob - local files=( - "${EROOT}"/etc/ld.so.conf.d/81-blas-*.conf - "${EROOT}"/etc/ld.so.conf.d/82-lapack-*.conf - ) - ${prev_opt} - - if [[ ${files[@]} ]]; then - rm -v "${files[@]}" - fi - fi -} diff --git a/sci-libs/flexiblas/flexiblas-3.4.84.ebuild b/sci-libs/flexiblas/flexiblas-3.4.84.ebuild deleted file mode 100644 index 8bbc65c26a867..0000000000000 --- a/sci-libs/flexiblas/flexiblas-3.4.84.ebuild +++ /dev/null @@ -1,267 +0,0 @@ -# Copyright 2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake multilib toolchain-funcs - -MY_P=flexiblas-release-v${PV} -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://gitlab.mpi-magdeburg.mpg.de/software/flexiblas-release/-/archive/v${PV}/${MY_P}.tar.bz2 -" -S=${WORKDIR}/${MY_P} - -# BSD for vendored cblas/lapacke -LICENSE="LGPL-3+ BSD" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" -IUSE="blis index64 mkl openblas openmp system-blas tbb test" -RESTRICT="!test? ( test )" - -# flexiblas only supports gnu-openmp using clang/gcc -DEPEND=" - sci-libs/lapack:=[deprecated,index64(-)?] - blis? ( sci-libs/blis:=[-64bit-index(-),index64(-)?] ) - mkl? ( - sci-libs/mkl:=[tbb?] - openmp? ( sci-libs/mkl[gnu-openmp] ) - ) - openblas? ( sci-libs/openblas:=[index64(-)?] ) - system-blas? ( sci-libs/lapack[flexiblas(-)] ) -" -RDEPEND=" - ${DEPEND} - system-blas? ( - !app-eselect/eselect-blas - !app-eselect/eselect-cblas - !app-eselect/eselect-lapack - !sci-libs/lapack[-flexiblas(-)] - !=sci-libs/blas-lapack-aux-wrapper-0-r0 - ) -" -PDEPEND=" - system-blas? ( - >=sci-libs/blas-lapack-aux-wrapper-0-r1[index64?] - ) -" - -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 - # (we still need vendored cblas/lapacke) - rm -r contributed/lapack-* || die -} - -src_configure() { - BACKENDS=( $(usev blis) $(usev openblas) ) - local extra=${BACKENDS[*]} - local libdir="${ESYSROOT}/usr/$(get_libdir)" - local mycmakeargs=( - -DTESTS=$(usex test) - -DCBLAS=ON - -DINTEGER8=OFF - -DLAPACK=ON - -DLINK_OPENMP=$(usex openmp) - -DEXAMPLES=OFF - # prefer OpenBLAS if available - -DFLEXIBLAS_DEFAULT=$(usex openblas openblas netlib) - # we need to enable autodetection for mkl - -DBLAS_AUTO_DETECT=ON - # ...so we need to explicitly disable autodetecting other libraries - # that would be pinned to their openmp/pthread/serial variants - -DOpenBLASSerial=OFF - -DOpenBLASPThread=OFF - -DOpenBLASOpenMP=OFF - -DOpenBLASSerial64=OFF - -DOpenBLASPThread64=OFF - -DOpenBLASOpenMP64=OFF - -DBlisSerial=OFF - -DBlisPThread=OFF - -DBlisOpenMP=OFF - -DBlisSerial64=OFF - -DBlisPThread64=OFF - -DBlisOpenMP64=OFF - # variants we use autodetection for - -DMklSerial=$(usex mkl ON OFF) - -DMklOpenMP=$(usex mkl "$(usex openmp ON OFF)" OFF) - -DMklTBB=$(usex mkl "$(usex tbb ON OFF)" OFF) - # unsupported - -DCMAKE_DISABLE_FIND_PACKAGE_nvpl=ON - -DATLAS=OFF - -DTATLAS=OFF - # and then enable our custom names via EXTRA - -DEXTRA="${extra// /;}" - # respect CFLAGS - -DLTO=OFF - # these are used only with -DEXTRA - -Dblis_LIBRARY="${libdir}/libblis.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas.so" - ) - - # use system sci-libs/lapack - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack.so" - ) - fi - - cmake_src_configure - - if use index64; then - mycmakeargs+=( - -DINTEGER8=ON - -Dblis_LIBRARY="${libdir}/libblis64.so" - -Dopenblas_LIBRARY="${libdir}/libopenblas64.so" - ) - - if use system-blas; then - # this is sci-libs/lapack[flexiblas] install - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64-reference.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64-reference.so" - ) - else - mycmakeargs+=( - -DSYS_BLAS_LIBRARY="${libdir}/libblas64.so" - -DSYS_LAPACK_LIBRARY="${libdir}/liblapack64.so" - ) - fi - - BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_configure - fi - - BACKENDS+=( netlib ) - BACKENDS_ILP64=( "${BACKENDS[@]}" ) - if use mkl; then - BACKENDS+=( - MklSerial - $(usev openmp MklOpenMP) - $(usev tbb MklTBB) - ) - BACKENDS_ILP64+=( - MklSerial64 - $(usev openmp MklOpenMP64) - $(usev tbb MklTBB64) - ) - fi -} - -src_compile() { - cmake_src_compile - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_compile -} - -my_test() { - # We run tests in parallel, so avoid having n^2 threads. - local -x BLIS_NUM_THREADS=1 - local -x MKL_NUM_THREADS=1 - local -x OMP_NUM_THREADS=1 - local -x OPENBLAS_NUM_THREADS=1 - - local backend - for backend in "${@}"; do - local args=() - if [[ ${backend} == Mkl* ]]; then - # XFAIL - args+=( -E 'cblat[23]' ) - fi - - local -x FLEXIBLAS_TEST=${backend} - local log=${BUILD_DIR}/Testing/Temporary/LastTest.log - einfo "Testing backend ${backend}" - cmake_src_test "${args[@]}" - if grep -q 'BLAS backend .* not found' "${log}"; then - die "Backend ${backend} failed to load while testing, see ${log}" - fi - done -} - -src_test() { - my_test "${BACKENDS[@]}" - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 my_test "${BACKENDS_ILP64[@]}" -} - -verify_backends() { - local lib=${1} - shift - cd "${ED}/usr/$(get_libdir)/${lib}" || die - - local missing=() - local backend - for backend in "${@}"; do - if [[ ! -f libflexiblas_${backend,,}$(get_libname) ]]; then - missing+=( "${backend}" ) - fi - done - - if [[ ${missing[@]} ]]; then - die "Not all requested ${lib} backends built. Missing: ${missing[*]}" - fi -} - -src_install() { - cmake_src_install - use index64 && BUILD_DIR=${BUILD_DIR}-ilp64 cmake_src_install - - # Verify built backends. - verify_backends flexiblas "${BACKENDS[@]}" - use index64 && verify_backends flexiblas64 "${BACKENDS_ILP64[@]}" - - # Install symlinks for system BLAS / LAPACK use. - if use system-blas; then - local libdir="/usr/$(get_libdir)" - local fn suffix - for fn in cblas.h lapack.h lapacke{,_config,_mangling,_utils}.h; do - dosym "flexiblas/${fn}" "/usr/include/${fn}" - done - - for suffix in '' $(usev index64 64); do - for fn in blas cblas lapack lapacke; do - dosym "libflexiblas${suffix}.so.3" \ - "${libdir}/lib${fn}${suffix}.so.3" - done - done - fi -} - -pkg_postinst() { - if use system-blas; then - # eselect-{blas,lapack} doesn't clean up its configs - local prev_opt=$(shopt -p nullglob) - shopt -s nullglob - local files=( - "${EROOT}"/etc/ld.so.conf.d/81-blas-*.conf - "${EROOT}"/etc/ld.so.conf.d/82-lapack-*.conf - ) - ${prev_opt} - - if [[ ${files[@]} ]]; then - rm -v "${files[@]}" - fi - fi -}