diff mbox series

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

Message ID 87fsik0wjm.fsf@gmail.com
State New
Headers show
Series [bug#56768] gnu: engineering: Add qucs-s. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Artyom V. Poptsov July 29, 2022, 3:26 p.m. UTC
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.
Thanks,

- Artyom

Comments

M July 29, 2022, 4:17 p.m. UTC | #1
On 29-07-2022 17:26, Artyom V. Poptsov wrote:
> 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.


That's what I meant, thanks.  I guess the icons issue is GTK-specific 
and doesn't happen for Qt.

>> 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.
These substitutions look fine ...

> + (("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"
> +                                     "\""))))))))
... but they can be improved, by replacing the assoc-ref with 
search-input-file: (search-input-file inputs "/bin/ngspice"). That way, 
it doesn't depend on the package name anymore, which is preferred by 
<https://guix.gnu.org/blog/2021/the-big-change/> (*) and makes in some 
cases --with-input more usable. That blog post also has en example.

(*) Don't follow the first 'hello' example though -- it showcases 
possibilities, not what should be done, and interferes with --with-input.

> 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.
By that logic, since qtbase and qtsvg are used at runtime too, they 
should be propagated as well, but ...
> 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.

... as you have observed, things work even when they aren't propagated 
(at least for qtbase etc., ngspice and octave have not yet been tested).

Less experimentally, the propagated- in propagated-inputs means only 
that: propagation -- the dependencies are still installed even if they 
aren't propagated, because the substitute* inserts a reference so the GC 
knows to not delete it, the only difference is that the dependency isn't 
automatically put in the profile when not propagating.

In theory, the propagation shouldn't be required because you added a 
'substitute*', so in principle qucs-s should know where to find it.

Also, I noticed these substitutions modify configuration, could you 
verify they aren't saved in wherever qucs-s' configuration file is 
located? Because if they are, then even after an update of octave etc. 
it would seem that qucs-s would still use the old octave.

Greetings,
Maxime.
diff mbox series

Patch

From a4d83e1d5652654db4b6de7bc272ec4a0bfb114f Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
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