apteryx pushed a commit to branch master
in repository guix.

commit 204244f157bde583e03729c64f5c36a5af4b046a
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Thu Feb 13 13:28:46 2025 +0900

    gnu: qucs-s: Update to 24.4.1.
    
    * gnu/packages/engineering.scm (qucs-s): Update to 24.4.1.  Apply patch.
    [build-system]: Switch to qt-build-system.
    [arguments] <qtbase, configure-flags>: New arguments.
    <phases>: Replace patch phase with adjust-default-settings one.
    [native-inputs]: Replace qttools-5 with qttools.
    [inputs]: Replace qtbase-5 with qtbase, qtcharts-5 with qtcharts and qtsvg-5
    with qtsvg.  Add qtwayland.
    * gnu/packages/patches/qucs-s-qucsator-rf-search.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Change-Id: I2afc90fa9f69935301819d8ad4e912a076205c30
---
 gnu/local.mk                                       |   1 +
 gnu/packages/engineering.scm                       |  32 ++--
 .../patches/qucs-s-qucsator-rf-search.patch        | 163 +++++++++++++++++++++
 3 files changed, 179 insertions(+), 17 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 66ad9accbd..244420fc76 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2006,6 +2006,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/qtdeclarative-disable-qmlcache.patch    \
   %D%/packages/patches/quodlibet-fix-invalid-glob.patch        \
   %D%/packages/patches/quodlibet-fix-mtime-tests.patch         \
+  %D%/packages/patches/qucs-s-qucsator-rf-search.patch         \
   %D%/packages/patches/qxlsx-fix-include-directory.patch       \
   %D%/packages/patches/sdcc-disable-non-free-code.patch                \
   %D%/packages/patches/sdl-pango-api_additions.patch           \
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 03575e35ba..bbb39a64df 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -34,7 +34,7 @@
 ;;; Copyright © 2022 Konstantinos Agiannis <[email protected]>
 ;;; Copyright © 2022 Greg Hogan <[email protected]>
 ;;; Copyright © 2022, 2024, 2025 Artyom V. Poptsov <[email protected]>
-;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
+;;; Copyright © 2022, 2025 Maxim Cournoyer <[email protected]>
 ;;; Copyright © 2022, 2023, 2025 Felix Gruber <[email protected]>
 ;;; Copyright © 2023 Theofilos Pechlivanis <[email protected]>
 ;;; Copyright © 2023 Sharlatan Hellseher <[email protected]>
@@ -890,7 +890,7 @@ and others.")
 (define-public qucs-s
   (package
     (name "qucs-s")
-    (version "0.0.24")
+    (version "24.4.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -899,27 +899,25 @@ and others.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1lbkaw0grw9w7d37z5dbhaqi8p57cpf9yp071zp6xrairkgimdx8"))))
-    (build-system cmake-build-system)
-    (native-inputs (list qttools-5))
-    (inputs (list qtbase-5 qtscript qtsvg-5 ngspice octave))
+                "0307046h3vf6pprbvv47r46mpm764w49ci2cg0i3l1w9rbqlypln"))
+              (patches (search-patches "qucs-s-qucsator-rf-search.patch"))))
+    (build-system qt-build-system)
     (arguments
      (list
+      #:qtbase qtbase                   ;for Qt 6
+      #:configure-flags #~(list "-DWITH_QT6=ON")
       #:tests? #f                       ;no tests
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'patch
+          (add-after 'unpack 'adjust-default-settings
             (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") "\";"))))))))
