# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
# Maintainer: damir <damir@archlinux.org>

pkgname=fftw2
pkgver=2.1.5
pkgrel=9
pkgdesc="FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of both real and complex data, and of arbitrary input size. This is package is offering backwards compatibility version 2.x.y. of fftw."
arch=(i686 x86_64)
url="http://www.fftw.org/"
license=('GPL2')
depends=('glibc')
options=(!libtool !emptydirs !docs)
source=(http://www.fftw.org/fftw-${pkgver}.tar.gz)
md5sums=('8d16a84f3ca02a785ef9eb36249ba433')

build() {
  cd ${startdir}/src/fftw-${pkgver}
  # build + install double precision
  ./configure F77=gfortran --prefix=/usr \
              --enable-type-prefix --enable-shared \
              --enable-threads
  make || return 1
  make DESTDIR=${startdir}/pkg install || return 1

  make clean

  # build + install single precision
  ./configure F77=gfortran --prefix=/usr \
              --enable-float --enable-type-prefix --enable-shared \
              --enable-threads
  make || return 1
  #make prefix=$startdir/pkg/usr install || return 1
  make DESTDIR=${startdir}/pkg install || return 1
  cd $startdir/pkg/usr/include/
  ln -s sfftw.h fftw.h
  ln -s sfftw_threads.h fftw_threads.h
  ln -s srfftw.h rfftw.h
  ln -s srfftw_threads.h rfftw_threads.h
  cd $startdir/pkg/usr/lib
  ln -s libsfftw.a libfftw.a
  ln -s libsfftw.so libfftw.so
  ln -s libsfftw.so.2 libfftw.so.2
  ln -s libsfftw.so.2.0.7 libfftw.so.2.0.7
  ln -s libsfftw_threads.a libfftw_threads.a
  ln -s libsfftw_threads.so libfftw_threads.so
  ln -s libsfftw_threads.so.2 libfftw_threads.so.2
  ln -s libsfftw_threads.so.2.0.7 libfftw_threads.so.2.0.7
  ln -s libsrfftw.a librfftw.a
  ln -s libsrfftw.so librfftw.so
  ln -s libsrfftw.so.2 librfftw.so.2
  ln -s libsrfftw.so.2.0.7 librfftw.so.2.0.7
  ln -s libsrfftw_threads.a librfftw_threads.a
  ln -s libsrfftw_threads.so librfftw_threads.so
  ln -s libsrfftw_threads.so.2 librfftw_threads.so.2
  ln -s libsrfftw_threads.so.2.0.7 librfftw_threads.so.2.0.7
}