summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d17d82f798283266c311d1297ecafd97b217ebca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Maintainer: andrewwja <aanderso [at] tcd [DOt] ie>
# Contributor: eolianoe <eolianoe [at] gmail [DoT] com>
# Contributor: Jiaxi Hu <sftrytry _AT_ gmail _DOT_ com>
# Contributor: Giuseppe Borzi <gborzi _AT_ ieee _DOT_ org>

pkgname=aarch64-linux-gnu-openblas-lapack-openmp
_PkgName=OpenBLAS
_pkgname=openblas
pkgver=0.3.4
_lapackver=3.8.0
pkgrel=18
pkgdesc="Optimized BLAS library based on GotoBLAS2 1.13 BSD (providing blas, lapack, and cblas)"
arch=('any')
url="http://www.openblas.net/"
license=('BSD')
depends=('gcc-libs')
makedepends=('perl' 'aarch64-linux-gnu-gcc')
provides=('aarch64-linux-gnu-openblas' "aarch64-linux-gnu-blas=${_lapackver}" "aarch64-linux-gnu-lapack=${_lapackver}" "aarch64-linux-gnu-cblas=${_lapackver}" "aarch64-linux-gnu-lapacke=${_lapackver}")
conflicts=()
options=(!emptydirs !strip)
source=(${_PkgName}-${pkgver}.tar.gz::https://github.com/xianyi/${_PkgName}/archive/v${pkgver}.tar.gz)
sha256sums=('SKIP')

_ncpus=$(eval "cat /proc/cpuinfo | grep MHz | wc -l")

_config="BINARY=64 CC=aarch64-linux-gnu-gcc FC=aarch64-linux-gnu-gfortran HOSTCC=gcc TARGET=ARMV8 \
  USE_OPENMP=1 USE_THREAD=1 USE_COMPILER_TLS=0 \
  NO_STATIC=0 NO_SHARED=0 \
  NO_LAPACK=0 BUILD_LAPACK_DEPRECATED=1 \
  MAKE_NB_JOBS=${_ncpus} \
  PREFIX=/usr/aarch64-linux-gnu "

build(){
  cd "${srcdir}/${_PkgName}-${pkgver}"

  make ${_config} CFLAGS="-mtune=generic -I /usr/aarch64/include -L /usr/aarch64/lib -L /usr/aarch64/lib64" libs netlib shared
}

check(){
  #cd "${srcdir}/${_PkgName}-${pkgver}"

  #make ${_config} tests

  true
}

package(){
  cd "${srcdir}/${_PkgName}-${pkgver}"

  make ${_config} DESTDIR="${pkgdir}" install

  # Install license
  install -Dm644 LICENSE "${pkgdir}/usr/aarch64-linux-gnu/share/licenses/${pkgname}/LICENSE"

  # Install static lib
  _static_lib_name=`ls libopenblas_*.a`
  install -Dm644 ${_static_lib_name} "${pkgdir}/usr/aarch64-linux-gnu/lib/${_static_lib_name}"

  # Symlink to provide blas, cblas, lapack and lapacke
  cd "${pkgdir}/usr/aarch64-linux-gnu/lib/"
  # Static lib
  ln -sf ${_static_lib_name} libopenblas.a
  # BLAS
  ln -sf libopenblas.so libblas.so
  ln -sf libopenblas.so libblas.so.${_lapackver:0:1}
  ln -sf libopenblas.so libblas.so.${_lapackver}
  # CBLAS
  ln -sf libopenblas.so libcblas.so
  ln -sf libopenblas.so libcblas.so.${_lapackver:0:1}
  ln -sf libopenblas.so libcblas.so.${_lapackver}
  # LAPACK
  ln -sf libopenblas.so liblapack.so
  ln -sf libopenblas.so liblapack.so.${_lapackver:0:1}
  ln -sf libopenblas.so liblapack.so.${_lapackver}
  # LAPACKE
  ln -sf libopenblas.so liblapacke.so
  ln -sf libopenblas.so liblapacke.so.${_lapackver:0:1}
  ln -sf libopenblas.so liblapacke.so.${_lapackver}
}
# vim:set ts=2 sw=2 et: