summary refs log tree commit diff
path: root/gnu/packages/engineering.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/engineering.scm')
-rw-r--r--gnu/packages/engineering.scm167
1 files changed, 158 insertions, 9 deletions
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index c9e184d7d5..911f519e2f 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -42,10 +42,12 @@
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages commencement)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages fpga)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gd)
@@ -54,6 +56,7 @@
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages image)
@@ -626,8 +629,8 @@ language.")
 ;; We use kicad from a git commit, because support for boost 1.61.0 has been
 ;; recently added.
 (define-public kicad
-  (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
-        (revision "1"))
+  (let ((commit "5f4599fb56da4dd748845ab10abec02961d477f3")
+        (revision "2"))
     (package
       (name "kicad")
       (version (string-append "4.0-" revision "."
@@ -639,7 +642,7 @@ language.")
                (url "https://git.launchpad.net/kicad")
                (commit commit)))
          (sha256
-          (base32 "0kf6r92nps0658i9n3p9vp5dzbssmc22lvjv5flyvnlf83l63s4n"))
+          (base32 "1833pln2975gmc5s18xf7s8m9vg834lmxxdjk0wlk3lq7bvjjnff"))
          (file-name (string-append name "-" version "-checkout"))))
       (build-system cmake-build-system)
       (arguments
@@ -661,6 +664,7 @@ language.")
                               (assoc-ref %build-inputs "wxpython")
                               "/include/wx-3.0")
                "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
+               "-DKICAD_SPICE=TRUE"
                ;; TODO: Enable this when CA certs are working with curl.
                "-DBUILD_GITHUB_PLUGIN=OFF")
          #:phases
@@ -679,6 +683,14 @@ language.")
                    `("PYTHONPATH" ":" prefix (,path))
                    `("PATH" ":" prefix
                      (,(string-append python "/bin:")))))
+               #t))
+           (add-after 'wrap-program 'install-lib-3d
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (for-each
+                (lambda (file)
+                  (install-file file (string-append (assoc-ref outputs "out")
+                                                    "/lib")))
+                (find-files "." "^libkicad_3dsg.*"))
                #t)))))
       (native-inputs
        `(("boost" ,boost)
@@ -693,6 +705,7 @@ language.")
          ("glew" ,glew)
          ("glm" ,glm)
          ("hicolor-icon-theme" ,hicolor-icon-theme)
+         ("libngspice" ,libngspice)
          ("libsm" ,libsm)
          ("mesa" ,mesa)
          ("openssl" ,openssl)
@@ -708,7 +721,7 @@ electrical diagrams), gerbview (viewing Gerber files) and others.")
       (license license:gpl3+))))
 
 (define-public kicad-library
-  (let ((version "4.0.4"))
+  (let ((version "4.0.6"))
     (package
       (name "kicad-library")
       (version version)
@@ -719,7 +732,7 @@ electrical diagrams), gerbview (viewing Gerber files) and others.")
                       version ".tar.gz"))
                 (sha256
                  (base32
-                  "1wyda58y39lhxml0xv1ngvddi0nqihx9bnlza46ajzms38ajvh12"))))
+                  "16f47pd6f0ddsdxdrp327nr9v05gl8c24d0qypq2aqx5hdjmkp7f"))))
       (build-system cmake-build-system)
       (arguments
        `(#:out-of-source? #t
@@ -762,7 +775,7 @@ electrical diagrams), gerbview (viewing Gerber files) and others.")
                    version ".tar.gz"))
              (sha256
               (base32
-               "0ya4gg6clz3vp2wrb67xwg0bhwh5q8ag39jjmpcp4zjcqs1f48rb"))))))
+               "0vmgqhdw05k5fdnqv42grnvlz7v75g9md82jp2d3dvw2zw050lfb"))))))
       (home-page "http://kicad-pcb.org/")
       (synopsis "Libraries for kicad")
       (description "This package provides Kicad component, footprint and 3D
@@ -1441,25 +1454,62 @@ parallel computing platforms.  It also supports serial execution.")
                 (string-append (assoc-ref inputs "coreutils")
                                "/bin/cat")))
              #t))
