From d69e3fc7066f9cbe9845472ba2e3410171914b3e Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 25 Oct 2020 23:37:59 +0000
Subject: fftw: 3.3.8

---
 abs/extra/fftw/PKGBUILD     | 99 +++++++++++++++++++++++++++++----------------
 abs/extra/fftw/fftw.install | 22 ----------
 2 files changed, 65 insertions(+), 56 deletions(-)
 delete mode 100644 abs/extra/fftw/fftw.install

diff --git a/abs/extra/fftw/PKGBUILD b/abs/extra/fftw/PKGBUILD
index db4322f..1ab869b 100644
--- a/abs/extra/fftw/PKGBUILD
+++ b/abs/extra/fftw/PKGBUILD
@@ -1,50 +1,81 @@
-# $Id: PKGBUILD 159277 2012-05-20 10:35:50Z ronald $
 # Maintainer: Ronald van Haren <ronald.archlinux.org>
+# Contributor: David Runge <dvzrv@archlinux.org>
 # Contributor: damir <damir@archlinux.org>
 
 pkgname=fftw
-pkgver=3.3.2
-pkgrel=1
+pkgver=3.3.8
+pkgrel=3
 pkgdesc="A library for computing the discrete Fourier transform (DFT)"
-arch=('i686' 'x86_64')
+arch=('x86_64')
 license=('GPL2')
 url="http://www.fftw.org/"
-depends=('glibc' 'bash')
+depends=('bash' 'gcc-libs' 'glibc' 'openmpi')
 makedepends=('gcc-fortran')
-options=('!libtool')
+provides=('libfftw3q_threads.so' 'libfftw3q_omp.so' 'libfftw3q.so'
+'libfftw3l_threads.so' 'libfftw3l_omp.so' 'libfftw3l_mpi.so' 'libfftw3l.so'
+'libfftw3f_threads.so' 'libfftw3f_omp.so' 'libfftw3f_mpi.so' 'libfftw3f.so'
+'libfftw3_threads.so' 'libfftw3_omp.so' 'libfftw3_mpi.so' 'libfftw3.so')
+# makedepends=('gcc-fortran' 'ocaml' 'ocaml-num' 'ocamlbuild')
 source=("http://www.fftw.org/${pkgname}-${pkgver}.tar.gz")
-install=fftw.install
-sha1sums=('11a8c31186ff5a7d686a79a3f21b2530888e0dc2')
-
-# 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
+# source=("https://github.com/${pkgname}/fftw3/archive/${pkgname}-${pkgver}.tar.gz")
+sha512sums=('ab918b742a7c7dcb56390a0a0014f517a6dff9a2e4b4591060deeb2c652bf3c6868aa74559a422a276b853289b4b701bdcbd3d4d8c08943acf29167a7be81a38')
 
+prepare() {
+# issue with ocaml-num
+#  mv -v "fftw3-${pkgname}-${pkgver}" "${pkgname}-${pkgver}"
+#  (
+#    cd "$pkgname-$pkgver"
+#    cp -v NEWS ChangeLog
+#    autoreconf -vfi
+#  )
+  cp -av "${pkgname}-${pkgver}" "${pkgname}-${pkgver}-double"
+  cp -av "${pkgname}-${pkgver}" "${pkgname}-${pkgver}-long-double"
+  cp -av "${pkgname}-${pkgver}" "${pkgname}-${pkgver}-quad"
+}
 
 build() {
-  cd ${srcdir}/${pkgname}-${pkgver}
-
+  export F77='gfortran'
   # use upstream default CFLAGS while keeping our -march/-mtune
   CFLAGS+=" -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math"
+  # default configure call
+  _default_configure="./configure --prefix=/usr --enable-shared --enable-threads --enable-mpi --enable-openmp"
+
+  # configure single precision
+  (
+    cd "${pkgname}-${pkgver}"
+    ${_default_configure} --enable-sse --enable-avx --enable-single
+  )
+
+  # configure double precision
+  (
+    cd "${pkgname}-${pkgver}-double"
+    ${_default_configure} --enable-sse2 --enable-avx
+  )
+
+  # configure long-double precission
+  (
+    cd "${pkgname}-${pkgver}-long-double"
+    ${_default_configure} --enable-long-double
+  )
+
+  # configure quad precision
+  (
+    cd "${pkgname}-${pkgver}-quad"
+    ${_default_configure} --disable-mpi --enable-quad-precision
+  )
+
+  make -C "${pkgname}-${pkgver}"
+  make -C "${pkgname}-${pkgver}-double"
+  make -C "${pkgname}-${pkgver}-long-double"
+  make -C "${pkgname}-${pkgver}-quad"
+}
 
-  CONFIGURE="./configure F77=gfortran --prefix=/usr \
-                 --enable-shared --enable-threads --enable-type-prefix"
-
-  # build & install double precision
-  $CONFIGURE --enable-sse2
-  make
-  make DESTDIR=${pkgdir} install
-  make clean 
-
-  # build & install long double precission
-  $CONFIGURE --enable-long-double
-  make
-  make DESTDIR=${pkgdir} install
-  make clean
-
-  # build & install single precision
-  $CONFIGURE --enable-float --enable-sse
-  make
-  make DESTDIR=${pkgdir} install
+package() {
+  make DESTDIR="${pkgdir}" install -C "${pkgname}-${pkgver}"
+  make DESTDIR="${pkgdir}" install -C "${pkgname}-${pkgver}-double"
+  make DESTDIR="${pkgdir}" install -C "${pkgname}-${pkgver}-long-double"
+  make DESTDIR="${pkgdir}" install -C "${pkgname}-${pkgver}-quad"
+  cd "${pkgname}-${pkgver}"
+  install -vDm 644 {AUTHORS,ChangeLog,NEWS,README,TODO} \
+    -t "${pkgdir}/usr/share/doc/${pkgname}"
 }
diff --git a/abs/extra/fftw/fftw.install b/abs/extra/fftw/fftw.install
deleted file mode 100644
index a3748aa..0000000
--- a/abs/extra/fftw/fftw.install
+++ /dev/null
@@ -1,22 +0,0 @@
-info_dir=/usr/share/info
-info_files=(fftw3.info)
-
-post_install() {
-  for f in ${info_files[@]}; do
-    install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
-  done
-}
-
-post_upgrade() {
-        post_install
-}
-
-pre_remove() {
-  for f in ${info_files[@]}; do
-    install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
-  done
-}
-
-
-
-
-- 
cgit v0.12

