Subject: Re: [bug#56768] [PATCH] gnu: engineering: Add qucs-s.

From: "Artyom V. Poptsov" <[email-masked]>
Date: Fri, 29 Jul 2022 18:26:53 +0300

Hello Maxime,

thanks you for the patch review!

> Often GUIs have problems with finding icons, could you check whether
> qucs-s works in a pure environment?

I tried to run Qucs-S installed through Guix, like the follows:

--8<---------------cut here---------------start------------->8---
guix shell -D guix
./pre-inst-env guix shell -D --pure qucs-s
qucs-s
--8<---------------cut here---------------end--------------->8---

And all the icons seem to be fine

Although it can be that I don't fully understand what you mean by "pure
environment" in that case.

> Propagation is not very robust (e.g. if run directly from the store with $(guix
> build qucs-s)/bin/the-binary), would it be possible to not propagate this? E.g.,
> if you are propagating it because of not finding a binary, you could use
> substitute* to insert an appropriate absolute file name.

Okay, that's a good point.  I checked the sources for the places where
Qucs-S uses executable paths and added substitutions for that.

I kept NGSpice in "propagated-inputs" because Qucs-S requires it to do
the simulations in runtime.

Also I've added GNU Octave to the "propagated-inputs" and substituted
the path to Octave too.

I tried to run simulations from the examples provided with the Qucs-S
and it seems to me that Qucs-S mostly works as it should.

I should note here that I'm not very good at electronics and such
simulations yet, so you should take what I said above with a grain of
salt indeed.  ;-)

Please check the updated patch.
From a4d83e1d5652654db4b6de7bc272ec4a0bfb114f Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <[email-masked]>
Date: Mon, 25 Jul 2022 22:57:14 +0300
Subject: [PATCH] gnu: Add qucs-s.

* gnu/packages/engineering.scm (qucs-s): New variable.
---
 gnu/packages/engineering.scm | 54 ++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 6eefd14d7e..95c6c012a3 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -3470,8 +3470,7 @@ (define-public libnest2d-for-cura
     (build-system cmake-build-system)
     (inputs
      (list boost clipper nlopt))
-    (arguments
-     `(#:tests? #f
+    (arguments     `(#:tests? #f
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'fix-clipper-detection
@@ -3757,3 +3756,54 @@ (define-public candle
 @item Visualizing G-code files.
 @end itemize")
       (license license:gpl3+))))
+
+(define-public qucs-s
+  (package
+    (name "qucs-s")
+    (version "0.0.24")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ra3xdh/qucs_s")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1lbkaw0grw9w7d37z5dbhaqi8p57cpf9yp071zp6xrairkgimdx8"))))
+    (build-system cmake-build-system)
+    (native-inputs (list qttools))
+    (inputs (list qtbase-5 qtscript qtsvg))
+    (propagated-inputs (list ngspice octave))
+    (arguments
+     (list #:tests? #f ; no tests
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'patch
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "qucs/main.cpp"
+                     (("QucsSettings.NgspiceExecutable = ngsp_exe")
+                      (string-append "QucsSettings.NgspiceExecutable = \""
+                                     (assoc-ref inputs "ngspice")
+                                     "/bin/ngspice"
+                                     "\""))
+                     (("QucsSettings.OctaveExecutable = \"octave\" + QString(executableSuffix)")
+                      (string-append "QucsSettings.OctaveExecutable = \""
+                                     (assoc-ref inputs "octave")
+                                     "/bin/octave"
+                                     "\""))))))))
+    (synopsis "GUI for different circuit simulation kernels")
+    (description
+     "@code{Qucs-S} provides a fancy graphical user interface for a number of
+popular circuit simulation engines.  The package contains libraries for
+schematic capture, visualization and components.  The following simulation
+kernels are supported:
+
+@itemize
+@item Ngspice (recommended)
+@item Xyce
+@item SpiceOpus
+@item Qucsator (non-spice)
+@end itemize
+")
+    (home-page "https://ra3xdh.github.io/")
+    (license license:gpl2+)))
-- 
2.34.1

Thanks,

- Artyom

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F