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

From: Dave Love <[email-masked]>
Date: Sun, 22 Oct 2017 17:15:09 +0100

Paul Garlick <[email-masked]> writes:

> ii) deleting object files, to save disk space, under
> 'platforms/linux64GccDPInt32Opt/src' should also be fine, with the
> proviso that the re-compilation process should be checked before
> committing.  There is an example procedure, albeit for an earlier
> version, given at https://openfoamwiki.net/index.php/How_to_add_tempera
> ture_to_icoFoam .  A slightly modified procedure should work for
> version 4.1.
>
> Dave, can you try this on your patched version?  'wmake' should re-
> generate the object files that are needed and produce a new executable.
>  Check that there are no instances of errors such as 'file not found'

I successfully rebuilt pisoFoam following the example in the current
documentation.  Is that good enough?

Here's a modified patch to change the comment and avoid an empty
directory.

>From dc88db3e91c70da5e6e557ed5fdd528499cb1c65 Mon Sep 17 00:00:00 2001
From: Dave Love <[email-masked]>
Date: Sat, 21 Oct 2017 17:20:42 +0100
Subject: [PATCH] gnu: openfoam: Clean up to reduce closure.

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..3e65d1687 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 unncessary, voluminous object and dep files
+                    (lambda _
+                      (delete-file-recursively
+                       "platforms/linux64GccDPInt32Opt/src")
+                      (delete-file-recursively
+                       "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
+                      (zero?
+                       (system* "find" "-name" "*.o" "-delete"))))
                   (replace 'install
                     (lambda _
                       ;; use 'OpenFOAM-version' convention
-- 
2.11.0