summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0fde0fb9856d3e8966a15c89abf2d2ef78bb3695 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Maintainer: pingplug < aur at pingplug dot me >
# Contributor: Jiaxi Hu < sftrytry at gmail dot com >

_pkgname=OpenBLAS
_lapackver=3.9.0
_blasver=3.8.0
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
BUILDFLAG="USE_OPENMP=1 USE_THREAD=1 MAJOR_VERSION=3 NO_LAPACK=0 BUILD_LAPACK_DEPRECATED=1 CROSS=1 HOSTCC=gcc"

pkgname=mingw-w64-openblas-lapack
pkgver=0.3.17
pkgrel=1
pkgdesc="An optimized BLAS library based on GotoBLAS2 1.13 BSD, providing optimized blas, lapack, and cblas (mingw-w64)"
arch=('any')
url="https://github.com/xianyi/OpenBLAS"
license=('BSD')
depends=('mingw-w64-crt')
makedepends=('perl'
             'mingw-w64-gcc')
provides=('mingw-w64-openblas'
          "mingw-w64-blas=$_blasver"
          "mingw-w64-cblas=$_blasver"
          "mingw-w64-lapack=$_lapackver"
          "mingw-w64-lapacke=$_lapackver")
conflicts=('mingw-w64-openblas'
           'mingw-w64-blas'
           'mingw-w64-cblas'
           'mingw-w64-lapack'
           'mingw-w64-lapacke')
options=('!strip' 'staticlibs' '!buildflags')
source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/xianyi/${_pkgname}/archive/v${pkgver}.tar.gz")
sha256sums=('df2934fa33d04fd84d839ca698280df55c690c86a5a1133b3f7266fce1de279f')

prepare() {
  cd ${srcdir}
}

build() {
  cd ${srcdir}
  for _arch in ${_architectures}; do
    cp -a "${_pkgname}-${pkgver}" "${_pkgname}-build-${_arch}"
    pushd "${_pkgname}-build-${_arch}"

    if [ "${_arch}" = "i686-w64-mingw32" ]
    then
      _BUILDFLAG="${BUILDFLAG} BINARY=32"
    else
      _BUILDFLAG="${BUILDFLAG} BINARY=64"
    fi

    make ${_BUILDFLAG} CC=${_arch}-gcc FC=${_arch}-gfortran libs
    make ${_BUILDFLAG} CC=${_arch}-gcc FC=${_arch}-gfortran netlib
    make ${_BUILDFLAG} CC=${_arch}-gcc FC=${_arch}-gfortran shared
    popd
  done
}

check() {
  cd ${srcdir}
  for _arch in ${_architectures}; do
    pushd "${_pkgname}-build-${_arch}"

    if [ "${_arch}" = "i686-w64-mingw32" ]
    then
      _BUILDFLAG="${BUILDFLAG} BINARY=32"
    else
      _BUILDFLAG="${BUILDFLAG} BINARY=64"
    fi

    # this is actually build tests only, not execute test
    make ${_BUILDFLAG} CC=${_arch}-gcc FC=${_arch}-gfortran tests
    popd
  done
}

package() {
  cd ${srcdir}
  for _arch in ${_architectures}; do
    pushd "${_pkgname}-build-${_arch}"
    make ${BUILDFLAG} PREFIX="/usr/${_arch}" DESTDIR="${pkgdir}" install
    install -Dm644 libopenblas.dll.a "${pkgdir}/usr/${_arch}/lib"

    ${_arch}-strip --strip-unneeded "${pkgdir}/usr/${_arch}/bin/"*.dll
    ${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a

    cd "${pkgdir}/usr/${_arch}/bin/"
    ln -sf libopenblas.dll libblas.dll
    ln -sf libopenblas.dll libcblas.dll
    ln -sf libopenblas.dll libf77blas.dll
    ln -sf libopenblas.dll liblapack.dll
    ln -sf libopenblas.dll liblapacke.dll

    cd "${pkgdir}/usr/${_arch}/lib/"
    ln -sf libopenblas.dll.a libblas.dll.a
    ln -sf libopenblas.a libblas.a
    ln -sf libopenblas.dll.a libcblas.dll.a
    ln -sf libopenblas.a libcblas.a
    ln -sf libopenblas.dll.a libf77blas.dll.a
    ln -sf libopenblas.a libf77blas.a
    ln -sf libopenblas.dll.a liblapack.dll.a
    ln -sf libopenblas.a liblapack.a
    ln -sf libopenblas.dll.a liblapacke.dll.a
    ln -sf libopenblas.a liblapacke.a

    popd
  done

  cd "${_pkgname}-${pkgver}"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et: