unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 56768@debbugs.gnu.org
Subject: [bug#56768] [PATCH] gnu: engineering: Add qucs-s.
Date: Sat, 30 Jul 2022 09:59:21 +0300	[thread overview]
Message-ID: <87v8rfxf06.fsf@gmail.com> (raw)
In-Reply-To: <a06ecddf-d0d6-487b-f7da-aa84a2e63f33@telenet.be> (Maxime Devos's message of "Fri, 29 Jul 2022 18:17:30 +0200")


[-- Attachment #1.1: Type: text/plain, Size: 3240 bytes --]

Hello Maxime.

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

Yes, Qt allows the application resources (like icons) to be put into the
application binary on the build time, and that's how it's done usually.

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

Done.

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

I usually put into "propagated-inputs" packages that provide some binary
that the current package use in the runtime.

So do you mean that I should rely only on "inputs" package property, and
the inputs will be propagated anyway if they're in use by the package?

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

Following your logic I moved NGSpice and Octave from "propagated-inputs"
to "inputs" as they substituted in the sources.

> 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.

Good catch.  In my previous patch I substituted NGSpice and Octave in the
part of code that is executed only when no configuration is provided, so
the current binary versions used by default.  However after the first run
Qucs-S stores the paths to the configuration file:

--8<---------------cut here---------------start------------->8---
$ cat ~/.config/qucs/qucs_s.conf [General] ...
NgspiceExecutable=/gnu/store/jl159ilvjzxd0i45xf2z8llbhvl10w54-ngspice-37/bin/ngspice
...
--8<---------------cut here---------------end--------------->8---

So the next time Qucs-S run it gets the paths from the configuration
file.

I changed the substitutions so Qucs-S will ignore the paths to Octave
and NGSpice from the configuration and will always use the paths
provided by Guix.  Also any custom paths to Octave and NGSpice will be
overwritten in the config when the application exits.

That is sub-optimal in my view as we're messing up with the application
configuration logic and if a user wants to change those paths he or she
will be able to remove the config and set the paths in the startup
configuration dialogue, but the settings will have no effect; that will
be a bit confusing.

Yet at least Qucs-S will always use the right Octave/NGSpice path from
GNU Guix.

What do you think?

Here's the patch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-qucs-s.patch --]
[-- Type: text/x-diff, Size: 2732 bytes --]

From 9888a6b0169bd3b9f158749f164b2fb1ebd5603a 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 | 48 ++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 6eefd14d7e..4cd9e2767a 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -3757,3 +3757,51 @@ (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 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 = .*;")
+                               (string-append
+                                "QucsSettings.NgspiceExecutable = \""
+                                (search-input-file inputs "/bin/ngspice")
+                                "\";"))
+                              (("QucsSettings.OctaveExecutable = .*;")
+                               (string-append
+                                "QucsSettings.OctaveExecutable = \""
+                                (search-input-file inputs "/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


[-- Attachment #1.3: Type: text/plain, Size: 229 bytes --]


Thanks,

- Artyom

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

  reply	other threads:[~2022-07-30  7:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 20:02 [bug#56768] [PATCH] gnu: engineering: Add qucs-s Artyom V. Poptsov
2022-07-26 18:07 ` Maxime Devos
2022-07-29 15:26   ` Artyom V. Poptsov
2022-07-29 16:17     ` Maxime Devos
2022-07-30  6:59       ` Artyom V. Poptsov [this message]
2022-08-06 11:42         ` Maxime Devos
2022-08-06 10:15 ` Jean Pierre De Jesus DIAZ via Guix-patches via
2022-09-04 16:00 ` Artyom V. Poptsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8rfxf06.fsf@gmail.com \
    --to=poptsov.artyom@gmail.com \
    --cc=56768@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).