diff mbox series

[bug#64114,v2,1/2] gnu: fftw: Build entirely from source.

Message ID 20240114155516.12457-2-david.elsing@posteo.net
State New
Headers show
Series [bug#64114,v2,1/2] gnu: fftw: Build entirely from source. | expand

Commit Message

David Elsing Jan. 14, 2024, 3:55 p.m. UTC
* 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(-)
diff mbox series

Patch

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."))))