+              (substitute* "qucs/settings.cpp"
+                (("\"ngspice\"")
+                 (format #f "~s" (search-input-file inputs "bin/ngspice")))
+                (("\"octave\"")
+                 (format #f "~s" (search-input-file inputs 
"bin/octave")))))))))
+    (native-inputs (list qttools))
+    (inputs (list ngspice octave qtbase qtcharts qtsvg qtwayland))
     (synopsis "GUI for different circuit simulation kernels")
     (description
      "@acronym{Qucs-S, Quite universal circuit simulator with SPICE} provides
diff --git a/gnu/packages/patches/qucs-s-qucsator-rf-search.patch 
b/gnu/packages/patches/qucs-s-qucsator-rf-search.patch
new file mode 100644
index 0000000000..c44036d9d1
--- /dev/null
+++ b/gnu/packages/patches/qucs-s-qucsator-rf-search.patch
@@ -0,0 +1,163 @@
+From eb3aad2452ea6a69c22e25182fdaf5b98549758f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?=
+ <[email protected]>
+Date: Sat, 7 Dec 2024 20:08:02 +0300
+Subject: [PATCH] fix ngspice and qucsator_rf path search.
+
+---
+ qucs/main.cpp |  8 +++---
+ qucs/qucs.cpp | 75 ++++++++++++++++++++++++++++++++-------------------
+ 2 files changed, 52 insertions(+), 31 deletions(-)
+
+diff --git a/qucs/main.cpp b/qucs/main.cpp
+index 287cd5b83..a015a7687 100644
+--- a/qucs/main.cpp
++++ b/qucs/main.cpp
+@@ -106,12 +106,12 @@ bool loadSettings()
+         QFileInfo inf(QucsSettings.Qucsator);
+         QucsSettings.QucsatorDir = inf.canonicalPath() + QDir::separator();
+         if (QucsSettings.Qucsconv.isEmpty())
+-            QucsSettings.Qucsconv = QucsSettings.QucsatorDir + 
QDir::separator() + "qucsconv_rf" + executableSuffix;
++            QucsSettings.Qucsconv = 
QStandardPaths::findExecutable("qucsconv_rf",{QucsSettings.QucsatorDir});
+     } else {
+-        QucsSettings.Qucsator = QucsSettings.BinDir + "qucsator_rf" + 
executableSuffix;
++        QucsSettings.Qucsator = 
QStandardPaths::findExecutable("qucsator_rf",{QucsSettings.BinDir});
+         QucsSettings.QucsatorDir = QucsSettings.BinDir;
+         if (QucsSettings.Qucsconv.isEmpty())
+-            QucsSettings.Qucsconv = QucsSettings.BinDir + "qucsconv_rf" + 
executableSuffix;
++            QucsSettings.Qucsconv = 
QStandardPaths::findExecutable("qucsconv_rf",{QucsSettings.BinDir});
+     }
+ 
+     
QucsSettings.AdmsXmlBinDir.setPath(_settings::Get().item<QString>("AdmsXmlBinDir"));
+@@ -798,7 +798,7 @@ int main(int argc, char *argv[])
+   QucsDir.cdUp();
+ #endif
+ 
+-  QucsSettings.BinDir =      QucsDir.absolutePath() + "/bin/";
++  QucsSettings.BinDir =      QucsApplicationPath.contains("bin") ? 
QucsApplicationPath : QucsDir.absoluteFilePath("bin");
+   QucsSettings.LangDir =     QucsDir.canonicalPath() + "/share/" QUCS_NAME 
"/lang/";
+ 
+   QucsSettings.LibDir =      QucsDir.canonicalPath() + "/share/" QUCS_NAME 
"/library/";
+diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp
+index 07d0eb4f4..e78479b53 100644
+--- a/qucs/qucs.cpp
++++ b/qucs/qucs.cpp
+@@ -156,8 +156,8 @@ QucsApp::QucsApp()
+ 
+   select->setChecked(true);  // switch on the 'select' action
+   switchSchematicDoc(true);  // "untitled" document is schematic
+-
+-  lastExportFilename = QDir::homePath() + QDir::separator() + "export.png";
++  QDir homeDir       = QDir::homePath();
++  lastExportFilename = homeDir.absoluteFilePath("export.png");
+ 
+   // load documents given as command line arguments
+   for(int z=1; z<qApp->arguments().size(); z++) {
+@@ -172,42 +172,54 @@ QucsApp::QucsApp()
+     }
+   }
+ 
++  QDir QucsBinDir(QucsSettings.BinDir);
+   if (QucsSettings.firstRun) { // try to find Ngspice
++      QString ngspice_exe_name = "ngspice";
+ #ifdef Q_OS_WIN
+-      QString ngspice_exe1 = QucsSettings.BinDir + QDir::separator() + 
"ngspice_con.exe";
+-      QString ngspice_exe2 = "C:\\Spice64\\bin\\ngspice_con.exe";
+-      QString qucsator_exe = QucsSettings.BinDir + QDir::separator() + 
"qucsator_rf.exe";
+-#else
+-      QString ngspice_exe1 = QucsSettings.BinDir + QDir::separator() + 
"ngspice";
+-      QString qucsator_exe = QucsSettings.BinDir + QDir::separator() + 
"qucsator_rf";
++      ngspice_exe_name+="_con";
+ #endif
++      /* search own path */
++      QString ngspice_exe1 = 
QStandardPaths::findExecutable(ngspice_exe_name,{QucsBinDir.absolutePath()});
++      /* search system path */
++      QString ngspice_exe2 = QStandardPaths::findExecutable(ngspice_exe_name);
++
++      /* search own path */
++      QString qucsator_exe1 = 
QStandardPaths::findExecutable("qucsator_rf",{QucsBinDir.absolutePath()});
++      /* search system path */
++      QString qucsator_exe2 = QStandardPaths::findExecutable("qucsator_rf");
++
+       QString ngspice_exe;
+       bool ngspice_found = false;
+-      if (QFile::exists(ngspice_exe1)) {
++      if(!ngspice_exe1.isEmpty()){
+           ngspice_found = true;
+           ngspice_exe = ngspice_exe1;
++      }else if(!ngspice_exe2.isEmpty()){
++          ngspice_found = true;
++          ngspice_exe = ngspice_exe2;
+       }
++
++      QString qucsator_exe;
+       bool qucsator_found = false;
+-      if (QFile::exists(qucsator_exe)) {
++      if(!qucsator_exe1.isEmpty()){
+           qucsator_found = true;
+-          QucsSettings.Qucsator = qucsator_exe;
+-      }
+-#ifdef Q_OS_WIN
+-      if (!ngspice_found && QFile::exists(ngspice_exe2)) {
+-          ngspice_found = true;
+-          ngspice_exe = ngspice_exe2;
++          qucsator_exe = qucsator_exe1;
++      }else if(!qucsator_exe2.isEmpty()){
++          qucsator_found = true;
++          qucsator_exe = qucsator_exe2;
+       }
+-#endif
+-      ngspice_exe = QDir::toNativeSeparators(ngspice_exe);
++
+       QString info_string;
+       if (ngspice_found) {
+-          QucsSettings.DefaultSimulator = spicecompat::simNgspice;
++          QucsSettings.DefaultSimulator  = spicecompat::simNgspice;
+           QucsSettings.NgspiceExecutable = ngspice_exe;
+           info_string += tr("Ngspice found at: ") + ngspice_exe + "\n";
+       }
+-      if (qucsator_found) {
++
++      if(qucsator_found){
++          QucsSettings.Qucsator = qucsator_exe;
+           info_string += tr("QucsatorRF found at: ") + qucsator_exe + "\n";
+       }
++
+       info_string += tr("\nYou can specify another location later"
+                         " using Simulation->Simulators Setings\n");
+       if (!ngspice_found && qucsator_found) {
+@@ -220,18 +232,27 @@ QucsApp::QucsApp()
+           QMessageBox::information(nullptr,tr("Set simulator"), info_string);
+           fillSimulatorsComboBox();
+       } else {
++#ifdef Q_OS_WIN
++          QucsSettings.NgspiceExecutable = "ngspice_con.exe";
++          QucsSettings.Qucsator = "qucsator_rf.exe";
++#else
++          QucsSettings.NgspiceExecutable = "ngspice";
++          QucsSettings.Qucsator = "qucsator_rf";
++#endif
+           QMessageBox::information(this,tr("Qucs"),tr("No simulators found 
automatically. Please specify simulators"
+                                                       " in the next dialog 
window."));
+           slotSimSettings();
+       }
+       QucsSettings.firstRun = false;
+-  } else if (!QFile::exists(QucsSettings.Qucsator)) {
+-      QucsSettings.Qucsator = QucsSettings.BinDir + QDir::separator() + 
"qucsator_rf";
+-#ifdef Q_OS_WIN
+-      QucsSettings.Qucsator += ".exe";
+-#endif
+-      QMessageBox::information(this, "Qucs",
+-                tr("QucsatorRF found at: ") + QucsSettings.Qucsator + "\n");
++  } else {
++      if (!QucsSettings.Qucsator.contains("qucsator_rf")) {
++          QucsSettings.Qucsator = 
QStandardPaths::findExecutable("qucsator_rf",{QucsBinDir.absolutePath()});
++
++          if(!QucsSettings.Qucsator.isEmpty()){
++            QMessageBox::information(this, "Qucs",
++                    tr("QucsatorRF found at: ") + QucsSettings.Qucsator + 
"\n");
++          }
++      }
+   }
+ 
+ //  fillLibrariesTreeView();

Reply via email to