PKGBUILDs/extra/openblas/PKGBUILD

113 lines
3.6 KiB
Bash
Raw Normal View History

2020-12-21 16:14:26 +00:00
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Giuseppe Borzi <gborzi _AT_ ieee _DOT_ org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - set build targets
2023-04-15 03:54:19 +00:00
# - disable dynamic arch on v8, FTBFS starting 0.3.23
2020-12-21 16:14:26 +00:00
2023-02-04 02:42:14 +00:00
pkgbase=openblas
2023-06-15 00:47:32 +00:00
pkgname=(openblas openblas64 blas-openblas blas64-openblas)
2020-12-21 16:14:26 +00:00
_pkgname=OpenBLAS
2024-01-06 23:06:44 +00:00
pkgver=0.3.26
2024-01-30 14:20:31 +00:00
pkgrel=2
2023-12-23 03:20:28 +00:00
_blasver=3.12.0
2020-12-21 16:14:26 +00:00
pkgdesc="An optimized BLAS library based on GotoBLAS2 1.13 BSD"
arch=('x86_64')
url="https://www.openblas.net/"
license=('BSD')
depends=('gcc-libs')
2023-02-04 02:42:14 +00:00
makedepends=('cmake' 'perl' 'gcc-fortran')
2023-04-14 22:49:30 +00:00
source=(${_pkgname}-v${pkgver}.tar.gz::https://github.com/xianyi/OpenBLAS/archive/v${pkgver}.tar.gz)
2024-01-06 23:06:44 +00:00
sha512sums=('01d3a536fbfa62f276fd6b1ad0e218fb3d91f41545fc83ddc74979fa26372d8389f0baa20334badfe0adacd77bd944c50a47ac920577373fcc1d495553084373')
2020-12-21 16:14:26 +00:00
build() {
2023-04-15 03:54:19 +00:00
[[ $CARCH == "aarch64" ]] && CORE="ARMV8" && DYN="OFF"
[[ $CARCH == "armv7h" ]] && CORE="ARMV7" && DYN="ON"
2020-12-21 16:14:26 +00:00
2023-06-15 00:47:32 +00:00
# Setting FC manually to avoid picking up f95 and breaking the cmake build
# https://github.com/xianyi/OpenBLAS/issues/4072#issuecomment-1576388332
2024-01-30 14:20:31 +00:00
# Setting ASM flags for CET support. Setting FFLAGS for CET support.
# Remove ` -Wformat -Werror=format-security` not supported by gcc-fortran.
ASMFLAGS=$CFLAGS FFLAGS=${CFLAGS/ -Wformat -Werror=format-security/} FC=gfortran cmake -B build -S $_pkgname-$pkgver \
2023-02-04 02:42:14 +00:00
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DNO_AFFINITY=ON \
-DUSE_OPENMP=1 \
-DNO_WARMUP=1 \
-DCORE=$CORE \
-DNUM_THREADS=64 \
2023-04-15 03:54:19 +00:00
-DDYNAMIC_ARCH=$DYN
2023-02-04 02:42:14 +00:00
cmake --build build
2020-12-21 16:14:26 +00:00
2024-01-30 14:20:31 +00:00
ASMFLAGS=$CFLAGS FFLAGS=${CFLAGS/ -Wformat -Werror=format-security/} FC=gfortran cmake -B build64 -S $_pkgname-$pkgver \
2023-02-04 02:42:14 +00:00
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DNO_AFFINITY=ON \
-DUSE_OPENMP=1 \
-DNO_WARMUP=1 \
-DCORE=$CORE \
-DNUM_THREADS=64 \
2023-04-15 03:54:19 +00:00
-DDYNAMIC_ARCH=$DYN \
2023-02-04 02:42:14 +00:00
-DINTERFACE64=1
cmake --build build64
2020-12-21 16:14:26 +00:00
}
2021-04-24 20:09:26 +00:00
check() {
2023-06-15 00:47:32 +00:00
cd "$srcdir"/build
ctest
cd "$srcdir"/build64
ctest
2021-04-24 20:09:26 +00:00
}
2023-02-04 02:42:14 +00:00
package_openblas() {
DESTDIR="$pkgdir" cmake --install build
install -Dm644 $_pkgname-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
package_openblas64() {
pkgdesc+=" (64-bit integers)"
DESTDIR="$pkgdir" cmake --install build64
install -Dm644 $_pkgname-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
cd "$pkgdir"/usr/lib/
ln -s libopenblas_64.so.${pkgver%.*} libopenblas64_.so # Needed by julia
2023-06-15 00:47:32 +00:00
}
package_blas-openblas() {
pkgdesc+=" (Provides BLAS/CBLAS/LAPACK/LAPACKE system-wide)"
depends=('openblas')
2023-09-14 18:53:17 +00:00
provides=("blas=$_blasver" "cblas=$_blasver" "lapack=$_blasver" "lapacke=$_blasver" "openblas-lapack=$pkgver")
conflicts=('blas' 'cblas' 'lapack' 'lapacke' 'openblas-lapack')
replaces=('openblas-lapack')
2023-06-15 00:47:32 +00:00
mkdir -p "$pkgdir"/usr/lib/pkgconfig
cd "$pkgdir"/usr/lib/
for _lib in blas cblas lapack lapacke; do
ln -s libopenblas.so.${pkgver%.*} lib${_lib}.so
ln -s libopenblas.so.${pkgver%.*} lib${_lib}.so.3
ln -s openblas.pc "$pkgdir"/usr/lib/pkgconfig/${_lib}.pc
done
}
package_blas64-openblas() {
pkgdesc+=" (64-bit integers, provides BLAS/CBLAS/LAPACK/LAPACKE system-wide)"
depends=('openblas64')
provides=("blas64=$_blasver" "cblas64=$_blasver" "lapack64=$_blasver" "lapacke64=$_blasver")
conflicts=('blas64' 'cblas64' 'lapack64' 'lapacke64')
mkdir -p "$pkgdir"/usr/lib/pkgconfig
cd "$pkgdir"/usr/lib/
for _lib in blas64 cblas64 lapack64 lapacke64; do
ln -s libopenblas_64.so.${pkgver%.*} lib${_lib}.so
ln -s libopenblas_64.so.${pkgver%.*} lib${_lib}.so.3
ln -s openblas64.pc "$pkgdir"/usr/lib/pkgconfig/${_lib}.pc
done
2020-12-21 16:14:26 +00:00
}
# vim:set ts=2 sw=2 et: