Subject: bug#49161: kicad-5.1.6 fails to build

From: Vinicius Monego <[email-masked]>
Date: Tue, 22 Jun 2021 13:29:21 +0000

Em ter, 2021-06-22 às 12:01 +0000, Guillaume Le Vaillant escreveu:
> Vinicius Monego <[email-masked]> skribis:
> 
> > > In particular the /gnu/store/...-libngspice-34/include/config.h
> > > seems suspicious.
> > 
> > Good catch. Indeed, that file should be removed.
> > 
> > Kicad takes a long time to build on my machine. I am attaching a
> > diff
> > that removes config.h and should fix the compilation if anyone can
> > confirm.
> 
> I tried applying your diff and with it kicad compiles fine and works.
> Could you send a formatted patch?

Done.

I am sending the two changes in different patches because I read in [1]
that KiCad uses config.h to extract version information about ngspice.
If simulations are working without config.h, then both patches can be
pushed. The history_file problem in the KiCad compilation is related to
readline only.

[1] https://bugs.archlinux.org/task/70569
From 7722427a3f150f5e2249ba2ea8a0c024b4bbf02d Mon Sep 17 00:00:00 2001
From: Vinicius Monego <[email-masked]>
Date: Tue, 22 Jun 2021 09:46:32 -0300
Subject: [PATCH 1/2] gnu: libngspice: Fix KiCad compilation.

* gnu/packages/engineering.scm (libngspice)[arguments]<#:configure-flags>:
Pass "--with-readline=no".
---
 gnu/packages/engineering.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 5b1c8b7938..302b5c715e 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -1721,7 +1721,9 @@ high-performance parallel differential evolution (DE) optimization algorithm.")
              "--enable-ciderlib"
              "--enable-xspice"
              "--with-ngshared"
-             "--with-readline=yes")))
+             ;; Readline must be disabled to build KiCad with ngspice 34.  See
+             ;; https://bugs.archlinux.org/task/70563 for reference.
+             "--with-readline=no")))
     (native-inputs
      `(("bison" ,bison)
        ("flex" ,flex)))
-- 
2.32.0

From d980b5bcea3fd7afc3f1e094dbef3c2426e645e8 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <[email-masked]>
Date: Tue, 22 Jun 2021 09:53:41 -0300
Subject: [PATCH 2/2] gnu: libngspice: Delete autogenerated config.h.

* gnu/packages/engineering.scm (libngspice)[arguments]<#:phases>: Rename phase
'delete-script-files to 'delete-scripts-and-config and delete config.h.
---
 gnu/packages/engineering.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 302b5c715e..b2b9d54238 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -1711,11 +1711,16 @@ high-performance parallel differential evolution (DE) optimization algorithm.")
              (substitute* "man/man1/Makefile.in"
                (("^man_MANS = ngspice\\.1 ngnutmeg\\.1 ngsconvert\\.1 ngmultidec\\.1")
                 "man_MANS = "))))
-         (add-after 'install 'delete-script-files
+         (add-after 'install 'delete-scripts-and-config
            (lambda* (#:key outputs #:allow-other-keys)
              (delete-file-recursively
               (string-append (assoc-ref outputs "out")
-                             "/share/ngspice/scripts")))))
+                             "/share/ngspice/scripts"))
+             ;; This file is autogenerated by the configure script and should
+             ;; not be distributed.  It could be removed in ngspice 35.  See
+             ;; https://bugs.archlinux.org/task/70569 for reference.
+             (delete-file (string-append (assoc-ref outputs "out")
+                                         "/include/config.h")))))
        #:configure-flags
        (list "--enable-openmp"
              "--enable-ciderlib"
-- 
2.32.0