[PATCH] gnu: fftw: Update to 3.3.10 and build entirely from source.

  • Open
  • quality assurance status badge
Details
2 participants
  • Andreas Enge
  • David Elsing
Owner
unassigned
Submitted by
David Elsing
Severity
normal
D
D
David Elsing wrote on 16 Jun 2023 19:16
(address . guix-patches@gnu.org)(name . David Elsing)(address . david.elsing@posteo.net)
9ae0d0f6a21a74fc0b36c52f23bbbd44b251d039.1686934712.git.david.elsing@posteo.net
* gnu/packages/algebra.scm (fftw): Update to 3.3.10.
[source]: Use git checkout without autogenerated files.
[arguments]<#:configure-flags>: Use Gexps and set --enable-maintainer-mode.
<#:modules>: Add (ice-9 ftw) and (srfi srfi-26).
<#:phases>: Add phases to run the code generation and build documentation.
[native-inputs]: Add autoconf, automake, ghostscript, indent, libtool, ocaml,
ocamlbuild, ocaml-num, ocaml-findlib, texinfo and transfig.
(fftwf,fftw-openmpi)[arguments]: Use Gexps.
---
Hello,
I noticed that the FFTW release tarballs already contain the
autogenerated codelets and the built documentation. Building them of
course adds a lot more dependencies.
gnu/packages/algebra.scm | 140 +++++++++++++++++++++++++++------------
1 file changed, 98 insertions(+), 42 deletions(-)

