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/"
40 source=(http://www.fftw.org/$pkgname-$pkgver.tar.gz)
41 sha512sums=('2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40')
42 b2sums=('3663872bd95a01d2c79af185f53918e1d1a9c91c620082402772c07f25b9b77d4920a78dc686fac6b51aa961b8d62b7e2cef3f3031e096bed40ced80b59b29d5')
43 _build_types=(single double long-double quad)
48 # fix wrong soname in FFTW3LibraryDepends.cmake
49 sed -e 's/3.6.9/3.6.10/' -i $pkgname-$pkgver/CMakeLists.txt
51 mv -v $pkgname-$pkgver $pkgname-$pkgver-single
53 cp -av $pkgname-$pkgver-single $pkgname-$pkgver-"${_build_types[$_i]}"
67 local _configure_single=(
72 local _configure_double=(
76 local _configure_long_double=(
79 local _configure_quad=(
81 --enable-quad-precision
83 local _cmake_options=(
85 -S $pkgname-$pkgver-$_build_types
86 -D CMAKE_INSTALL_PREFIX=/usr
87 -D CMAKE_BUILD_TYPE=None
91 -D ENABLE_LONG_DOUBLE=ON
92 -D ENABLE_QUAD_PRECISION=ON
99 # create missing FFTW3LibraryDepends.cmake
100 # https://bugs.archlinux.org/task/67604
101 cmake "${_cmake_options[@]}"
102 # fix broken IMPORTED_LOCATION: https://github.com/FFTW/fftw3/issues/130#issuecomment-1030280157
103 sed -e 's|\(IMPORTED_LOCATION_NONE\).*|\1 "/usr/lib/libfftw3.so.3"|' -i build/FFTW3LibraryDepends.cmake
105 export F77='gfortran'
106 # use upstream default CFLAGS while keeping our -march/-mtune
107 CFLAGS+=" -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math"
109 for _name in "${_build_types[@]}"; do
111 cd $pkgname-$pkgver-$_name
114 "${_configure[@]}" "${_configure_single[@]}"
117 "${_configure[@]}" "${_configure_double[@]}"
120 "${_configure[@]}" "${_configure_long_double[@]}"
123 "${_configure[@]}" "${_configure_quad[@]}"
126 # fix overlinking because of libtool
127 sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
131 for _name in "${_build_types[@]}"; do
132 make -C $pkgname-$pkgver-$_name
139 for _name in "${_build_types[@]}"; do
140 make check-local -C $pkgname-$pkgver-$_name/tests
147 for _name in "${_build_types[@]}"; do
148 make DESTDIR="$pkgdir" install -C $pkgname-$pkgver-$_name
150 install -vDm 644 $pkgname-$pkgver-$_build_types/{AUTHORS,ChangeLog,NEWS,README,TODO} -t "$pkgdir/usr/share/doc/$pkgname"
151 # install missing FFTW3LibraryDepends.cmake
152 install -vDm 644 build/FFTW3LibraryDepends.cmake -t "$pkgdir/usr/lib/cmake/fftw3/"