Subject: Re: [bug#27344] [PATCH v3 2/8] gnu: Add libngspice and ngspice.

From: [email-masked] (Ludovic Courtès)
Date: Sun, 01 Oct 2017 15:04:36 +0200

Hello,

Theodoros Foradis <[email-masked]> skribis:

> Ludovic Courtès writes:
>
>> Theodoros Foradis <[email-masked]> skribis:
>>
>>> * gnu/packages/engineering.scm (libngspice): New variable.
>>> * gnu/packages/engineering.scm (ngspice): New variable.
>>
>> I’m sorry for asking this late in the game, but I didn’t find the
>> answer in previous discussions: why two packages?  It seems to me that a
>> “lib” output would achieve the same, no?
>>
>> (It’s best to leave a comment in such a situation.)
>>
>> If you tell me I’m wrong, that’s OK, I’ll apply it right away!
>
> The way this package's build system is set up, you cannot build both the
> libraries and executables in the same run. That is, you need to run
> ./configure (with the library-specific flag), make, then ./configure and
> make again, to build everything.

OK, that makes a lot of sense.

> This is why I split the package in two. Initially (in v1 and v2 patch
> series), I had libngspice be a non-public package, and ngspice was
> copying the library to its normal output.
>
> After Danny's additions, different phases were added to both
> packages, and unneeded files are deleted from their outputs. So, both
> were made public, with only the minimal files needed for each
> functionality.
>
> Would it be preferable to have libngspice as a non-public package again,
> and have ngspice copy it to a "lib" output?

Given that we’re dealing with a limitation of upstream’s build system,
I think it’s OK to do it the way you did.

I’ve committed the patch with the cosmetic changes below.

Thanks, and sorry again for the delay!

Ludo’.

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 52a925225..0356fbfe9 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -1180,6 +1180,9 @@ high-performance parallel differential evolution (DE) optimization algorithm.")
     (license license:gpl2+)))
 
 (define-public libngspice
+  ;; Note: The ngspice's build system does not allow us to build both the
+  ;; library and the executables in one go.  Thus, we have two packages.
+  ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27344#236>.
   (package
     (name "libngspice")
     (version "26")
@@ -1249,6 +1252,7 @@ an embedded event driven algorithm.")
                    license:public-domain)))) ; xspice
 
 (define-public ngspice
+  ;; The ngspice executables (see libngpsice above.)
   (package (inherit libngspice)
     (name "ngspice")
     (arguments
@@ -1265,12 +1269,12 @@ an embedded event driven algorithm.")
                #t))
            (add-after 'install 'delete-cmpp-dlmain
              (lambda* (#:key outputs #:allow-other-keys)
-             (for-each
-              (lambda (file)
+               (for-each (lambda (file)
                            (delete-file
                             (string-append (assoc-ref outputs "out")
                                            file)))
-              '("/bin/cmpp" "/share/ngspice/dlmain.c"))))
+                         '("/bin/cmpp" "/share/ngspice/dlmain.c"))
+               #t))
            (delete 'delete-program-manuals)
            (delete 'delete-script-files)))))
     (inputs