13 enableStatic ? stdenv.hostPlatform.isStatic,
18 stdenv.mkDerivation (finalAttrs: {
19 pname = "kissfft-${datatype}${lib.optionalString enableOpenmp "-openmp"}";
28 src = fetchFromGitHub {
29 owner = "mborgerding";
31 rev = finalAttrs.version;
32 hash = "sha256-ukikTVnmKomKXTo6zc+PhpZzEkzXN2imFwZOYlfR3Pk=";
36 # Fix FFTW dependency check
37 # https://github.com/mborgerding/kissfft/pull/95
38 ./fix-fftw-dependency-check.patch
48 lib.optionals (datatype != "simd") [ libpng ]
49 # TODO: This may mismatch the LLVM version in the stdenv, see #79818.
50 ++ lib.optional (enableOpenmp && stdenv.cc.isClang) llvmPackages.openmp;
52 nativeCheckInputs = [ (python3.withPackages (ps: [ ps.numpy ])) ];
54 checkInputs = [ (if datatype == "float" then fftwFloat else fftw) ];
57 (lib.cmakeFeature "KISSFFT_DATATYPE" datatype)
58 (lib.cmakeBool "KISSFFT_STATIC" enableStatic)
59 # `test/testkiss.py` expects this…
60 (lib.cmakeFeature "KISSFFT_OPENMP" (if enableOpenmp then "ON" else "OFF"))
63 # Required for `test/testcpp.c`.
65 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-D__MATH_LONG_DOUBLE_CONSTANTS=1";
70 # https://bugs.llvm.org/show_bug.cgi?id=45034
73 (stdenv.hostPlatform.isLinux && stdenv.cc.isClang && lib.versionOlder stdenv.cc.version "10")
75 substituteInPlace CMakeLists.txt \
76 --replace "-ffast-math" ""
80 description = "Mixed-radix Fast Fourier Transform based up on the KISS principle";
81 homepage = "https://github.com/mborgerding/kissfft";
82 license = lib.licenses.bsd3;
84 platforms = lib.platforms.all;