archrelease: copy trunk to extra-x86_64
[arch-packages.git] / fftw / repos / extra-x86_64 / PKGBUILD
blob8462e04b7538b46e630b377e0f700cca56ed1043
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>
6 pkgname=fftw
7 pkgver=3.3.10
8 pkgrel=3
9 pkgdesc="A library for computing the discrete Fourier transform (DFT)"
10 arch=(x86_64)
11 url="http://www.fftw.org/"
12 license=(GPL2)
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)
19 options=(debug)
20 source=(http://www.fftw.org/$pkgname-$pkgver.tar.gz)
21 sha512sums=('2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40')
22 b2sums=('3663872bd95a01d2c79af185f53918e1d1a9c91c620082402772c07f25b9b77d4920a78dc686fac6b51aa961b8d62b7e2cef3f3031e096bed40ced80b59b29d5')
23 _build_types=(single double long-double quad)
25 prepare() {
26   local _i
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
32   for _i in {1..3}; do
33     cp -av $pkgname-$pkgver-single $pkgname-$pkgver-"${_build_types[$_i]}"
34   done
37 build() {
38   local _name
39   local _configure=(
40     ./configure
41     --prefix=/usr
42     --enable-shared
43     --enable-threads
44     --enable-mpi
45     --enable-openmp
46   )
47   local _configure_single=(
48     --enable-sse
49     --enable-avx
50     --enable-single
51   )
52   local _configure_double=(
53     --enable-sse2
54     --enable-avx
55   )
56   local _configure_long_double=(
57     --enable-long-double
58   )
59   local _configure_quad=(
60     --disable-mpi
61     --enable-quad-precision
62   )
63   local _cmake_options=(
64     -B build
65     -S $pkgname-$pkgver-$_build_types
66     -D CMAKE_INSTALL_PREFIX=/usr
67     -D CMAKE_BUILD_TYPE=None
68     -D ENABLE_OPENMP=ON
69     -D ENABLE_THREADS=ON
70     -D ENABLE_FLOAT=ON
71     -D ENABLE_LONG_DOUBLE=ON
72     -D ENABLE_QUAD_PRECISION=ON
73     -D ENABLE_SSE=ON
74     -D ENABLE_SSE2=ON
75     -D ENABLE_AVX=ON
76     -D ENABLE_AVX2=ON
77   )
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
85   export F77='gfortran'
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
90     (
91       cd $pkgname-$pkgver-$_name
92       case $_name in
93         single)
94         "${_configure[@]}" "${_configure_single[@]}"
95         ;;
96         double)
97         "${_configure[@]}" "${_configure_double[@]}"
98         ;;
99         long-double)
100         "${_configure[@]}" "${_configure_long_double[@]}"
101         ;;
102         quad)
103         "${_configure[@]}" "${_configure_quad[@]}"
104         ;;
105       esac
106       # fix overlinking because of libtool
107       sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
108     )
109   done
111   for _name in "${_build_types[@]}"; do
112     make -C $pkgname-$pkgver-$_name
113   done
116 check() {
117   local _name
119   for _name in "${_build_types[@]}"; do
120     make check-local -C $pkgname-$pkgver-$_name/tests
121   done
124 package() {
125   local _name
127   for _name in "${_build_types[@]}"; do
128     make DESTDIR="$pkgdir" install -C $pkgname-$pkgver-$_name
129   done
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/"