guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#72071] [PATCH 1/1] Backup original settings, so they can be restore


From: Luca Cirrottola
Subject: [bug#72071] [PATCH 1/1] Backup original settings, so they can be restored before the check phase and patched again before the install phase (since the install-data target depends on this file).
Date: Thu, 25 Jul 2024 14:49:03 +0200

---
 gnu/packages/maths.scm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 8116569bca..6787f9bb49 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1729,7 +1729,13 @@ (define-public hdf5-1.8
                (("libhdf5hl_fortran_la_LDFLAGS =")
                 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
                                (assoc-ref outputs "fortran") "/lib")))))
-         (add-after 'configure 'patch-settings
+         (add-after 'configure 'copy-settings
+           (lambda _
+             ;; Backup the original settings (because they are needed as a test
+             ;; reference during the "check" phase) before patching them in the
+             ;; "patch-settings-for-build" phase.
+             (copy-file "src/libhdf5.settings" "libhdf5_settings.orig")))
+         (add-before 'build 'patch-settings-for-build
            (lambda _
              ;; libhdf5.settings contains the full path of the
              ;; compilers used, and its contents are included in
@@ -1742,7 +1748,19 @@ (define-public hdf5-1.8
               ;; settings file reproducible.
               (("Uname information:.*")
                "Uname information: Linux\n"))))
-         (add-after 'install 'patch-references
+         (add-before 'check 'restore-settings-for-check
+           (lambda _
+             ;; Swap the file that has been patched in the
+             ;; "patch-settings-for-build" phase with the original one which
+             ;; has been saved in the "copy-settings" phase, so that it can be
+             ;; used as a test reference in the "check" phase.
+             (copy-file "src/libhdf5.settings" "libhdf5_settings.patched")
+             (rename-file "libhdf5_settings.orig" "src/libhdf5.settings")))
+         (add-before 'install 'patch-settings-for-install
+           (lambda _
+             ;; Restore the patched settings file before installation.
+             (rename-file "libhdf5_settings.patched" "src/libhdf5.settings")))
+        (add-after 'install 'patch-references
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
                    (zlib (assoc-ref inputs "zlib")))
-- 
2.34.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]