# $Id: PKGBUILD 55583 2011-09-14 11:20:19Z andrea $
# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: damir <damir@archlinux.org>

pkgname=fftw2
pkgver=2.1.5
pkgrel=5
pkgdesc="A C subroutine library for computing the discrete Fourier transform (DFT)"
arch=('i686' 'x86_64')
url="http://www.fftw.org/"
license=('GPL2')
depends=('glibc')
makedepends=('gcc-fortran')
options=('!libtool')
source=("http://www.fftw.org/fftw-${pkgver}.tar.gz")
md5sums=('8d16a84f3ca02a785ef9eb36249ba433')

build() {
  cd "${srcdir}"
  
  cp -r fftw-${pkgver} fftw-${pkgver}-double
 
  # build single precision
  cd fftw-${pkgver}
  ./configure F77=gfortran --prefix=/usr \
              --enable-float \
              --enable-type-prefix \
              --enable-shared \
              --enable-threads \
              --infodir=/usr/share/info
  make
  cd ../

  # build double precision
  cd fftw-${pkgver}-double
  ./configure F77=gfortran --prefix=/usr \
              --enable-type-prefix \
              --enable-shared \
              --enable-threads \
              --infodir=/usr/share/info
  make
}

package() {
  # install single precision
  cd "${srcdir}"/fftw-${pkgver}
  make DESTDIR="${pkgdir}" install

  # install double precision
  cd "${srcdir}"/fftw-${pkgver}-double
  make DESTDIR="${pkgdir}" install
}