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

From: [email-masked] (Ludovic Courtès)
Date: Mon, 25 Sep 2017 14:52:28 +0200

Hi Dave,

Dave Love <[email-masked]> skribis:

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

Normally the ‘strip’ phase would strip things.  I guess the problem here
is that libraries are not in lib/, so nothing gets stripped.  This would
be worked around by simply passing something like:

  #:strip-directories '("OpenFOAM-1.2.3/lib")

> +                  (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"))))

Rather:

  (for-each delete-file (find-files "." "\\.o$"))

Paul can you confirm that this is OK?

If it is, could you update the patch accordingly, Dave?

Thanks,
Ludo’.