Subject: [bug#28593] [PATCH] gnu: openfoam: Clean up to reduce closure.

From: Dave Love <[email-masked]>
Date: Mon, 25 Sep 2017 11:44:59 +0100

This saves ~1GB.

* gnu/packages/simulation.scm (openfoam)[outputs]: Add debug.
[arguments]: Clean up .o and src after build.
---
 gnu/packages/simulation.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index de07b6844..fef80a1ac 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -84,6 +84,10 @@
      `(("gzip" ,gzip)
        ("gnuplot" ,gnuplot)
        ("openmpi" ,openmpi)))
+    ;; FIXME: Also separate tutorials (80MB) and src (60MB); maybe also doc
+    ;; (8MB)
+    (outputs '("debug"                  ;~60MB
+               "out"))
     (arguments
      `( ;; Executable files and shared libraries are located in the 'platforms'
        ;; subdirectory.
@@ -171,6 +175,15 @@
                         (("lockDir=.*$")
                          "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
                       #t))
+                  (add-after 'build 'cleanup
+                    ;; Avoid lots of junk installed
+                    (lambda _
+                      (delete-file-recursively
+                       "platforms/linux64GccDPInt32Opt/src")
+                      (delete-file-recursively
+                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI/src")
+                      (zero?
+                       (system* "find" "-name" "*.o" "-delete"))))
                   (replace 'install
                     (lambda _
                       ;; use 'OpenFOAM-version' convention
-- 
2.11.0