summaryrefslogtreecommitdiff
path: root/extra/fftw/PKGBUILD
blob: 67a9365a0279af8ad9f02bb0759717792be67cbb (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
# $Id: PKGBUILD 176986 2013-02-03 11:04:50Z allan $
# Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: damir <damir@archlinux.org>

pkgname=fftw
pkgver=3.3.3
pkgrel=1
pkgdesc="A library for computing the discrete Fourier transform (DFT)"
arch=('i686' 'x86_64' 'mips64el')
license=('GPL2')
url="http://www.fftw.org/"
depends=('glibc' 'bash')
makedepends=('gcc-fortran')
options=('!libtool')
source=("http://www.fftw.org/${pkgname}-${pkgver}.tar.gz")
install=fftw.install
sha1sums=('11487180928d05746d431ebe7a176b52fe205cf9')

# notes:
# http://www.fftw.org/fftw2_doc/fftw_6.html#SEC69
# http://www.fftw.org/faq/section2.html#singleprec
# http://www.fftw.org/fftw3_doc/Precision.html#Precision


build() {
  cd ${srcdir}
  
  cp -a ${pkgname}-${pkgver} ${pkgname}-${pkgver}-double
  cp -a ${pkgname}-${pkgver} ${pkgname}-${pkgver}-long-double
  mv ${pkgname}-${pkgver} ${pkgname}-${pkgver}-single
  

  if [ "$CARCH" = "mips64el" ] ; then
      sse2=""
      sse=""
      aligndouble=""
  else
      sse2="--enable-sse2"
      sse="--enable-sse"
      aligndouble="-malign-double"
  fi

  # use upstream default CFLAGS while keeping our -march/-mtune
  CFLAGS+=" -O3 -fomit-frame-pointer $aligndouble -fstrict-aliasing -ffast-math"

  CONFIGURE="./configure F77=gfortran --prefix=/usr \
                 --enable-shared --enable-threads"

  # build double precision
  cd ${srcdir}/${pkgname}-${pkgver}-double
  $CONFIGURE $sse2
  make

  # build & install long double precission
  cd ${srcdir}/${pkgname}-${pkgver}-long-double
  $CONFIGURE --enable-long-double
  make

  # build & install single precision
  cd ${srcdir}/${pkgname}-${pkgver}-single
  $CONFIGURE --enable-float $sse
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}-double
  make DESTDIR=${pkgdir} install

  cd ${srcdir}/${pkgname}-${pkgver}-long-double
  make DESTDIR=${pkgdir} install

  cd ${srcdir}/${pkgname}-${pkgver}-single
  make DESTDIR=${pkgdir} install  
}