all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#57774] [PATCH] Add qucs-s.
@ 2022-09-13 15:48 Garek Dyszel via Guix-patches via
  2022-09-13 16:12 ` ( via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Garek Dyszel via Guix-patches via @ 2022-09-13 15:48 UTC (permalink / raw)
  To: 57774

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

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index a8b9f1e786..376cb7e8c1 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2006,6 +2006,80 @@ (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)
+    (outputs '("out"))
+    (inputs (list qtbase-5 qtscript qtsvg-5))
+    (native-inputs (list qttools-5))
+    (propagated-inputs (list ngspice))
+    (arguments
+     `(;; There exists no "tests" target in the Makefile generated by
+       ;; CMake.
+       ;; No other tests provided.
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'get-ngspice-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Adjust two lines in the ~/.config/qucs/qucs_s.conf
+             ;; file.
+             (mkdir-p "etc/xdg/qucs_s")
+             (with-directory-excursion "etc/xdg/qucs_s"
+               (invoke "touch" "qucs_s.conf")
+               ;; Specify where the ngspice executable is located.
+               (invoke "sed" "-i"
+                       (string-append "1iNgspiceExecutable=/gnu/store/"
+                                      (assoc-ref inputs "ngspice")
+                                      "/bin/ngspice") "qucs_s.conf")
+               ;; Set the spice4qucs working directory to
+               ;; ~/.qucs/spice4qucs.
+               ;; (The default is /spice4qucs, which is rather
+               ;; dangerous.)
+               (invoke "sed" "-i" "2iS4Q_workdir=~/.qucs/spice4qucs"
+                       "qucs_s.conf")))))))
+
+    (home-page "https://ra3xdh.github.io")
+    (synopsis "QUCS RF circuit simulator with SPICE")
+    (description
+     "Qucs-S is a spin-off of the Qucs cross-platform circuit
+simulator.  The \"S\" letter indicates SPICE.  The purpose of the Qucs-S
+subproject is to use free SPICE circuit simulation kernels with the
+Qucs GUI.  It merges the power of SPICE and the simplicity of the Qucs
+GUI.  Qucs intentionally uses its own SPICE incompatible simulation
+kernel Qucsator.  It has advanced RF and AC domain simulation features,
+but most of the existing industrial SPICE models are incompatible with
+it.  Qucs-S is not a simulator by itself, but it requires to use a
+simulation backend with it.  The schematic document format of Qucs and
+Qucs-S are fully compatible.  Qucs-S can be used with the following
+simulation kernels:
+@itemize
+@item Ngspice is recommended to use.  Ngspice is powerful
+mixed-level/mixed-signal circuit simulator.  The most of industrial
+SPICE models are compatible with Ngspice.  It has an excellent
+performance for time-domain simulation of switching circuits and
+powerful postprocessor.
+@item XYCE is a new SPICE-compatible circuit simulator written by
+Sandia from the scratch.  It supports basic SPICE simulation types and
+has an advanced RF simulation features such as harmonic balance
+simulation.
+@item SpiceOpus is developed by the Faculty of Electrical Engineering
+of the Ljubljana University.  It is based on the SPICE-3f5 code.
+@item Backward compatible with Qucsator.
+@end itemize")
+    (license license:gpl2)))
+
 (define-public freehdl
   (package
     (name "freehdl")
-- 
2.37.2






^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#57774] [PATCH] Add qucs-s.
  2022-09-13 15:48 [bug#57774] [PATCH] Add qucs-s Garek Dyszel via Guix-patches via
@ 2022-09-13 16:12 ` ( via Guix-patches via
  2022-09-13 17:28 ` Artyom V. Poptsov
  2022-09-13 21:11 ` [bug#57774] [PATCH v2] " Garek Dyszel via Guix-patches via
  2 siblings, 0 replies; 6+ messages in thread
From: ( via Guix-patches via @ 2022-09-13 16:12 UTC (permalink / raw)
  To: Garek Dyszel, 57774

Hey,

On Tue Sep 13, 2022 at 4:48 PM BST, Garek Dyszel via Guix-patches via wrote:
> +    (outputs '("out"))

This line is redundant; ``out'' is implicit.

> +    (propagated-inputs (list ngspice))

Can you try to avoid propagating this somehow? Propagation is a last-resort
measure, and usually we try to do something like patching invocations of
external commands to refer to the full store path. (Although, looking at
the ``modify-phases'' below, it seems like you already do that, so I guess
you'll only need to move ``ngspice'' to ``inputs''.)

> +    (arguments
> +     `(;; There exists no "tests" target in the Makefile generated by

Please use the new style ``(list ...)'' instead of ```(...)''.

> +       (modify-phases %standard-phases

You'll need to gexp this under the new arguments style: ``#~(modify-phases ...)''.

> +             (with-directory-excursion "etc/xdg/qucs_s"
> +               (invoke "touch" "qucs_s.conf")
> +               ;; Specify where the ngspice executable is located.
> +               (invoke "sed" "-i"
> +                       (string-append "1iNgspiceExecutable=/gnu/store/"
> +                                      (assoc-ref inputs "ngspice")
> +                                      "/bin/ngspice") "qucs_s.conf")
> +               ;; Set the spice4qucs working directory to
> +               ;; ~/.qucs/spice4qucs.
> +               ;; (The default is /spice4qucs, which is rather
> +               ;; dangerous.)
> +               (invoke "sed" "-i" "2iS4Q_workdir=~/.qucs/spice4qucs"
> +                       "qucs_s.conf")))))))

This looks pretty redundant. Try using this instead:

> +               (call-with-output-file "etc/xdg/qucs_s/qucs_s.conf"
> +                 (cute format <>
> +                       "~
> +NgspiceExecutable=~a
> +S4Q_workdir=~/.qucs/spice4qucs~%"
> +                       (search-input-file inputs "bin/ngspice")))

And add this to ``arguments'':

  #:modules `((ice-9 format)
              (srfi srfi-26)
              ,@%gnu-build-system-modules)

to import ``format'' and ``cute'', respectively.

> +    (description
> +     "Qucs-S is a spin-off of the Qucs cross-platform circuit
> +simulator.  The \"S\" letter indicates SPICE.  The purpose of the Qucs-S
> +subproject is to use free SPICE circuit simulation kernels with the
> +Qucs GUI.  It merges the power of SPICE and the simplicity of the Qucs
> +GUI.  Qucs intentionally uses its own SPICE incompatible simulation
> +kernel Qucsator.  It has advanced RF and AC domain simulation features,
> +but most of the existing industrial SPICE models are incompatible with
> +it.  Qucs-S is not a simulator by itself, but it requires to use a
> +simulation backend with it.  The schematic document format of Qucs and
> +Qucs-S are fully compatible.  Qucs-S can be used with the following
> +simulation kernels:
> +@itemize
> +@item Ngspice is recommended to use.  Ngspice is powerful
> +mixed-level/mixed-signal circuit simulator.  The most of industrial
> +SPICE models are compatible with Ngspice.  It has an excellent
> +performance for time-domain simulation of switching circuits and
> +powerful postprocessor.
> +@item XYCE is a new SPICE-compatible circuit simulator written by
> +Sandia from the scratch.  It supports basic SPICE simulation types and
> +has an advanced RF simulation features such as harmonic balance
> +simulation.
> +@item SpiceOpus is developed by the Faculty of Electrical Engineering
> +of the Ljubljana University.  It is based on the SPICE-3f5 code.
> +@item Backward compatible with Qucsator.
> +@end itemize")

I think this description would probably be better and far more succint as:

> +    (description
> +     "This package provides a fork of the Qucs cross-platform circuit
> +simulator, which allows the use of SPICE circuit simulation kernels
> +with the Qucs GUI.")

    -- (




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#57774] [PATCH] Add qucs-s.
  2022-09-13 15:48 [bug#57774] [PATCH] Add qucs-s Garek Dyszel via Guix-patches via
  2022-09-13 16:12 ` ( via Guix-patches via
@ 2022-09-13 17:28 ` Artyom V. Poptsov
  2022-09-13 21:11 ` [bug#57774] [PATCH v2] " Garek Dyszel via Guix-patches via
  2 siblings, 0 replies; 6+ messages in thread
From: Artyom V. Poptsov @ 2022-09-13 17:28 UTC (permalink / raw)
  To: garekdyszel, 57774

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

Hello Garek Dyszel,

For the sake of completeness, I've tried to package "qucs-s" already:
  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56768

Wasn't finished the process though due to issues and the lack of time,
but maybe two incomplete patches could be merged into a working one.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#57774] [PATCH v2] Add qucs-s.
  2022-09-13 15:48 [bug#57774] [PATCH] Add qucs-s Garek Dyszel via Guix-patches via
  2022-09-13 16:12 ` ( via Guix-patches via
  2022-09-13 17:28 ` Artyom V. Poptsov
@ 2022-09-13 21:11 ` Garek Dyszel via Guix-patches via
  2022-09-14  6:26   ` ( via Guix-patches via
  2 siblings, 1 reply; 6+ messages in thread
From: Garek Dyszel via Guix-patches via @ 2022-09-13 21:11 UTC (permalink / raw)
  To: 57774

( 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 <poptsov.artyom@gmail.com>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org>
 ;;;
 ;;; 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






^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#57774] [PATCH v2] Add qucs-s.
  2022-09-13 21:11 ` [bug#57774] [PATCH v2] " Garek Dyszel via Guix-patches via
@ 2022-09-14  6:26   ` ( via Guix-patches via
  2022-09-16 18:27     ` Garek Dyszel via Guix-patches via
  0 siblings, 1 reply; 6+ messages in thread
From: ( via Guix-patches via @ 2022-09-14  6:26 UTC (permalink / raw)
  To: Garek Dyszel, 57774

Hey,

On Tue Sep 13, 2022 at 10:11 PM BST, Garek Dyszel wrote:
> +           #:phases #~(modify-phases %standard-phases

To conserve lots of horizontal space, consider moving the ``modify-phases''
to a new line:

> +           #:phases
> +           #~(modify-phases %standard-phases

> +                                (search-input-file inputs "/bin/ngspice")
> +                                [...]
> +                                (search-input-file inputs "/bin/octave")

You can just do ``(search-input-file inputs "bin/octave")'', no need for the
leading slash. Also, wouldn't you want to patch in the paths for Xyce,
SpiceOpus, and Qucsator, too?

> +    (synopsis "GUI for different circuit simulation kernels")

s/different/various/, perhaps?

> +
> +@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


    -- (




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#57774] [PATCH v2] Add qucs-s.
  2022-09-14  6:26   ` ( via Guix-patches via
@ 2022-09-16 18:27     ` Garek Dyszel via Guix-patches via
  0 siblings, 0 replies; 6+ messages in thread
From: Garek Dyszel via Guix-patches via @ 2022-09-16 18:27 UTC (permalink / raw)
  To: (, 57774

Hi (,

I applied your fixes, but in the process found that qucs-s had already been successfully added before by looking at the package definition for libngspice. This led to the following bug link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27344#236.

It looks like support was later dropped because qucs-s still depended on Qt4 at the time, mentioned in this thread: https://lists.gnu.org/archive/html/guix-devel/2016-02/msg00596.html.

This suggested it would be a good idea to start from the commit where qucs and qucs-s were removed. Now I'm hacking those old package definitions to work with Qt6. qucs-s 0.0.24 still depends on qt5 (which is already out of date), and I don't want to have to update it right away when this Qt security issue comes up again this year.

I'll send an updated patch when that's done. Sorry for jumping around among existing package sources; I suppose how it worked out this time.

- Garek

At 07:26 2022-09-14 UTC+0100, "(" <paren@disroot.org> wrote:
> Hey,
>
> On Tue Sep 13, 2022 at 10:11 PM BST, Garek Dyszel wrote:
>> +           #:phases #~(modify-phases %standard-phases
>
> To conserve lots of horizontal space, consider moving the ``modify-phases''
> to a new line:
>
>> +           #:phases
>> +           #~(modify-phases %standard-phases
>
>> +                                (search-input-file inputs "/bin/ngspice")
>> +                                [...]
>> +                                (search-input-file inputs "/bin/octave")
>
> You can just do ``(search-input-file inputs "bin/octave")'', no need for the
> leading slash. Also, wouldn't you want to patch in the paths for Xyce,
> SpiceOpus, and Qucsator, too?
>
>> +    (synopsis "GUI for different circuit simulation kernels")
>
> s/different/various/, perhaps?
>
>> +
>> +@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
>
>
>     -- (




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-16 18:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 15:48 [bug#57774] [PATCH] Add qucs-s Garek Dyszel via Guix-patches via
2022-09-13 16:12 ` ( via Guix-patches via
2022-09-13 17:28 ` Artyom V. Poptsov
2022-09-13 21:11 ` [bug#57774] [PATCH v2] " Garek Dyszel via Guix-patches via
2022-09-14  6:26   ` ( via Guix-patches via
2022-09-16 18:27     ` Garek Dyszel via Guix-patches via

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.