Files
Robert SchützandVladimír Čunát eac01b3060 fftw: 3.3.10 -> 3.3.11
Changelog: https://github.com/FFTW/fftw3/blob/fftw-3.3.11/NEWS
(cherry picked from commit 07e44fb25f)
(cherry picked from commit 546ea47450680b3f5aa4947632d7937d6997d873)
2026-06-22 08:16:17 +02:00

120 lines
3.1 KiB
Nix

{
fetchurl,
stdenv,
lib,
gfortran,
perl,
llvmPackages,
precision ? "double",
enableMpi ? false,
mpi,
withDoc ? stdenv.cc.isGNU,
testers,
}:
assert lib.elem precision [
"single"
"double"
"long-double"
"quad-precision"
];
stdenv.mkDerivation (finalAttrs: {
pname = "fftw-${precision}";
version = "3.3.11";
src = fetchurl {
urls = [
"https://fftw.org/fftw-${finalAttrs.version}.tar.gz"
"ftp://ftp.fftw.org/pub/fftw/fftw-${finalAttrs.version}.tar.gz"
];
hash = "sha256-VjDCTN6zOxMWEvfrSxqZNCNHVPnziP+GF0WNC+byOaE=";
};
outputs = [
"out"
"dev"
"man"
]
++ lib.optional withDoc "info"; # it's dev-doc only
outputBin = "dev"; # fftw-wisdom
nativeBuildInputs = [ gfortran ];
buildInputs =
lib.optionals stdenv.cc.isClang [
# TODO: This may mismatch the LLVM version sin the stdenv, see #79818.
llvmPackages.openmp
]
++ lib.optional enableMpi mpi;
configureFlags = [
"--enable-shared"
"--enable-threads"
"--enable-openmp"
]
++ lib.optional (precision != "double") "--enable-${precision}"
# https://www.fftw.org/fftw3_doc/SIMD-alignment-and-fftw_005fmalloc.html
# FFTW will try to detect at runtime whether the CPU supports these extensions
++
lib.optionals (stdenv.hostPlatform.isx86_64 && (precision == "single" || precision == "double"))
[
"--enable-sse2"
"--enable-avx"
"--enable-avx2"
"--enable-avx512"
"--enable-avx128-fma"
]
++
lib.optionals (stdenv.hostPlatform.isAarch64 && (precision == "single" || precision == "double"))
[
"--enable-neon"
]
++ lib.optionals enableMpi [
"--enable-mpi"
# link libfftw3_mpi explicitly with -lmpi
# linker on darwin requires all symbols to be resolvable at link time
# see
# https://github.com/FFTW/fftw3/issues/274
# https://github.com/spack/spack/pull/29279
"MPILIBS=-lmpi"
]
# doc generation causes Fortran wrapper generation which hard-codes gcc
++ lib.optional (!withDoc) "--disable-doc";
# fftw builds with -mtune=native by default
postPatch = ''
substituteInPlace configure --replace-fail "-mtune=native" "-mtune=generic"
'';
strictDeps = true;
enableParallelBuilding = true;
nativeCheckInputs = [ perl ];
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
__structuredAttrs = true;
meta = {
changelog = "https://github.com/FFTW/fftw3/blob/fftw-${finalAttrs.version}/NEWS";
description = "Fastest Fourier Transform in the West library";
homepage = "https://www.fftw.org/";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
pkgConfigModules = [
{
"single" = "fftw3f";
"double" = "fftw3";
"long-double" = "fftw3l";
"quad-precision" = "fftw3q";
}
.${precision}
];
platforms = lib.platforms.unix;
# quad-precision requires libquadmath from gfortran, but libquadmath is not supported on aarch64
badPlatforms = lib.optionals (precision == "quad-precision") lib.platforms.aarch64;
};
})