PKGBUILDs/extra/fftw/PKGBUILD

156 lines
4 KiB
Bash
Raw Normal View History

2021-09-15 19:18:19 +00:00
# Maintainer: David Runge <dvzrv@archlinux.org>
2022-02-05 00:02:03 +00:00
# Contributor: Ronald van Haren <ronald.archlinux.org>
2020-01-19 17:48:54 +00:00
# Contributor: David Runge <dvzrv@archlinux.org>
2011-02-22 06:37:08 +00:00
# Contributor: damir <damir@archlinux.org>
2013-02-03 19:23:25 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
2011-09-03 16:47:29 +00:00
# - removed -malign-double from CFLAGS
2022-02-05 00:02:03 +00:00
# - removed --enable-sse, --enable-avx from single precision
2020-01-19 17:48:54 +00:00
# - removed --enable-sse2, --enable-avx from double precision
2022-02-05 00:02:03 +00:00
# - removed quad precision variant from _build_types array
2011-02-22 06:37:08 +00:00
pkgname=fftw
2021-09-15 19:18:19 +00:00
pkgver=3.3.10
2024-02-06 04:05:35 +00:00
pkgrel=5
2011-02-22 06:37:08 +00:00
pkgdesc="A library for computing the discrete Fourier transform (DFT)"
2022-02-05 00:02:03 +00:00
arch=(x86_64)
2011-02-22 06:37:08 +00:00
url="http://www.fftw.org/"
2022-02-05 00:02:03 +00:00
license=(GPL2)
2023-03-18 20:03:03 +00:00
depends=(
bash
gcc-libs
glibc
openmpi
)
makedepends=(
cmake
gcc-fortran
)
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
)
2022-06-12 19:09:10 +00:00
source=(http://www.fftw.org/$pkgname-$pkgver.tar.gz)
2021-09-15 19:18:19 +00:00
sha512sums=('2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40')
b2sums=('3663872bd95a01d2c79af185f53918e1d1a9c91c620082402772c07f25b9b77d4920a78dc686fac6b51aa961b8d62b7e2cef3f3031e096bed40ced80b59b29d5')
2022-02-05 00:02:03 +00:00
_build_types=(single double long-double)
2011-02-22 06:37:08 +00:00
2020-01-19 17:48:54 +00:00
prepare() {
2022-02-05 00:02:03 +00:00
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
2020-01-19 17:48:54 +00:00
}
2011-02-22 06:37:08 +00:00
build() {
2022-02-05 00:02:03 +00:00
local _name
local _configure=(
./configure
--prefix=/usr
--enable-shared
--enable-threads
--enable-mpi
--enable-openmp
2020-01-19 17:48:54 +00:00
)
2022-02-05 00:02:03 +00:00
local _configure_single=(
--enable-single
2020-01-19 17:48:54 +00:00
)
2022-02-05 00:02:03 +00:00
local _configure_double=(
2020-01-19 17:48:54 +00:00
)
2022-02-05 00:02:03 +00:00
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/lib/libfftw3.so.3"|' -i build/FFTW3LibraryDepends.cmake
export F77='gfortran'
# use upstream default CFLAGS while keeping our -march/-mtune
CFLAGS+=" -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math"
2011-02-22 06:37:08 +00:00
2022-02-05 00:02:03 +00:00
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
2020-12-15 14:59:52 +00:00
2022-02-05 00:02:03 +00:00
for _name in "${_build_types[@]}"; do
make -C $pkgname-$pkgver-$_name
done
2020-12-15 14:59:52 +00:00
}
check() {
2022-02-05 00:02:03 +00:00
local _name
2020-12-15 14:59:52 +00:00
2022-02-05 00:02:03 +00:00
for _name in "${_build_types[@]}"; do
2022-06-12 19:09:10 +00:00
make check-local -C $pkgname-$pkgver-$_name/tests
2022-02-05 00:02:03 +00:00
done
2013-02-03 19:23:25 +00:00
}
package() {
2022-02-05 00:02:03 +00:00
local _name
2020-12-15 14:59:52 +00:00
2022-02-05 00:02:03 +00:00
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/lib/cmake/fftw3/"
2011-02-22 06:37:08 +00:00
}