Toggle diff (199 lines)
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 3babf90b3c..ca5831066a 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -15,6 +15,7 @@
;;; Copyright © 2020, 2021, 2023 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2021 Lars-Dominik Braun <ldb@leibniz-psychology.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -38,6 +39,7 @@ (define-module (gnu packages algebra)
#:use-module (gnu packages bison)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
+ #:use-module (gnu packages code)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
#:use-module (gnu packages documentation)
@@ -45,6 +47,7 @@ (define-module (gnu packages algebra)
#:use-module (gnu packages flex)
#:use-module (gnu packages fltk)
#:use-module (gnu packages gcc)
+ #:use-module (gnu packages ghostscript)
#:use-module (gnu packages gl)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages image)
@@ -63,6 +66,7 @@ (define-module (gnu packages algebra)
#:use-module (gnu packages shells)
#:use-module (gnu packages tex)
#:use-module (gnu packages texinfo)
+ #:use-module (gnu packages xfig)
#:use-module (gnu packages xiph)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
@@ -737,39 +741,91 @@ (define-public kiss-fft-for-extempore
(define-public fftw
(package
(name "fftw")
- (version "3.3.8")
+ (version "3.3.10")
(source (origin
- (method url-fetch)
- (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
- version".tar.gz"))
- (sha256
- (base32
- "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
+ ;; Release tarball contains many generated files
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/FFTW/fftw3")
+ (commit (string-append "fftw-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "11r4kd1478mi35vv6fgmg6qibqkqjhb77pqxaa8374rxdlqazgyy"))))
(build-system gnu-build-system)
(arguments
- `(#:configure-flags
- '("--enable-shared" "--enable-openmp" "--enable-threads"
- ,@(let ((system (or (%current-target-system) (%current-system))))
- ;; Enable SIMD extensions for codelets. See details at:
- ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
- (cond
- ((string-prefix? "x86_64" system)
- '("--enable-sse2" "--enable-avx" "--enable-avx2"
- "--enable-avx512" "--enable-avx-128-fma"))
- ((string-prefix? "i686" system)
- '("--enable-sse2"))
- ((string-prefix? "aarch64" system)
- ;; Note that fftw supports NEON on 32-bit ARM only when
- ;; compiled for single-precision.
- '("--enable-neon"))
- (else
- '())))
- ;; By default '-mtune=native' is used. However, that may cause the
- ;; use of ISA extensions (e.g. AVX) that are not necessarily
- ;; available on the user's machine when that package is built on a
- ;; different machine.
- "ax_cv_c_flags__mtune_native=no")))
- (native-inputs (list perl))
+ (list
+ #:configure-flags
+ #~(list "--enable-shared"
+ "--enable-openmp"
+ "--enable-threads"
+ "--enable-maintainer-mode"
+ #$@(let ((system (or (%current-target-system) (%current-system))))
+ ;; Enable SIMD extensions for codelets. See details at:
+ ;; <https://fftw.org/fftw3_doc/Installation-on-Unix.html>.
+ (cond
+ ((string-prefix? "x86_64" system)
+ '("--enable-sse2" "--enable-avx" "--enable-avx2"
+ "--enable-avx512" "--enable-avx-128-fma"))
+ ((string-prefix? "i686" system)
+ '("--enable-sse2"))
+ ((string-prefix? "aarch64" system)
+ ;; Note that fftw supports NEON on 32-bit ARM only when
+ ;; compiled for single-precision.
+ '("--enable-neon"))
+ (else '())))
+ ;; By default '-mtune=native' is used. However, that may cause the
+ ;; use of ISA extensions (e.g. AVX) that are not necessarily
+ ;; available on the user's machine when that package is built on a
+ ;; different machine.
+ "ax_cv_c_flags__mtune_native=no")
+ #:modules '((ice-9 ftw)
+ (srfi srfi-26)
+ (guix build utils)
+ (guix build gnu-build-system))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'remove-bootstrap
+ (lambda _
+ ;; This script calls configure
+ (delete-file "bootstrap.sh")
+ (invoke "touch" "ChangeLog")
+ ;; OCaml Num library
+ (substitute* "genfft/Makefile.am"
+ ((",nums")
+ " -package num"))))
+ (add-after 'build 'build-doc
+ (lambda _
+ ;; Reproducibility
+ (substitute* "doc/FAQ/m-html.pl"
+ (("- \\$html_date\\\\n") "")
+ (("\\$html_year \\$user_copyholder")
+ "2022 $user_copyholder"))
+ (substitute* "doc/FAQ/fftw-faq.bfnn"
+ ((".*`date.*") ""))
+ (invoke "make" "-C" "doc")
+ (invoke "make" "-C" "doc" "html")
+ (invoke "make" "-C" "doc/FAQ" "faq")))
+ (add-after 'install 'install-doc
+ (let ((doc (string-append #$output "/share/doc/"
+ #$name "-" #$version)))
+ (lambda _
+ (copy-recursively "doc/html" (string-append doc "/html"))
+ (copy-recursively "doc/FAQ/fftw-faq.html"
+ (string-append doc "/fftw-faq.html"))
+ (install-file "doc/FAQ/fftw-faq.ascii" doc)))))))
+ (native-inputs (list autoconf
+ automake
+ ghostscript
+ indent
+ libtool
+ ocaml
+ ocamlbuild
+ ocaml-num
+ ocaml-findlib
+ perl
+ texinfo
+ transfig))
(home-page "https://fftw.org")
(synopsis "Computing the discrete Fourier transform")
(description
@@ -785,14 +841,14 @@ (define-public fftwf
(arguments
(substitute-keyword-arguments (package-arguments fftw)
((#:configure-flags fftw-configure-flags)
- `(cons* "--enable-single"
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
- ;; fftw supports NEON on 32-bit ARM only when compiled
- ;; for single-precision, so add it here.
- '("--enable-neon")
- '())
- ,fftw-configure-flags))))
+ #~(cons* "--enable-single"
+ #$@(if (string-prefix? "arm" (or (%current-target-system)
+ (%current-system)))
+ ;; fftw supports NEON on 32-bit ARM only when compiled
+ ;; for single-precision, so add it here.
+ '("--enable-neon")
+ '())
+ #$fftw-configure-flags))))
(description
(string-append (package-description fftw)
" Single-precision version."))))
@@ -806,11 +862,11 @@ (define-public fftw-openmpi
(arguments
(substitute-keyword-arguments (package-arguments fftw)
((#:configure-flags cf)
- `(cons "--enable-mpi" ,cf))
+ #~(cons "--enable-mpi" #$cf))
((#:phases phases '%standard-phases)
- `(modify-phases ,phases
- (add-before 'check 'mpi-setup
- ,%openmpi-setup)))))
+ #~(modify-phases #$phases
+ (add-before 'check 'mpi-setup
+ #$%openmpi-setup)))))
(description
(string-append (package-description fftw)
" With OpenMPI parallelism support."))))
--
2.40.1
D
D
David Elsing wrote on 14 Jan 16:55 +0100
[PATCH v2 0/2] Build fftw entirely from source
(address . 64114@debbugs.gnu.org)(name . David Elsing)(address . david.elsing@posteo.net)
20240114155516.12457-1-david.elsing@posteo.net
The fftw package has been updated to 3.3.10 in the meantime, but now the
transfig package was replaced by fig2dev, which depends on fftw itself.
Therefore, I put the documentation for fftw into a separate package. It also
depends on the inputs of the fftw package, as the configure phase has to be
run again to generate the Makefiles for the documentation.

David Elsing (2):
gnu: fftw: Build entirely from source.
gnu: Add fftw-documentation.

gnu/packages/algebra.scm | 153 ++++++++++++++++++++++++++++-----------
1 file changed, 112 insertions(+), 41 deletions(-)

--
2.41.0
D
D
David Elsing wrote on 14 Jan 16:55 +0100
[PATCH v2 1/2] gnu: fftw: Build entirely from source.
(address . 64114@debbugs.gnu.org)(name . David Elsing)(address . david.elsing@posteo.net)
20240114155516.12457-2-david.elsing@posteo.net
* gnu/packages/algebra.scm (fftw)[source]: Use git checkout without
autogenerated files.
[arguments]<#:configure-flags>: Use Gexps and set --enable-maintainer-mode and
--disable-doc.
<#:phases>: Add 'fix-maintainer-build' phase.
[native-inputs]: Add autoconf, automake, libtool, ocaml, ocamlbuild, ocaml-num
and ocaml-findlib.
(fftwf,fftw-openmpi)[arguments]: Use Gexps.
---
gnu/packages/algebra.scm | 111 ++++++++++++++++++++++++---------------
1 file changed, 70 insertions(+), 41 deletions(-)

Toggle diff (168 lines)
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index f319e260e9..dbed683bef 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -15,6 +15,7 @@
;;; Copyright © 2020, 2021, 2023 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2021 Lars-Dominik Braun <ldb@leibniz-psychology.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2024 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -38,12 +39,14 @@ (define-module (gnu packages algebra)
#:use-module (gnu packages bison)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
+ #:use-module (gnu packages code)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
#:use-module (gnu packages documentation)
#:use-module (gnu packages flex)
#:use-module (gnu packages fltk)
#:use-module (gnu packages gcc)
+ #:use-module (gnu packages ghostscript)
#:use-module (gnu packages gl)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages image)
@@ -63,6 +66,7 @@ (define-module (gnu packages algebra)
#:use-module (gnu packages tex)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages text-editors)
+ #:use-module (gnu packages xfig)
#:use-module (gnu packages xiph)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
@@ -738,37 +742,62 @@ (define-public fftw
(name "fftw")
(version "3.3.10")
(source (origin
- (method url-fetch)
- (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
- version".tar.gz"))
- (sha256
- (base32
- "0rv4w90b65b2kvjpj8g9bdkl4xqc42q20f5bzpxdrkajk1a35jan"))))
+ ;; Release tarball contains many generated files
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/FFTW/fftw3")
+ (commit (string-append "fftw-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "11r4kd1478mi35vv6fgmg6qibqkqjhb77pqxaa8374rxdlqazgyy"))))
(build-system gnu-build-system)
(arguments
- `(#:configure-flags
- '("--enable-shared" "--enable-openmp" "--enable-threads"
- ,@(let ((system (or (%current-target-system) (%current-system))))
- ;; Enable SIMD extensions for codelets. See details at:
- ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
- (cond
- ((string-prefix? "x86_64" system)
- '("--enable-sse2" "--enable-avx" "--enable-avx2"
- "--enable-avx512" "--enable-avx-128-fma"))
- ((string-prefix? "i686" system)
- '("--enable-sse2"))
- ((string-prefix? "aarch64" system)
- ;; Note that fftw supports NEON on 32-bit ARM only when
- ;; compiled for single-precision.
- '("--enable-neon"))
- (else
- '())))
- ;; By default '-mtune=native' is used. However, that may cause the
- ;; use of ISA extensions (e.g. AVX) that are not necessarily
- ;; available on the user's machine when that package is built on a
- ;; different machine.
- "ax_cv_c_flags__mtune_native=no")))
- (native-inputs (list perl))
+ (list
+ #:configure-flags
+ #~(list "--enable-shared"
+ "--enable-openmp"
+ "--enable-threads"
+ "--enable-maintainer-mode"
+ "--disable-doc"
+ #$@(let ((system (or (%current-target-system) (%current-system))))
+ ;; Enable SIMD extensions for codelets. See details at:
+ ;; <https://fftw.org/fftw3_doc/Installation-on-Unix.html>.
+ (cond
+ ((string-prefix? "x86_64" system)
+ '("--enable-sse2" "--enable-avx" "--enable-avx2"
+ "--enable-avx512" "--enable-avx-128-fma"))
+ ((string-prefix? "i686" system)
+ '("--enable-sse2"))
+ ((string-prefix? "aarch64" system)
+ ;; Note that fftw supports NEON on 32-bit ARM only when
+ ;; compiled for single-precision.
+ '("--enable-neon"))
+ (else '())))
+ ;; By default '-mtune=native' is used. However, that may cause the
+ ;; use of ISA extensions (e.g. AVX) that are not necessarily
+ ;; available on the user's machine when that package is built on a
+ ;; different machine.
+ "ax_cv_c_flags__mtune_native=no")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-maintainer-build
+ (lambda _
+ ;; This script calls configure
+ (delete-file "bootstrap.sh")
+ (invoke "touch" "ChangeLog")
+ ;; OCaml Num library
+ (substitute* "genfft/Makefile.am"
+ ((",nums")
+ " -package num")))))))
+ (native-inputs (list autoconf
+ automake
+ libtool
+ ocaml
+ ocamlbuild
+ ocaml-num
+ ocaml-findlib
+ perl))
(home-page "https://fftw.org")
(synopsis "Computing the discrete Fourier transform")
(description
@@ -784,14 +813,14 @@ (define-public fftwf
(arguments
(substitute-keyword-arguments (package-arguments fftw)
((#:configure-flags fftw-configure-flags)
- `(cons* "--enable-single"
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
- ;; fftw supports NEON on 32-bit ARM only when compiled
- ;; for single-precision, so add it here.
- '("--enable-neon")
- '())
- ,fftw-configure-flags))))
+ #~(cons* "--enable-single"
+ #$@(if (string-prefix? "arm" (or (%current-target-system)
+ (%current-system)))
+ ;; fftw supports NEON on 32-bit ARM only when compiled
+ ;; for single-precision, so add it here.
+ '("--enable-neon")
+ '())
+ #$fftw-configure-flags))))
(description
(string-append (package-description fftw)
" Single-precision version."))))
@@ -805,11 +834,11 @@ (define-public fftw-openmpi
(arguments
(substitute-keyword-arguments (package-arguments fftw)
((#:configure-flags cf)
- `(cons "--enable-mpi" ,cf))
+ #~(cons "--enable-mpi" #$cf))
((#:phases phases '%standard-phases)
- `(modify-phases ,phases
- (add-before 'check 'mpi-setup
- ,%openmpi-setup)))))
+ #~(modify-phases #$phases
+ (add-before 'check 'mpi-setup
+ #$%openmpi-setup)))))
(description
(string-append (package-description fftw)
" With OpenMPI parallelism support."))))
--
2.41.0
D
D
David Elsing wrote on 14 Jan 16:55 +0100
[PATCH v2 2/2] gnu: Add fftw-documentation.
(address . 64114@debbugs.gnu.org)(name . David Elsing)(address . david.elsing@posteo.net)
20240114155516.12457-3-david.elsing@posteo.net
* gnu/packages/algebra.scm (fftw-documentation): New variable.
---
gnu/packages/algebra.scm | 42 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)

Toggle diff (55 lines)
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index dbed683bef..1b2694400d 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -807,6 +807,48 @@ (define-public fftw
cosine/ sine transforms or DCT/DST).")
(license license:gpl2+)))
+;; Separate package to prevent dependency cycle
+(define-public fftw-documentation
+ (package/inherit fftw
+ (name "fftw-documentation")
+ (arguments
+ (substitute-keyword-arguments (package-arguments fftw)
+ ((#:tests? _ #f) #f)
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (replace 'build
+ (lambda _
+ ;; Reproducibility
+ (substitute* "doc/FAQ/m-html.pl"
+ (("- \\$html_date\\\\n") "")
+ (("\\$html_year \\$user_copyholder")
+ "2021 $user_copyholder"))
+ (substitute* "doc/FAQ/fftw-faq.bfnn"
+ ((".*`date.*") ""))
+ (invoke "make" "-C" "doc")
+ (invoke "make" "-C" "doc" "html")
+ (invoke "make" "-C" "doc/FAQ" "faq")))
+ (replace 'install
+ (let ((doc (string-append #$output "/share/doc/"
+ #$(package-name this-package) "-"
+ #$(package-version this-package))))
+ (lambda _
+ (copy-recursively "doc/html" (string-append doc "/html"))
+ (copy-recursively "doc/FAQ/fftw-faq.html"
+ (string-append doc "/fftw-faq.html"))
+ (install-file "doc/FAQ/fftw-faq.ascii" doc))))))))
+ (native-inputs
+ (modify-inputs (package-native-inputs fftw)
+ (prepend ghostscript texinfo fig2dev)))
+ (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).")
+ (license license:gpl2+)))
+
(define-public fftwf
(package/inherit fftw
(name "fftwf")
--
2.41.0
A
A
Andreas Enge wrote on 22 Nov 18:25 +0100
Action?
(address . 64114@debbugs.gnu.org)
Z0C-eGdT0T_gLdpd@jurong
Hello David,

I happened to come along your patch and examined the situation. It turns out
that the fftw version has already been updated to 3.3.10.

Unfortunately, lots of packages depend on it, so changing the package will
be quite costly. Maybe it would make sense to close the bug for now (or let
it wait) and come back to it when a new version of fftw comes out?

Andreas
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 64114@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64114
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch