unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#64114] [PATCH] gnu: fftw: Update to 3.3.10 and build entirely from source.
@ 2023-06-16 17:16 David Elsing
  2024-01-14 15:55 ` [bug#64114] [PATCH v2 0/2] Build fftw " David Elsing
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Elsing @ 2023-06-16 17:16 UTC (permalink / raw)
  To: 64114; +Cc: David Elsing

* 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(-)

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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-14 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 17:16 [bug#64114] [PATCH] gnu: fftw: Update to 3.3.10 and build entirely from source David Elsing
2024-01-14 15:55 ` [bug#64114] [PATCH v2 0/2] Build fftw " David Elsing
2024-01-14 15:55 ` [bug#64114] [PATCH v2 1/2] gnu: fftw: Build " David Elsing
2024-01-14 15:55 ` [bug#64114] [PATCH v2 2/2] gnu: Add fftw-documentation David Elsing

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).