Subject: [PATCH v2] Add qucs-s.

From: Garek Dyszel <[email-masked]>
Date: Tue, 13 Sep 2022 21:11:40 +0000

( and Artyom,

I synthesized my last version of this package with Artyom's version in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56768.
Starting over from that version, more or less, automatically fixed the
following issues:

1. (outputs '("out")) removed
2. (propagated-inputs (list ngspice)) removed
3. (arguments `( --> (arguments (list : style changed

Further changes:
1. Overly long description shortened by blending ('s suggestion and Artyom's version.
2. Regexps in the (substitute*) procedure now correctly detect and replace the lines where ngspice and octave are referenced in qucs/main.cpp. 

Let me know what you think.

Thanks,
Garek

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

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index a8b9f1e786..e759134ae4 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -36,6 +36,7 @@
 ;;; Copyright © 2022 Artyom V. Poptsov <[email-masked]>
 ;;; Copyright © 2022 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2022 Felix Gruber <[email-masked]>
+;;; Copyright © 2022 Garek Dyszel <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2006,6 +2007,65 @@ (define-public xyce-parallel
        ,@(alist-delete "trilinos"
                        (package-inputs xyce-serial))))))
 
+(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 qt-build-system)
+    (native-inputs (list qttools-5))
+    (inputs (list qtbase-5 qtscript qtsvg-5 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"
+                              ;; Use the user's configuration files in
+                              ;; ~/.config/qucs/qucs_s.conf for the
+                              ;; locations of ngspice and octave. If
+                              ;; the locations are not given in
+                              ;; ~/.config/qucs/qucs_s.conf, use the
+                              ;; locations provided by Guix.
+                              (("QString ngsp_exe = \
+QCoreApplication::applicationDirPath\\(\\) \\+")
+                               (string-append
+                                "QString ngsp_exe = \""
+                                (search-input-file inputs "/bin/ngspice")
+                                "\";"))
+                              (("QDir::separator\\(\\) \\+ \"ngspice\" \\+ \
+executableSuffix;") "")
+                             (("else QucsSettings.OctaveExecutable = \"octave\" \
+\\+ QString\\(executableSuffix\\);")
+                              (string-append
+                                "else QucsSettings.OctaveExecutable = \""
+                                (search-input-file inputs "/bin/octave")
+                                "\";"))))))))
+    (synopsis "GUI for different circuit simulation kernels")
+    (description
+     "@code{Qucs-S} provides a fork of the Qucs circuit simulator,
+which is used as a 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+)))
+
 (define-public freehdl
   (package
     (name "freehdl")
-- 
2.37.2