+         (add-after 'patch-pkg-config 'setenv
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "CXX" (string-append (assoc-ref inputs "gcc")
+                                          "/bin/g++"))
+             (setenv "SYSTEM_LIBTOOL" (string-append (assoc-ref inputs "libtool")
+                                                     "/bin/libtool"))
+             #t))
+         (add-after 'setenv 'patch-gvhdl
+           (lambda _
+             (substitute* "v2cc/gvhdl.in"
+               (("--mode=link") "--mode=link --tag=CXX")
+               (("-lm") "-lm FREEHDL/lib/freehdl/libieee.la"))
+             #t))
+         (add-after 'patch-gvhdl 'patch-freehdl-gennodes
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "freehdl/freehdl-gennodes.in"
+               (("guile")
+                (string-append (assoc-ref inputs "guile") "/bin/guile"))
+               (("\\(debug") ";(debug")
+               (("\\(@ ") "(apply-emit")
+               (("\\(@@ ") "(apply-mini-format"))
+             #t))
          (add-after 'configure 'patch-freehdl-pc
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "freehdl.pc"
                (("=g\\+\\+")
-                (string-append "=" (assoc-ref inputs "gcc")
+                (string-append "=" (assoc-ref inputs "gcc-toolchain")
                                "/bin/g++"))
                (("=libtool")
                 (string-append "=" (assoc-ref inputs "libtool")
                                "/bin/libtool")))
              #t))
          (add-after 'install-scripts 'make-wrapper
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
+               ;; 'gvhdl' invokes the C compiler directly, so hard-code its
+               ;; file name.
+               (wrap-program (string-append out "/bin/gvhdl")
+                 `("CPLUS_INCLUDE_PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/include")))
+                 `("LIBRARY_PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/lib")))
+                 `("PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/bin")
+                    ,(string-append (assoc-ref inputs "coreutils")
+                                    "/bin"))))
                (wrap-program (string-append out "/bin/freehdl-config")
                  `("PKG_CONFIG_PATH" ":" prefix (,(string-append out "/lib/pkgconfig")))))
              #t)))))
     (inputs
      `(("coreutils" ,coreutils)
-       ("gcc" ,gcc)
+       ("gcc-toolchain" ,gcc-toolchain)
+       ("guile" ,guile-2.2)
        ("perl" ,perl)
        ("pkg-config" ,pkg-config)
        ("libtool" ,libtool)))
@@ -1474,3 +1524,102 @@ parallel computing platforms.  It also supports serial execution.")
     (license (list license:gpl2+
                    license:lgpl2.0+)))) ; freehdl's libraries
 
+(define-public qucs
+  (package
+    (name "qucs")
+    (version "0.0.19")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append
+                "https://sourceforge.net/projects/qucs/files/qucs/" version
+                "/qucs-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0giv9gfyfdizvjhq56x2pdncrlyv3k15lrsh6pk37i94vr7l7ij5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'patch-configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "qucs/configure"
+               (("\\$QTDIR") (assoc-ref inputs "qt4")))
+             #t))
+         (add-after 'patch-configure 'patch-scripts
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* '("qucs/qucs/qucsdigi"
+                            "qucs/qucs/qucsdigilib"
+                            "qucs/qucs/qucsveri")
+               (("\\$BINDIR")
+                (string-append (assoc-ref outputs "out") "/bin"))
+               (("freehdl-config")
+                (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-config"))
+               (("freehdl-v2cc")
+                (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-v2cc"))
+               (("cp ")
+                (string-append (assoc-ref inputs "coreutils") "/bin/cp "))
+               (("glibtool")
+                (string-append (assoc-ref inputs "libtool") "/bin/libtool"))
+               (("sed")
+                (string-append (assoc-ref inputs "sed") "/bin/sed"))
+               (("iverilog")
+                (string-append (assoc-ref inputs "iverilog") "/bin/iverilog"))
+               (("vvp")
+                (string-append (assoc-ref inputs "iverilog") "/bin/vvp")))
+             #t))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; The test suite requires a running X server.
+             (system "Xvfb :1 &")
+             (setenv "DISPLAY" ":1")
+             #t))
+         (add-after 'install 'make-wrapper
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               ;; 'qucs' directly invokes gcc, hence this wrapping.
+               (wrap-program (string-append out "/bin/qucs")
+                 `("CPLUS_INCLUDE_PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/include")))
+                 `("PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/bin")))
+                 `("LIBRARY_PATH" ":" prefix
+                   (,(string-append (assoc-ref inputs "gcc-toolchain")
+                                    "/lib")))
+                 `("ADMSXMLBINDIR" ":" prefix
+                   (,(string-append (assoc-ref inputs "adms") "/bin")))
+                 `("ASCOBINDIR" ":" prefix
+                   (,(string-append (assoc-ref inputs "asco") "/bin")))
+                 `("QUCS_OCTAVE" ":" prefix
+                   (,(string-append (assoc-ref inputs "octave") "/bin/octave")))))
+             #t)))
+       #:parallel-build? #f ; race condition
+       #:configure-flags '("--disable-doc"))) ; we need octave-epstk
+    (native-inputs
+     `(("gperf" ,gperf)
+       ("libtool-native" ,libtool)
+       ("python" ,python-2) ; for tests
+       ("matplotlib" ,python2-matplotlib) ; for tests
+       ("numpy" ,python2-numpy) ; for tests
+       ("xorg-server" ,xorg-server))) ; for tests
+    (inputs
+     `(("adms" ,adms)
+       ("asco" ,asco)
+       ("coreutils" ,coreutils)
+       ("freehdl" ,freehdl)
+       ("gcc-toolchain" ,gcc-toolchain)
+       ("iverilog" ,iverilog)
+       ("libtool" ,libtool)
+       ("octave" ,octave)
+       ("qt4" ,qt-4)
+       ("sed" ,sed)))
+    (home-page "http://qucs.sourceforge.net/")
+    (synopsis "Circuit simulator with graphical user interface")
+    (description
+     "Qucs is a circuit simulator with graphical user interface.  The software
+aims to support all kinds of circuit simulation types---e.g. DC, AC,
+S-parameter, transient, noise and harmonic balance analysis.  Pure digital
+simulations are also supported.")
+    (license license:gpl2+)))