Subject: [PATCH] Add fftw-cmake
From: Mehmet Tekman <[email-masked]>
To: [email-masked]
Date: Tue, 21 Nov 2023 21:56:36 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch is a dependency of krita 5.2.1, and is a clone of the fftw
gnu-build which does not provide a required CMake file for krita.

It is not clear if the CMake build provides the target optimizations, so
it does replace the existing fftw variable.

From 70fc6c6ada030c7b5d4d35da6da8a2f4f018ff74 Mon Sep 17 00:00:00 2001
From: mtekman <[email-masked]>
Date: Tue, 21 Nov 2023 21:35:56 +0100
Subject: [PATCH] gnu: Add fftw-cmake

* gnu/packages/algebra.scm (fftw-cmake): New variable

  This is a clone of the fftw function, but uses cmake to build in order for
  the FFTW3LibraryDepends.cmake file to be built, neccesary for packages with
  cmake builds that depend on fftw3.

  See: https://bugzilla.redhat.com/show_bug.cgi?id=1729652#c5

  This variable is cloned from the existing fftw3 in order to not break any
  downstream packages that make use of the target optimizations given by the
  gnu build.

Change-Id: Ied7920beae0494350445d3a1905fa37b2b83976a
---
 gnu/packages/algebra.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index c0fe75ddfd..a31338ff6f 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -778,6 +778,33 @@ (define-public fftw
 cosine/ sine transforms or DCT/DST).")
     (license license:gpl2+)))
 
+(define-public fftw-cmake
+  (package
+    ;; Cmake compiling is experimental since 2017, and it is not clear if this
+    ;; build has the same target-specific optimizations as the fftw gnu build.
+    ;; See: https://fftw.org/release-notes.html
+    (name "fftw-cmake")
+    (version "3.3.8")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-" version
+                           ".tar.gz"))
+       (sha256
+        (base32 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
+    (build-system cmake-build-system)
+    (native-inputs (list perl))
+    (home-page "https://fftw.org")
+    (synopsis "Computing the discrete Fourier transform")
+    (description
+     "FFTW is a C subroutine library for computing the discrete Fourier
+transform (DFT) in one or more dimensions, of arbitrary input size, and of
+both real and complex data (as well as of even/odd data---i.e. the discrete
+cosine/ sine transforms or DCT/DST).  This CMake build offers the file
+FFTW3LibraryDepends.cmake required by some dependent packages, absent in the
+gnu build version.")
+    (license license:gpl2+)))
+
 (define-public fftwf
   (package/inherit fftw
     (name "fftwf")
-- 
2.41.0