# $Id: PKGBUILD 135287 2015-06-14 11:28:35Z arojas $
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andreas B. Wagner <AndreasBWagner@pointfree.net>
# Contributor: Sebastien Binet <binet@farnsworth>pkgname=cblas

pkgname=cblas
pkgver=3.5.0
pkgrel=3
pkgdesc="C interface to BLAS"
url="http://www.netlib.org/blas"
arch=(i686 x86_64)
license=(custom)
depends=(blas)
makedepends=(gcc-fortran)
options=(staticlibs) # needed by fflas-ffpack
source=('http://www.netlib.org/blas/blast-forum/cblas.tgz' 'shared.patch' 'fPIC.patch' 'sdsdot.patch' 'LICENSE')
md5sums=('1e8830f622d2112239a4a8a83b84209a'
         'e779fc195f8f48672656522bcfd642e4'
         'de4a0cf18b0e748e85d3305845f7f99b'
         '733dcdded7ce1ec6d1ec01ceca200426'
         '38b6acb8ed5691d25863319d30a8b365')

prepare() {
  cd CBLAS

# Compile with -fPIC
  patch -p1 -i "$srcdir"/fPIC.patch
# Compile shared lib
  patch -p0 -i "$srcdir"/shared.patch
# Fix missing variable in sdsdotstub
  patch -p1 -i "$srcdir"/sdsdot.patch

  cp Makefile.{LINUX,in}
}

build() {
  cd CBLAS

  make alllib
}

package() {
  install -d "$pkgdir"/usr/lib
  install -d "$pkgdir"/usr/include

  install -m644 CBLAS/lib/* "$pkgdir"/usr/lib/
  install -m644 CBLAS/include/*.h "$pkgdir"/usr/include

  install -d "$pkgdir"/usr/share/licenses/cblas
  install -m644 LICENSE "$pkgdir"/usr/share/licenses/cblas/
}
