APKBUILD 3.08 KB
Newer Older
Isaac Dunham's avatar
Isaac Dunham committed
1
# Contributor: Isaac Dunham <ibid.ag@gmail.com>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
Isaac Dunham's avatar
Isaac Dunham committed
3 4
# Maintainer: Isaac Dunham <ibid.ag@gmail.com>
pkgname=openblas
5 6
_pkgname=OpenBLAS
pkgver=0.2.18
7
pkgrel=2
Isaac Dunham's avatar
Isaac Dunham committed
8 9 10 11 12 13
pkgdesc="A fast BSD-licensed BLAS based on gotoBLAS2, with LAPACK"
url="http://www.openblas.net"
arch="all"
license="BSD"
depends=""
depends_dev="gfortran"
14
makedepends="$depends_dev perl linux-headers"
15 16
subpackages="$pkgname-dev $pkgname-doc"
[ "$CARCH" = x86_64 ] && subpackages="$subpackages $pkgname-ilp64"
17
source="$pkgname-$pkgver.tar.gz::http://github.com/xianyi/$_pkgname/archive/v$pkgver.tar.gz
18 19
	0001-Use-strsignal-instead-of-sys_siglist.patch
	"
20
builddir="$srcdir/$_pkgname-$pkgver"
21
_builddir64="$builddir-64"
22 23

# USE_OPENMP=0: see GCC bug 60035
24 25
# NO_AFFINITY: don't expect to work on musl, also breaks R and not
#              recommended for Julia
26 27 28 29 30
_flags="USE_OPENMP=0
	NO_LAPACK=0
	MAJOR_VERSION=3
	NO_AFFINITY=1
	"
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
# DYNAMIC_ARCH: supported on x86* only, see https://github.com/xianyi/OpenBLAS/issues/709
# NUM_THREADS: 64bit match kernel's CONFIG_NR_CPUS (32)
#              32bit machines usually don't have so many cores so use 8
case "$CARCH" in
	x86_64) _flags="$_flags DYNAMIC_ARCH=1 NUM_THREADS=32" ;;
	x86)    _flags="$_flags DYNAMIC_ARCH=1 NUM_THREADS=8" ;;
	*)      _flags="$_flags DYNAMIC_ARCH=0 NUM_THREADS=8" ;;
esac

# Flags for ILP64 variant.
_flags64="$_flags
	INTERFACE64=1
	SYMBOLSUFFIX=64_"

prepare() {
	default_prepare || return 1

	cp -ar "$builddir" "$_builddir64"
}
50

Isaac Dunham's avatar
Isaac Dunham committed
51
build() {
52 53
	CFLAGS= make -C "$builddir" \
		$_flags CFLAGS="$CFLAGS" PREFIX=/usr || return 1
54

55 56 57 58 59
	if [ "$CARCH" = "x86_64" ]; then
		msg "Building with ILP64..."
		CFLAGS= make -C "$_builddir64" \
			$_flags64 CFLAGS="$CFLAGS" PREFIX=/usr || return 1
	fi
Isaac Dunham's avatar
Isaac Dunham committed
60 61 62
}

package() {
63 64 65 66 67
	if [ "$CARCH" = "x86_64" ]; then
		make -C "$_builddir64" $_flags64 \
			PREFIX="$pkgdir/usr" install || return 1
	fi

68 69 70 71
	cd "$builddir"

	make $_flags PREFIX="$pkgdir/usr" install || return 1

72 73 74 75 76 77 78 79 80
	# Remove reference to $pkgdir.
	sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/cmake/$pkgname/OpenBLASConfig.cmake

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m 0644 Changelog.txt TargetList.txt USAGE.md \
		"$pkgdir"/usr/share/doc/$pkgname/ || return 1

	install -Dm 0644 LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
Isaac Dunham's avatar
Isaac Dunham committed
81
}
82

83 84 85 86 87 88 89 90
ilp64() {
	pkgdesc="$pkgdesc (ILP64)"
	arch="x86_64"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libopenblas64_* "$subpkgdir"/usr/lib/
}

91
md5sums="805e7f660877d588ea7e3792cda2ee65  openblas-0.2.18.tar.gz
92
ddce6ae8c2af85ebdd14e9150960d1c6  0001-Use-strsignal-instead-of-sys_siglist.patch"
93
sha256sums="7d9f8d4ea4a65ab68088f3bb557f03a7ac9cb5036ef2ba30546c3a28774a4112  openblas-0.2.18.tar.gz
94
4e662d5dd5d03e0067c856d3c359d4306a8fb1ad66c2a70a7cf851decf5fdea3  0001-Use-strsignal-instead-of-sys_siglist.patch"
95
sha512sums="224990959ead6247613519f52447c31968170349a0040e746862b948c851166499050f5db7cefc66f9c1695262457980ae8d0e49b14f3442267f2a43f5a14e47  openblas-0.2.18.tar.gz
96
d3dd7cad2c0bc5414642cf51a46bc57e681c4449bd829bf304c743c44c53f29d90ba0c43233bf5a7cce3e6b057d1c1cef27d0ccffecb50125993b34c913477c8  0001-Use-strsignal-instead-of-sys_siglist.patch"