diff mbox series

[bug#74572,6/6] gnu: openmpi-5: Streamline source and do not install HTML doc.

Message ID 040e8d813af84e53e68c61f747059c229b6b70f5.1732774966.git.maxim.cournoyer@gmail.com
State New
Headers show
Series ] Python bindings, reduced size for OpenPMIx/OpenMPI. | expand

Commit Message

Maxim Cournoyer Nov. 28, 2024, 7:47 a.m. UTC
This reduces the installed package size by 63 MiB.

* gnu/packages/mpi.scm (openmpi-5) [source]: Add modules, snippet fields.

Change-Id: Ie3dc365a2e4e48dc4c385dd447d3c64b7db065ca
---
 gnu/packages/mpi.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index 67e12657db..2f37364ef3 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -325,6 +325,31 @@  (define-public openmpi-5
        (uri (string-append "https://www.open-mpi.org/software/ompi/v"
                            (version-major+minor version)
                            "/downloads/openmpi-" version ".tar.bz2"))
+       (modules '((guix build utils)
+                  (ice-9 ftw)
+                  (srfi srfi-26)))
+       (snippet
+        '(begin
+           ;; XXX: 'delete-all-but' is copied from the turbovnc package.
+           (define (delete-all-but directory . preserve)
+             (define (directory? x)
+               (and=> (stat x #f)
+                      (compose (cut eq? 'directory <>) stat:type)))
+             (with-directory-excursion directory
+               (let* ((pred
+                       (negate (cut member <> (append '("." "..") preserve))))
+                      (items (scandir "." pred)))
+                 (for-each (lambda (item)
+                             (if (directory? item)
+                                 (delete-file-recursively item)
+                                 (delete-file item)))
+                           items))))
+           ;; Delete as many bundled libraries as permitted by the build
+           ;; system.
+           (delete-all-but "3rd-party" "treematch" "Makefile.in" "Makefile.am")
+           ;; Do not install 64 MiB worth fo pre-generated HTML
+           ;; documentation.
+           (delete-file-recursively "docs/html")))
        (sha256
         (base32 "0mw1z4ppnlvxngwd58kl5q26qmvf3bgjkd4r8wjpqis3pky86hdx"))))