112 lines
3.9 KiB
Bash
112 lines
3.9 KiB
Bash
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
|
|
# Maintainer: Felix Yan <felixonmars@archlinux.org>
|
|
# Contributor: Giuseppe Borzi <gborzi _AT_ ieee _DOT_ org>
|
|
|
|
pkgbase=openblas
|
|
pkgname=(openblas openblas64 blas-openblas blas64-openblas)
|
|
_pkgname=OpenBLAS
|
|
pkgver=0.3.29
|
|
pkgrel=1
|
|
_blasver=3.12.0
|
|
pkgdesc="An optimized BLAS library based on GotoBLAS2 1.13 BSD"
|
|
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
|
|
url="https://www.openblas.net/"
|
|
license=('BSD')
|
|
depends=('gcc-libs')
|
|
makedepends=('git' 'cmake' 'perl' 'gcc-fortran')
|
|
source=(git+https://github.com/xianyi/OpenBLAS#tag=v$pkgver)
|
|
sha512sums=('1b6e5e4807f7a9531663294bf083ac709eb669ef37923875995d7cad6390e19e9ed8718ae11d3f52b2a9f0e3661dbe8988986cae52828cada13a726a6642255c')
|
|
|
|
build() {
|
|
# Setting FC manually to avoid picking up f95 and breaking the cmake build
|
|
# https://github.com/xianyi/OpenBLAS/issues/4072#issuecomment-1576388332
|
|
|
|
# Setting ASM flags for CET support. Setting FFLAGS for CET support.
|
|
# Remove ` -Wformat -Werror=format-security` not supported by gcc-fortran.
|
|
|
|
case "${CARCH}" in
|
|
powerpc) _cmake_options=(-DCORE=GENERIC -DTARGET=PPC440 -DBINARY=32 -DDYNAMIC_ARCH=OFF) ;;
|
|
powerpc64) _cmake_options=(-DCORE=PPC970 -DDYNAMIC_ARCH=OFF) ;;
|
|
powerpc64le) _cmake_options=(-DCORE=POWER8 -DDYNAMIC_ARCH=OFF) ;;
|
|
riscv64) _cmake_options=(-DTARGET=RISCV64_GENERIC); _cmake_options64=(-DFCOMMON_OPT=-fdefault-integer-8) ;;
|
|
x86_64) _cmake_options=(-DCORE=CORE2 -DDYNAMIC_ARCH=ON) ;;
|
|
*) _cmake_options=(-DDYNAMIC_ARCH=ON) ;;
|
|
esac
|
|
|
|
ASMFLAGS=$CFLAGS FFLAGS=${CFLAGS/ -Wformat -Werror=format-security/} FC=gfortran cmake -B build -S $_pkgname \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DBUILD_TESTING=OFF \
|
|
-DNO_AFFINITY=ON \
|
|
-DUSE_OPENMP=1 \
|
|
-DNO_WARMUP=1 \
|
|
-DNUM_THREADS=64 ${_cmake_options[@]}
|
|
cmake --build build
|
|
|
|
ASMFLAGS=$CFLAGS FFLAGS=${CFLAGS/ -Wformat -Werror=format-security/} FC=gfortran cmake -B build64 -S $_pkgname \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DBUILD_TESTING=OFF \
|
|
-DNO_AFFINITY=ON \
|
|
-DUSE_OPENMP=1 \
|
|
-DNO_WARMUP=1 \
|
|
-DNUM_THREADS=64 \
|
|
-DINTERFACE64=1 ${_cmake_options[@]} ${_cmake_options64[@]}
|
|
cmake --build build64
|
|
}
|
|
|
|
check() {
|
|
cd "$srcdir"/build
|
|
ctest
|
|
|
|
cd "$srcdir"/build64
|
|
ctest
|
|
}
|
|
|
|
package_openblas() {
|
|
DESTDIR="$pkgdir" cmake --install build
|
|
install -Dm644 $_pkgname/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
|
|
}
|
|
|
|
package_openblas64() {
|
|
pkgdesc+=" (64-bit integers)"
|
|
DESTDIR="$pkgdir" cmake --install build64
|
|
install -Dm644 $_pkgname/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
|
|
|
|
cd "$pkgdir"/usr/lib/
|
|
ln -s libopenblas_64.so.${pkgver%.*} libopenblas64_.so # Needed by julia
|
|
}
|
|
|
|
package_blas-openblas() {
|
|
pkgdesc+=" (Provides BLAS/CBLAS/LAPACK/LAPACKE system-wide)"
|
|
depends=('openblas')
|
|
provides=("blas=$_blasver" "cblas=$_blasver" "lapack=$_blasver" "lapacke=$_blasver" "openblas-lapack=$pkgver")
|
|
conflicts=('blas' 'cblas' 'lapack' 'lapacke' 'openblas-lapack')
|
|
replaces=('openblas-lapack')
|
|
|
|
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
|
|
}
|
|
|
|
# vim:set ts=2 sw=2 et:
|