mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-24 19:55:26 +03:00
185 lines
4.3 KiB
Text
185 lines
4.3 KiB
Text
# Contributor: Isaac Dunham <ibid.ag@gmail.com>
|
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
|
|
# Maintainer:
|
|
pkgname=openblas
|
|
_pkgname=OpenBLAS
|
|
pkgver=0.3.21
|
|
pkgrel=4
|
|
pkgdesc="fast BSD-licensed BLAS based on gotoBLAS2, with LAPACK"
|
|
url="https://www.openblas.net/"
|
|
arch="all"
|
|
license="BSD-3-Clause"
|
|
depends_dev="gfortran"
|
|
makedepends="$depends_dev perl linux-headers"
|
|
subpackages="
|
|
$pkgname-dev
|
|
$pkgname-doc
|
|
liblapack
|
|
liblapacke
|
|
"
|
|
source="https://github.com/xianyi/$_pkgname/archive/v$pkgver/openblas-$pkgver.tar.gz
|
|
separate-tests.patch
|
|
https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/openblas/files/openblas-0.3.12-shared-blas-lapack.patch
|
|
"
|
|
builddir="$srcdir/$_pkgname-$pkgver"
|
|
_builddir64="$builddir-64"
|
|
|
|
# this provides mostly the same thing as community/lapack,
|
|
# but they should be separate
|
|
sonameprefix="$pkgname:"
|
|
|
|
# ILP64 is not supported on aarch64 (https://github.com/xianyi/OpenBLAS/issues/956)
|
|
_ilp64=false
|
|
if [ "$CARCH" = "x86_64" ]; then
|
|
subpackages="$subpackages $pkgname-ilp64"
|
|
_ilp64=true
|
|
fi
|
|
|
|
# USE_OPENMP=0: see GCC bug 60035
|
|
# NO_AFFINITY: don't expect to work on musl, also breaks R and not
|
|
# recommended for Julia
|
|
# NO_STATIC: this is absolutely massive and not used anywhere in aports
|
|
_flags="
|
|
MAJOR_VERSION=3
|
|
NO_AFFINITY=1
|
|
NO_STATIC=1
|
|
USE_OPENMP=0
|
|
PREFIX=/usr
|
|
"
|
|
case "$CARCH" in
|
|
ppc64le)
|
|
# POWER machines are big and have 4/8 way SMT
|
|
_flags="$_flags NUM_THREADS=64"
|
|
;;
|
|
*64|s390x)
|
|
# match kernel's CONFIG_NR_CPUS
|
|
_flags="$_flags NUM_THREADS=32"
|
|
;;
|
|
*)
|
|
# 32bit machines usually have fewer cores
|
|
_flags="$_flags NUM_THREADS=8"
|
|
;;
|
|
esac
|
|
|
|
case "$CARCH" in
|
|
x86*)
|
|
# DYNAMIC_ARCH is supported on x86* only, see
|
|
# https://github.com/xianyi/OpenBLAS/issues/709
|
|
_flags="$_flags DYNAMIC_ARCH=1"
|
|
;;
|
|
*)
|
|
_flags="$_flags DYNAMIC_ARCH=0"
|
|
;;
|
|
esac
|
|
|
|
case "$CARCH" in
|
|
x86*)
|
|
_flags="$_flags TARGET=CORE2"
|
|
;;
|
|
armhf)
|
|
_flags="$_flags TARGET=ARMV6"
|
|
;;
|
|
armv7)
|
|
_flags="$_flags TARGET=ARMV7"
|
|
;;
|
|
aarch64)
|
|
_flags="$_flags TARGET=ARMV8"
|
|
;;
|
|
ppc64le)
|
|
_flags="$_flags TARGET=POWER8"
|
|
;;
|
|
s390x)
|
|
_flags="$_flags TARGET=ZARCH_GENERIC"
|
|
;;
|
|
riscv64)
|
|
_flags="$_flags TARGET=RISCV64_GENERIC"
|
|
;;
|
|
esac
|
|
|
|
# Flags for ILP64 variant.
|
|
_flags64="
|
|
$_flags
|
|
INTERFACE64=1
|
|
SYMBOLSUFFIX=64_
|
|
"
|
|
|
|
prepare() {
|
|
default_prepare
|
|
|
|
if [ "$CARCH" = "ppc64le" ] ; then
|
|
# Skip test level 3 on ppc64le for a while
|
|
sed 's/level2 level3/level2/g' -i "$builddir"/test/Makefile
|
|
sed 's/all2 all3/all2/g' -i "$builddir"/ctest/Makefile
|
|
fi
|
|
cp -ar "$builddir" "$_builddir64"
|
|
}
|
|
|
|
build() {
|
|
# OpenBLAS library is huge and it's heavily optimized for performance.
|
|
# It doesn't make sense to compile it with -Os.
|
|
export CFLAGS=${CFLAGS/-Os/-O2}
|
|
|
|
make -C "$builddir" \
|
|
$_flags CFLAGS="$CFLAGS"
|
|
make -C "$builddir"/interface \
|
|
$_flags CFLAGS="$CFLAGS" shared-blas-lapack
|
|
|
|
if $_ilp64; then
|
|
msg "Building with ILP64..."
|
|
make -C "$_builddir64" $_flags64 CFLAGS="$CFLAGS"
|
|
fi
|
|
}
|
|
|
|
dev() {
|
|
provides="blas-dev lapack-dev"
|
|
replaces="$provides"
|
|
|
|
default_dev
|
|
}
|
|
|
|
check() {
|
|
make $_flags CFLAGS="$CFLAGS" tests
|
|
}
|
|
|
|
package() {
|
|
if $_ilp64; then
|
|
make -C "$_builddir64" $_flags64 DESTDIR="$pkgdir" install
|
|
fi
|
|
|
|
make $_flags DESTDIR="$pkgdir" install
|
|
install -Dm755 interface/liblapack.so.3 \
|
|
"$pkgdir"/usr/lib/liblapack.so.3
|
|
ln -s liblapack.so.3 "$pkgdir"/usr/lib/liblapack.so
|
|
install -Dm755 interface/liblapacke.so.3 \
|
|
"$pkgdir"/usr/lib/liblapacke.so.3
|
|
ln -s liblapacke.so.3 "$pkgdir"/usr/lib/liblapacke.so
|
|
|
|
install -Dm 0644 Changelog.txt TargetList.txt USAGE.md \
|
|
-t "$pkgdir"/usr/share/doc/$pkgname/
|
|
}
|
|
|
|
ilp64() {
|
|
pkgdesc="$pkgdesc (ILP64)"
|
|
|
|
amove usr/lib/libopenblas64_*
|
|
}
|
|
|
|
liblapack() {
|
|
pkgdesc="$pkgdesc (LAPACK library)"
|
|
# provides the same library
|
|
depends="!lapack"
|
|
amove usr/lib/liblapack.so.*
|
|
}
|
|
|
|
liblapacke() {
|
|
pkgdesc="$pkgdesc (LAPACKE library)"
|
|
# provides the same library
|
|
depends="!lapack"
|
|
amove usr/lib/liblapacke.so.*
|
|
}
|
|
|
|
sha512sums="
|
|
4625c8e6ccfa9120281fd714d3f6b7c3ba2265470c1be76121d6b25dc3dacb899d26e5d9a417ddc616d23909f1411495aa995ef8d8d6df8511cd5cefbabcb1c5 openblas-0.3.21.tar.gz
|
|
de2769ba6d1adcb31e19732c6c4a9f39dc1745932b954106a8037a4dfa98d77a468bd414abadab0d72bbbabf17f86748fb9297051c937fd6eae3d375aa5f5ad7 separate-tests.patch
|
|
3f0d4b480549565c838eba6371e0990c162f56a226f9d26e1639e012ae3f39809f8c6badcf8fdfbb1258f45367dbaff9c4c611b8b44bac27d341aea954f0133e openblas-0.3.12-shared-blas-lapack.patch
|
|
"
|