# Maintainer (lib32): Nocifer # Maintainer: David Runge # Contributor: Ronald van Haren # Contributor: David Runge # Contributor: damir # Contributor: Adam # Contributor: GordonGR # Contributor: josephgbr _pkgname=fftw pkgname=lib32-$_pkgname pkgver=3.3.10 pkgrel=3 pkgdesc='A library for computing the discrete Fourier transform (DFT) (32 bit)' arch=('x86_64') url='https://www.fftw.org' license=('GPL2') depends=("$_pkgname" 'lib32-gcc-libs') makedepends=('cmake' 'gcc-fortran') provides=('libfftw3q_threads.so' 'libfftw3q_omp.so' 'libfftw3q.so' 'libfftw3l_threads.so' 'libfftw3l_omp.so' 'libfftw3l.so' 'libfftw3f_threads.so' 'libfftw3f_omp.so' 'libfftw3f.so' 'libfftw3_threads.so' 'libfftw3_omp.so' 'libfftw3.so') source=("https://www.fftw.org/$_pkgname-$pkgver.tar.gz") sha256sums=('56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467') _build_types=(single double long-double quad) prepare() { local _i # fix wrong soname in FFTW3LibraryDepends.cmake sed -e 's/3.6.9/3.6.10/' -i $_pkgname-$pkgver/CMakeLists.txt mv -v $_pkgname-$pkgver $_pkgname-$pkgver-single for _i in {1..3}; do cp -av $_pkgname-$pkgver-single $_pkgname-$pkgver-"${_build_types[$_i]}" done } build() { local _name local _configure=( ./configure --prefix=/usr --enable-shared --enable-threads --enable-openmp #--enable-mpi --libdir=/usr/lib32 ) local _configure_single=( --enable-sse --enable-avx --enable-single ) local _configure_double=( --enable-sse2 --enable-avx ) local _configure_long_double=( --enable-long-double ) local _configure_quad=( --disable-mpi --enable-quad-precision ) local _cmake_options=( -B build -S $_pkgname-$pkgver-$_build_types -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=None -D ENABLE_OPENMP=ON -D ENABLE_THREADS=ON -D ENABLE_FLOAT=ON -D ENABLE_LONG_DOUBLE=ON -D ENABLE_QUAD_PRECISION=ON -D ENABLE_SSE=ON -D ENABLE_SSE2=ON -D ENABLE_AVX=ON -D ENABLE_AVX2=ON ) # create missing FFTW3LibraryDepends.cmake # https://bugs.archlinux.org/task/67604 cmake "${_cmake_options[@]}" # fix broken IMPORTED_LOCATION: https://github.com/FFTW/fftw3/issues/130#issuecomment-1030280157 sed -e 's|\(IMPORTED_LOCATION_NONE\).*|\1 "/usr/lib32/libfftw3.so.3"|' -i build/FFTW3LibraryDepends.cmake export F77='gfortran' export CC='gcc -m32' export CXX='g++ -m32' export PKG_CONFIG_PATH='/usr/lib32/pkgconfig' # use upstream default CFLAGS while keeping our -march/-mtune CFLAGS+=" -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math" for _name in "${_build_types[@]}"; do ( cd $_pkgname-$pkgver-$_name case $_name in single) "${_configure[@]}" "${_configure_single[@]}" ;; double) "${_configure[@]}" "${_configure_double[@]}" ;; long-double) "${_configure[@]}" "${_configure_long_double[@]}" ;; quad) "${_configure[@]}" "${_configure_quad[@]}" ;; esac # fix overlinking because of libtool sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool ) done for _name in "${_build_types[@]}"; do make -C $_pkgname-$pkgver-$_name done } package() { local _name for _name in "${_build_types[@]}"; do make DESTDIR="$pkgdir" install -C $_pkgname-$pkgver-$_name done #install -vDm 644 $_pkgname-$pkgver-$_build_types/{AUTHORS,ChangeLog,NEWS,README,TODO} -t "$pkgdir/usr/share/doc/$_pkgname" # install missing FFTW3LibraryDepends.cmake install -vDm 644 build/FFTW3LibraryDepends.cmake -t "$pkgdir/usr/lib32/cmake/fftw3/" rm -rf "${pkgdir}/usr"/{bin,include,share} }