1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor: Ronald van Haren <ronald.archlinux.org>
3 # Contributor: David Runge <dvzrv@archlinux.org>
4 # Contributor: damir <damir@archlinux.org>
9 pkgdesc="A library for computing the discrete Fourier transform (DFT)"
11 url="http://www.fftw.org/"
13 depends=(bash gcc-libs glibc openmpi)
14 makedepends=(cmake gcc-fortran)
15 provides=(libfftw3q_threads.so libfftw3q_omp.so libfftw3q.so
16 libfftw3l_threads.so libfftw3l_omp.so libfftw3l_mpi.so libfftw3l.so
17 libfftw3f_threads.so libfftw3f_omp.so libfftw3f_mpi.so libfftw3f.so
18 libfftw3_threads.so libfftw3_omp.so libfftw3_mpi.so libfftw3.so)
20 source=(http://www.fftw.org/$pkgname-$pkgver.tar.gz)
21 sha512sums=('2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40')
22 b2sums=('3663872bd95a01d2c79af185f53918e1d1a9c91c620082402772c07f25b9b77d4920a78dc686fac6b51aa961b8d62b7e2cef3f3031e096bed40ced80b59b29d5')
23 _build_types=(single double long-double quad)
28 # fix wrong soname in FFTW3LibraryDepends.cmake
29 sed -e 's/3.6.9/3.6.10/' -i $pkgname-$pkgver/CMakeLists.txt
31 mv -v $pkgname-$pkgver $pkgname-$pkgver-single
33 cp -av $pkgname-$pkgver-single $pkgname-$pkgver-"${_build_types[$_i]}"
47 local _configure_single=(
52 local _configure_double=(
56 local _configure_long_double=(
59 local _configure_quad=(
61 --enable-quad-precision
63 local _cmake_options=(
65 -S $pkgname-$pkgver-$_build_types
66 -D CMAKE_INSTALL_PREFIX=/usr
67 -D CMAKE_BUILD_TYPE=None
71 -D ENABLE_LONG_DOUBLE=ON
72 -D ENABLE_QUAD_PRECISION=ON
79 # create missing FFTW3LibraryDepends.cmake
80 # https://bugs.archlinux.org/task/67604
81 cmake "${_cmake_options[@]}"
82 # fix broken IMPORTED_LOCATION: https://github.com/FFTW/fftw3/issues/130#issuecomment-1030280157
83 sed -e 's|\(IMPORTED_LOCATION_NONE\).*|\1 "/usr/lib/libfftw3.so.3"|' -i build/FFTW3LibraryDepends.cmake
86 # use upstream default CFLAGS while keeping our -march/-mtune
87 CFLAGS+=" -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math"
89 for _name in "${_build_types[@]}"; do
91 cd $pkgname-$pkgver-$_name
94 "${_configure[@]}" "${_configure_single[@]}"
97 "${_configure[@]}" "${_configure_double[@]}"
100 "${_configure[@]}" "${_configure_long_double[@]}"
103 "${_configure[@]}" "${_configure_quad[@]}"
106 # fix overlinking because of libtool
107 sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
111 for _name in "${_build_types[@]}"; do
112 make -C $pkgname-$pkgver-$_name
119 for _name in "${_build_types[@]}"; do
120 make check-local -C $pkgname-$pkgver-$_name/tests
127 for _name in "${_build_types[@]}"; do
128 make DESTDIR="$pkgdir" install -C $pkgname-$pkgver-$_name
130 install -vDm 644 $pkgname-$pkgver-$_build_types/{AUTHORS,ChangeLog,NEWS,README,TODO} -t "$pkgdir/usr/share/doc/$pkgname"
131 # install missing FFTW3LibraryDepends.cmake
132 install -vDm 644 build/FFTW3LibraryDepends.cmake -t "$pkgdir/usr/lib/cmake/fftw3/"