Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / engineering.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
4 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
6 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
7 ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
8 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
9 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages engineering)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix gexp)
30 #:use-module (guix git-download)
31 #:use-module (guix monads)
32 #:use-module (guix store)
33 #:use-module (guix utils)
34 #:use-module ((srfi srfi-1) #:hide (zip))
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system python)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages algebra)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages commencement)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages curl)
49 #:use-module (gnu packages flex)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages fpga)
52 #:use-module (gnu packages freedesktop)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages gd)
55 #:use-module (gnu packages gettext)
56 #:use-module (gnu packages ghostscript)
57 #:use-module (gnu packages gl)
58 #:use-module (gnu packages glib)
59 #:use-module (gnu packages gnome)
60 #:use-module (gnu packages gperf)
61 #:use-module (gnu packages gtk)
62 #:use-module (gnu packages guile)
63 #:use-module (gnu packages image)
64 #:use-module (gnu packages imagemagick)
65 #:use-module (gnu packages linux) ;FIXME: for pcb
66 #:use-module (gnu packages m4)
67 #:use-module (gnu packages maths)
68 #:use-module (gnu packages multiprecision)
69 #:use-module (gnu packages mpi)
70 #:use-module (gnu packages ncurses)
71 #:use-module (gnu packages perl)
72 #:use-module (gnu packages pkg-config)
73 #:use-module (gnu packages python)
74 #:use-module (gnu packages qt)
75 #:use-module (gnu packages readline)
76 #:use-module (gnu packages swig)
77 #:use-module (gnu packages tcl)
78 #:use-module (gnu packages tls)
79 #:use-module (gnu packages tex)
80 #:use-module (gnu packages wxwidgets)
81 #:use-module (gnu packages xorg))
82
83 (define-public librecad
84 (package
85 (name "librecad")
86 (version "2.1.3")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append
90 "https://github.com/LibreCAD/LibreCAD/archive/"
91 version ".tar.gz"))
92 (file-name (string-append name "-" version ".tar.gz"))
93 (sha256
94 (base32
95 "01nvc1g3si05r5np1pzn62ah9w84p8nxa32wqrjh6gdi17jfvi3l"))))
96 (build-system gnu-build-system)
97 (arguments
98 '(#:phases
99 (modify-phases %standard-phases
100 ;; Without this patch boost complains that "make_array" is not a
101 ;; member of "boost::serialization".
102 (add-after 'unpack 'patch-boost-error
103 (lambda _
104 (substitute* "librecad/src/lib/math/lc_quadratic.h"
105 (("#include \"rs_vector.h\"" line)
106 (string-append line
107 "\n#include <boost/serialization/array_wrapper.hpp>")))
108 (substitute* "librecad/src/lib/math/rs_math.cpp"
109 (("#include <boost/numeric/ublas/matrix.hpp>" line)
110 (string-append "#include <boost/serialization/array_wrapper.hpp>\n"
111 line)))
112 #t))
113 (add-after 'unpack 'patch-paths
114 (lambda* (#:key outputs #:allow-other-keys)
115 (let ((out (assoc-ref outputs "out")))
116 (substitute* "librecad/src/lib/engine/rs_system.cpp"
117 (("/usr/share") (string-append out "/share"))))))
118 (replace 'configure
119 (lambda* (#:key inputs #:allow-other-keys)
120 (system* "qmake" (string-append "BOOST_DIR="
121 (assoc-ref inputs "boost")))))
122 (replace 'install
123 (lambda* (#:key outputs #:allow-other-keys)
124 (let* ((out (assoc-ref outputs "out"))
125 (bin (string-append out "/bin"))
126 (share (string-append out "/share/librecad")))
127 (mkdir-p bin)
128 (install-file "unix/librecad" bin)
129 (mkdir-p share)
130 (copy-recursively "unix/resources" share))
131 #t))
132 ;; Ensure that icons are found at runtime
133 (add-after 'install 'wrap-executable
134 (lambda* (#:key inputs outputs #:allow-other-keys)
135 (let* ((out (assoc-ref outputs "out"))
136 (qt '("qtbase" "qtsvg")))
137 (wrap-program (string-append out "/bin/librecad")
138 `("QT_PLUGIN_PATH" ":" prefix
139 ,(map (lambda (label)
140 (string-append (assoc-ref inputs label)
141 "/lib/qt5/plugins/"))
142 qt)))
143 #t))))))
144 (inputs
145 `(("boost" ,boost)
146 ("muparser" ,muparser)
147 ("freetype" ,freetype)
148 ("qtbase" ,qtbase)
149 ("qtsvg" ,qtsvg)))
150 (native-inputs
151 `(("pkg-config" ,pkg-config)
152 ("which" ,which)))
153 (home-page "http://librecad.org/")
154 (synopsis "Computer-aided design (CAD) application")
155 (description
156 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
157 plans and designs.")
158 (license license:gpl2)))
159
160 (define-public geda-gaf
161 (package
162 (name "geda-gaf")
163 (version "1.9.2")
164 (source (origin
165 (method url-fetch)
166 (uri (string-append
167 "http://ftp.geda-project.org/geda-gaf/unstable/v"
168 (version-major+minor version) "/"
169 version "/geda-gaf-" version ".tar.gz"))
170 (sha256
171 (base32
172 "14mk45pfz11v54q66gafw2l68n1p5ssvvjmdm8ffgc8x1w5ajfrz"))))
173 (build-system gnu-build-system)
174 (arguments
175 '(#:phases
176 (modify-phases %standard-phases
177 ;; tests require a writable HOME
178 (add-before 'check 'set-home
179 (lambda _
180 (setenv "HOME" (getenv "TMPDIR"))
181 #t)))
182 #:configure-flags
183 (let ((pcb (assoc-ref %build-inputs "pcb")))
184 (list (string-append "--with-pcb-datadir=" pcb "/share")
185 (string-append "--with-pcb-lib-path="
186 pcb "/share/pcb/pcblib-newlib:"
187 pcb "/share/pcb/newlib")))))
188 (inputs
189 `(("glib" ,glib)
190 ("gtk" ,gtk+-2)
191 ("guile" ,guile-2.0)
192 ("desktop-file-utils" ,desktop-file-utils)
193 ("shared-mime-info" ,shared-mime-info)
194 ("m4" ,m4)
195 ("pcb" ,pcb)))
196 (native-inputs
197 `(("pkg-config" ,pkg-config)
198 ("perl" ,perl))) ; for tests
199 (home-page "http://geda-project.org/")
200 (synopsis "Schematic capture, netlister, symbols, symbol checker, and utils")
201 (description
202 "Gaf stands for “gschem and friends”. It is a subset of the entire tool
203 suite grouped together under the gEDA name. gEDA/gaf is a collection of tools
204 which currently includes: gschem, a schematic capture program; gnetlist, a
205 netlist generation program; gsymcheck, a syntax checker for schematic symbols;
206 gattrib, a spreadsheet programm that manipulates the properties of symbols of
207 a schematic; libgeda, libraries for gschem gnetlist and gsymcheck; gsch2pcb, a
208 tool to forward annotation from your schematic to layout using PCB; some minor
209 utilities.")
210 (license license:gpl2+)))
211
212 (define-public pcb
213 (package
214 (name "pcb")
215 (version "4.0.2")
216 (source (origin
217 (method url-fetch)
218 (uri (string-append "mirror://sourceforge/pcb/pcb/pcb-" version
219 "/pcb-" version ".tar.gz"))
220 (sha256
221 (base32
222 "1a7rilp75faidny0r4fdwdxkflyrqp6svxv9lbg7h868293962iz"))))
223 (build-system gnu-build-system)
224 (arguments
225 `(#:phases
226 (modify-phases %standard-phases
227 (add-after 'unpack 'use-wish8.6
228 (lambda _
229 (substitute* "configure"
230 (("wish85") "wish8.6"))
231 #t))
232 ;; It checks for "xhost", which we don't have. This shouldn't
233 ;; matter, because the test is supposed to be skipped, but it causes
234 ;; "run_tests.sh" (and thus the "check" phase) to fail.
235 (add-after 'unpack 'fix-check-for-display
236 (lambda _
237 (substitute* "tests/run_tests.sh"
238 (("have_display=no") "have_display=yes"))
239 #t))
240 (add-after 'install 'wrap
241 (lambda* (#:key inputs outputs #:allow-other-keys)
242 ;; FIXME: Mesa tries to dlopen libudev.so.0 and fails. Pending a
243 ;; fix of the mesa package we wrap the pcb executable such that
244 ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
245 (let* ((out (assoc-ref outputs "out"))
246 (path (string-append (assoc-ref inputs "udev") "/lib")))
247 (wrap-program (string-append out "/bin/pcb")
248 `("LD_LIBRARY_PATH" ":" prefix (,path))))
249 #t))
250 (add-before 'check 'pre-check
251 (lambda _
252 (system "Xvfb :1 &")
253 (setenv "DISPLAY" ":1")
254 #t)))))
255 (inputs
256 `(("dbus" ,dbus)
257 ("mesa" ,mesa)
258 ("udev" ,eudev) ;FIXME: required by mesa
259 ("glu" ,glu)
260 ("gd" ,gd)
261 ("gtk" ,gtk+-2)
262 ("gtkglext" ,gtkglext)
263 ("desktop-file-utils" ,desktop-file-utils)
264 ("shared-mime-info" ,shared-mime-info)
265 ("tk" ,tk)))
266 (native-inputs
267 `(("pkg-config" ,pkg-config)
268 ("intltool" ,intltool)
269 ("bison" ,bison)
270 ("flex" ,flex)
271 ;; For tests
272 ("imagemagick" ,imagemagick)
273 ("gerbv" ,gerbv)
274 ("ghostscript" ,ghostscript)
275 ("xvfb" ,xorg-server)))
276 (home-page "http://pcb.geda-project.org/")
277 (synopsis "Design printed circuit board layouts")
278 (description
279 "GNU PCB is an interactive tool for editing printed circuit board
280 layouts. It features a rats-nest implementation, schematic/netlist import,
281 and design rule checking. It also includes an autorouter and a trace
282 optimizer; and it can produce photorealistic and design review images.")
283 (license license:gpl2+)))
284
285 (define-public pcb-rnd
286 (package (inherit pcb)
287 (name "pcb-rnd")
288 (version "1.1.3")
289 (source (origin
290 (method url-fetch)
291 (uri (string-append "http://repo.hu/projects/pcb-rnd/releases/"
292 "pcb-rnd-" version ".tar.gz"))
293 (sha256
294 (base32
295 "0pycynla60b96jkb6fh6f4sx663pqbzjwnixhw5ym8sym2absm09"))))
296 (arguments
297 `(#:tests? #f ; no check target
298 #:phases
299 (modify-phases %standard-phases
300 (add-after 'unpack 'cc-is-gcc
301 (lambda _ (setenv "CC" "gcc") #t))
302 (replace 'configure
303 ;; The configure script doesn't tolerate most of our configure flags.
304 (lambda* (#:key outputs #:allow-other-keys)
305 (zero? (system* "sh" "configure"
306 (string-append "--prefix="
307 (assoc-ref outputs "out")))))))))
308 (home-page "http://repo.hu/projects/pcb-rnd/")
309 (description "PCB RND is a fork of the GNU PCB circuit board editing tool
310 featuring various improvements and bug fixes.")))
311
312 (define-public fastcap
313 (package
314 (name "fastcap")
315 (version "2.0-18Sep92")
316 (source (origin
317 (method url-fetch/tarbomb)
318 (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
319 name "-" version ".tgz"))
320 (sha256
321 (base32
322 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
323 (snippet
324 ;; Remove a non-free file.
325 '(delete-file "doc/psfig.sty"))
326 (patches (search-patches "fastcap-mulSetup.patch"
327 "fastcap-mulGlobal.patch"))))
328 (build-system gnu-build-system)
329 (native-inputs
330 ;; FIXME: with texlive-tiny citation references are rendered as question
331 ;; marks. During the build warnings like these are printed:
332 ;; LaTeX Warning: Citation `nabors91' on page 2 undefined on input line 3.
333 `(("texlive" ,texlive-tiny)
334 ("ghostscript" ,ghostscript)))
335 (arguments
336 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
337 #:parallel-build? #f
338 #:tests? #f ;; no tests-suite
339 #:modules ((srfi srfi-1)
340 ,@%gnu-build-system-modules)
341 #:phases
342 (modify-phases %standard-phases
343 (add-after 'build 'make-doc
344 (lambda _
345 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
346 "manual"))))
347 (add-before 'make-doc 'fix-doc
348 (lambda _
349 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
350 (substitute* (find-files "doc" "\\.tex")
351 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
352 all file scale)
353 (string-append "\\includegraphics[scale=" scale "]{"
354 file "}"))
355 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
356 all file width)
357 (string-append "\\includegraphics[width=" width "]{"
358 file "}"))
359 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
360 all file height)
361 (string-append "\\includegraphics[height=" height "]{"
362 file "}"))
363 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
364 (string-append "\\includegraphics{" file "}")))
365 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
366 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
367 all options class)
368 (string-append "\\documentclass[" options "]{"
369 class "}\n"
370 "\\usepackage{graphicx}\n"
371 "\\usepackage{robinspace}"))
372 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
373 (string-append "%" all))
374 (("\\\\setstretch\\{.*\\}" all)
375 (string-append "%" all)))
376 #t))
377 (delete 'configure)
378 (add-before 'install 'clean-bin
379 (lambda _
380 (delete-file (string-append (getcwd) "/bin/README"))
381 #t))
382 (add-before 'install 'make-pdf
383 (lambda _
384 (setenv "HOME" "/tmp") ; FIXME: for texlive font cache
385 (with-directory-excursion "doc"
386 (and
387 (every (lambda (file)
388 (zero? (system* "dvips" file "-o")))
389 (find-files "." "\\.dvi"))
390 (every (lambda (file)
391 (zero? (system* "ps2pdf" file)))
392 '("mtt.ps" "ug.ps" "tcad.ps"))
393 (zero? (system* "make" "clean"))))))
394 (replace 'install
395 (lambda* (#:key outputs #:allow-other-keys)
396 (let* ((out (assoc-ref outputs "out"))
397 (data (string-append out "/share"))
398 (bin (string-append out "/bin"))
399 (doc (string-append data "/doc/" ,name "-" ,version))
400 (examples (string-append doc "/examples")))
401 (with-directory-excursion "bin"
402 (for-each (lambda (f)
403 (install-file f bin))
404 (find-files "." ".*")))
405 (copy-recursively "doc" doc)
406 (copy-recursively "examples" examples)
407 #t))))))
408 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
409 (synopsis "Multipole-accelerated capacitance extraction program")
410 (description
411 "Fastcap is a capacitance extraction program based on a
412 multipole-accelerated algorithm.")
413 (license (license:non-copyleft #f "See fastcap.c."))))
414
415 (define-public fasthenry
416 (package
417 (name "fasthenry")
418 (version "3.0-12Nov96")
419 (source (origin
420 (method url-fetch)
421 (file-name (string-append name "-" version ".tar.gz"))
422 (uri (string-append
423 "http://www.rle.mit.edu/cpg/codes/" name
424 "-" version ".tar.z"))
425 (sha256
426 (base32 "1a06xyyd40zhknrkz17xppl2zd5ig4w9g1grc8qrs0zqqcl5hpzi"))
427 (patches (search-patches "fasthenry-spAllocate.patch"
428 "fasthenry-spBuild.patch"
429 "fasthenry-spUtils.patch"
430 "fasthenry-spSolve.patch"
431 "fasthenry-spFactor.patch"))))
432 (build-system gnu-build-system)
433 (arguments
434 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
435 #:parallel-build? #f
436 #:tests? #f ;; no tests-suite
437 #:modules ((srfi srfi-1)
438 ,@%gnu-build-system-modules)
439 #:phases
440 (modify-phases %standard-phases
441 (delete 'configure)
442 (replace 'install
443 (lambda* (#:key outputs #:allow-other-keys)
444 (let* ((out (assoc-ref outputs "out"))
445 (data (string-append out "/share"))
446 (bin (string-append out "/bin"))
447 (doc (string-append data "/doc/" ,name "-" ,version))
448 (examples (string-append doc "/examples")))
449 (with-directory-excursion "bin"
450 (for-each (lambda (f)
451 (install-file f bin))
452 (find-files "." ".*")))
453 (copy-recursively "doc" doc)
454 (copy-recursively "examples" examples)
455 #t))))))
456 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
457 (synopsis "Multipole-accelerated inductance analysis program")
458 (description
459 "Fasthenry is an inductance extraction program based on a
460 multipole-accelerated algorithm.")
461 (license (license:non-copyleft #f "See induct.c."))))
462
463 (define-public fritzing
464 (package
465 (name "fritzing")
466 (version "0.9.2b")
467 (source (origin
468 (method url-fetch)
469 (uri (string-append "https://github.com/fritzing/"
470 "fritzing-app/archive/" version ".tar.gz"))
471 (file-name (string-append name "-" version ".tar.gz"))
472 (sha256
473 (base32
474 "15rwjp4xdj9w1z9f709rz9p0k2mi9k9idma9hvzkj5j8p04mg7yd"))))
475 (build-system gnu-build-system)
476 (arguments
477 `(#:phases
478 (modify-phases %standard-phases
479 (replace 'configure
480 (lambda* (#:key inputs outputs #:allow-other-keys)
481 (and (zero? (system* "tar"
482 "-xvf" (assoc-ref inputs "fritzing-parts-db")
483 "-C" "parts"))
484 (zero? (system* "qmake"
485 (string-append "PREFIX="
486 (assoc-ref outputs "out"))
487 "phoenix.pro"))))))))
488 (inputs
489 `(("qtbase" ,qtbase)
490 ("qtserialport" ,qtserialport)
491 ("qtsvg" ,qtsvg)
492 ("boost" ,boost)
493 ("zlib" ,zlib)
494 ("fritzing-parts-db"
495 ,(origin
496 (method url-fetch)
497 (uri (string-append "https://github.com/fritzing/"
498 "fritzing-parts/archive/" version ".tar.gz"))
499 (file-name (string-append "fritzing-parts-" version ".tar.gz"))
500 (sha256
501 (base32
502 "0jqr8yjg7177f3pk1fcns584r0qavwpr280nggsi2ff3pwk5wpsz"))))))
503 (home-page "http://fritzing.org")
504 (synopsis "Electronic circuit design")
505 (description
506 "The Fritzing application is @dfn{Electronic Design Automation} (EDA)
507 software with a low entry barrier, suited for the needs of makers and
508 hobbyists. It offers a unique real-life \"breadboard\" view, and a parts
509 library with many commonly used high-level components. Fritzing makes it very
510 easy to communicate about circuits, as well as to turn them into PCB layouts
511 ready for production.")
512 ;; Documentation and parts are released under CC-BY-SA 3.0; source code is
513 ;; released under GPLv3+.
514 (license (list license:gpl3+ license:cc-by-sa3.0))))
515
516 (define-public gerbv
517 (package
518 (name "gerbv")
519 (version "2.6.1")
520 (source (origin
521 (method url-fetch)
522 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
523 version "/gerbv-" version ".tar.gz"))
524 (sha256
525 (base32
526 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
527 (build-system gnu-build-system)
528 (arguments
529 `(#:phases
530 (modify-phases %standard-phases
531 (add-after 'unpack 'autoconf
532 (lambda _
533 ;; Build rules contain references to Russian translation, but the
534 ;; needed files are missing; see
535 ;; http://sourceforge.net/p/gerbv/bugs/174/
536 (delete-file "po/LINGUAS")
537 (substitute* "man/Makefile.am"
538 (("PO_FILES= gerbv.ru.1.in.po") "")
539 (("man_MANS = gerbv.1 gerbv.ru.1") "man_MANS = gerbv.1"))
540 (zero? (system* "autoreconf" "-vfi")))))))
541 (native-inputs
542 `(("autoconf" ,autoconf)
543 ("automake" ,automake)
544 ("libtool" ,libtool)
545 ("gettext" ,gettext-minimal)
546 ("po4a" ,po4a)
547 ("pkg-config" ,pkg-config)))
548 (inputs
549 `(("cairo" ,cairo)
550 ("gtk" ,gtk+-2)
551 ("desktop-file-utils" ,desktop-file-utils)))
552 (home-page "http://gerbv.geda-project.org/")
553 (synopsis "Gerber file viewer")
554 (description
555 "Gerbv is a viewer for files in the Gerber format (RS-274X only), which
556 is commonly used to represent printed circuit board (PCB) layouts. Gerbv lets
557 you load several files on top of each other, do measurements on the displayed
558 image, etc. Besides viewing Gerbers, you may also view Excellon drill files
559 as well as pick-place files.")
560 (license license:gpl2+)))
561
562 (define-public ao
563 (let ((commit "fb288c945aa7e30d9be10a564edad7e1b6a6c1ae")
564 (revision "1"))
565 (package
566 (name "ao-cad") ;XXX: really "ao", but it collides with libao
567 (version (git-version "0" revision commit))
568 (source (origin
569 (method git-fetch)
570 (uri (git-reference
571 (url "https://github.com/mkeeter/ao")
572 (commit commit)))
573 (sha256
574 (base32
575 "0syplfqiq7ng7md44yriq5cz41jp8q9z3pl2iwkkllds6p9ylyal"))
576 (file-name (git-file-name name version))
577 (patches (search-patches "ao-cad-aarch64-support.patch"))
578 (modules '((guix build utils)))
579 (snippet
580 ;; Remove bundled libraries: Eigen, glm, and catch. TODO:
581 ;; Unbundle efsw <https://github.com/diegostamigni/efsw>.
582 '(begin
583 (delete-file-recursively "vendor")
584
585 ;; Use #include <catch.hpp>.
586 (substitute* (find-files "." "\\.[ch]pp$")
587 (("catch/catch\\.hpp")
588 "catch.hpp"))))))
589 (build-system cmake-build-system)
590 (arguments
591 `(;; Have the RUNPATH of libao.so point to $libdir, where libefsw.so
592 ;; lives.
593 #:configure-flags (list (string-append "-DCMAKE_SHARED_LINKER_FLAGS="
594 "-Wl,-rpath="
595 (assoc-ref %outputs "out")
596 "/lib"))
597
598 #:phases
599 (modify-phases %standard-phases
600 (add-after 'unpack 'remove-native-compilation
601 (lambda _
602 (substitute* "CMakeLists.txt" (("-march=native") ""))
603 #t))
604 (add-before 'build 'add-eigen-to-search-path
605 (lambda* (#:key inputs #:allow-other-keys)
606 ;; Allow things to find our own Eigen and Catch.
607 (let ((eigen (assoc-ref inputs "eigen")))
608 (setenv "CPLUS_INCLUDE_PATH"
609 (string-append eigen "/include/eigen3:"
610 (getenv "CPLUS_INCLUDE_PATH")))
611 #t)))
612 (add-after 'install 'install-guile-bindings
613 (lambda* (#:key inputs outputs #:allow-other-keys)
614 ;; Install the Guile bindings (the build system only installs
615 ;; libao.so.)
616 (let* ((out (assoc-ref outputs "out"))
617 (moddir (string-append out "/share/guile/site/2.0")))
618 (install-file "bind/libao.so"
619 (string-append out "/lib"))
620
621 ;; Go to the source directory.
622 (with-directory-excursion ,(string-append "../"
623 name "-" version
624 "-checkout")
625 (substitute* "bind/guile/ao/sys/libao.scm"
626 (("\\(define libao \\(dynamic-link .*$")
627 (string-append "(define libao (dynamic-link \""
628 out "/lib/libao\")) ;")))
629
630 (copy-recursively "bind/guile/ao" (string-append moddir "/ao"))
631
632 (substitute* "bin/ao-guile"
633 (("\\(add-to-load-path .*")
634 (string-append "(add-to-load-path \"" moddir "\")")))
635
636 (install-file "bin/ao-guile"
637 (string-append out "/bin"))
638
639 ;; Allow Ao to dlopen the relevant GL libraries. Otherwise
640 ;; it fails with:
641 ;; Couldn't find current GLX or EGL context.
642 (let ((mesa (assoc-ref inputs "mesa")))
643 (wrap-program (string-append out "/bin/ao-guile")
644 `("LD_LIBRARY_PATH" ":" prefix
645 (,(string-append mesa "/lib")))))
646 #t)))))))
647 (native-inputs
648 `(("pkg-config" ,pkg-config)))
649 (inputs
650 `(("boost" ,boost)
651 ("catch" ,catch-framework)
652 ("libpng" ,libpng)
653 ("glfw" ,glfw)
654 ("libepoxy" ,libepoxy)
655 ("mesa" ,mesa)
656 ("eigen" ,eigen)
657 ("glm" ,glm)
658 ("guile" ,guile-2.0)))
659 (home-page "http://www.mattkeeter.com/projects/ao/")
660 (synopsis "Tool for programmatic computer-aided design")
661 (description
662 "Ao is a tool for programmatic computer-aided design (CAD). In Ao,
663 solid models are defined as Scheme scripts, and there are no opaque function
664 calls into the geometry kernel: everything is visible to the user. Even
665 fundamental, primitive shapes are represented as code in the user-level
666 language.")
667 (license (list license:lgpl2.1+ ;library
668 license:gpl2+))))) ;Guile bindings
669
670 ;; We use kicad from a git commit, because support for boost 1.61.0 has been
671 ;; recently added.
672 (define-public kicad
673 (let ((commit "5f4599fb56da4dd748845ab10abec02961d477f3")
674 (revision "2"))
675 (package
676 (name "kicad")
677 (version (string-append "4.0-" revision "."
678 (string-take commit 7)))
679 (source
680 (origin
681 (method git-fetch)
682 (uri (git-reference
683 (url "https://git.launchpad.net/kicad")
684 (commit commit)))
685 (sha256
686 (base32 "1833pln2975gmc5s18xf7s8m9vg834lmxxdjk0wlk3lq7bvjjnff"))
687 (file-name (string-append name "-" version "-checkout"))))
688 (build-system cmake-build-system)
689 (arguments
690 `(#:out-of-source? #t
691 #:tests? #f ; no tests
692 #:configure-flags
693 (list "-DKICAD_STABLE_VERSION=ON"
694 "-DKICAD_REPO_NAME=stable"
695 ,(string-append "-DKICAD_BUILD_VERSION=4.0-"
696 (string-take commit 7))
697 "-DCMAKE_BUILD_TYPE=Release"
698 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library.
699 "-DKICAD_SCRIPTING=ON"
700 "-DKICAD_SCRIPTING_MODULES=ON"
701 "-DKICAD_SCRIPTING_WXPYTHON=ON"
702 ;; Has to be set explicitely, as we don't have the wxPython
703 ;; headers in the wxwidgets store item, but in wxPython.
704 (string-append "-DCMAKE_CXX_FLAGS=-I"
705 (assoc-ref %build-inputs "wxpython")
706 "/include/wx-3.0")
707 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
708 "-DKICAD_SPICE=TRUE"
709 ;; TODO: Enable this when CA certs are working with curl.
710 "-DBUILD_GITHUB_PLUGIN=OFF")
711 #:phases
712 (modify-phases %standard-phases
713 (add-after 'install 'wrap-program
714 ;; Ensure correct Python at runtime.
715 (lambda* (#:key inputs outputs #:allow-other-keys)
716 (let* ((out (assoc-ref outputs "out"))
717 (python (assoc-ref inputs "python"))
718 (file (string-append out "/bin/kicad"))
719 (path (string-append
720 out
721 "/lib/python2.7/site-packages:"
722 (getenv "PYTHONPATH"))))
723 (wrap-program file
724 `("PYTHONPATH" ":" prefix (,path))
725 `("PATH" ":" prefix
726 (,(string-append python "/bin:")))))
727 #t)))))
728 (native-inputs
729 `(("boost" ,boost)
730 ("gettext" ,gnu-gettext)
731 ("pkg-config" ,pkg-config)
732 ("swig" ,swig)
733 ("zlib" ,zlib)))
734 (inputs
735 `(("cairo" ,cairo)
736 ("curl" ,curl)
737 ("desktop-file-utils" ,desktop-file-utils)
738 ("glew" ,glew)
739 ("glm" ,glm)
740 ("hicolor-icon-theme" ,hicolor-icon-theme)
741 ("libngspice" ,libngspice)
742 ("libsm" ,libsm)
743 ("mesa" ,mesa)
744 ("openssl" ,openssl)
745 ("python" ,python-2)
746 ("wxwidgets" ,wxwidgets-gtk2)
747 ("wxpython" ,python2-wxpython)))
748 (home-page "http://kicad-pcb.org/")
749 (synopsis "Electronics Design Automation Suite")
750 (description "Kicad is a program for the formation of printed circuit
751 boards and electrical circuits. The software has a number of programs that
752 perform specific functions, for example, pcbnew (Editing PCB), eeschema (editing
753 electrical diagrams), gerbview (viewing Gerber files) and others.")
754 (license license:gpl3+))))
755
756 (define-public kicad-library
757 (let ((version "4.0.6"))
758 (package
759 (name "kicad-library")
760 (version version)
761 (source (origin
762 (method url-fetch)
763 (uri (string-append
764 "http://downloads.kicad-pcb.org/libraries/kicad-library-"
765 version ".tar.gz"))
766 (sha256
767 (base32
768 "16f47pd6f0ddsdxdrp327nr9v05gl8c24d0qypq2aqx5hdjmkp7f"))))
769 (build-system cmake-build-system)
770 (arguments
771 `(#:out-of-source? #t
772 #:tests? #f ; no tests
773 #:phases
774 (modify-phases %standard-phases
775 (add-after 'install 'install-footprints ; from footprints tarball
776 (lambda* (#:key inputs outputs #:allow-other-keys)
777 (zero? (system* "tar" "xvf"
778 (assoc-ref inputs "kicad-footprints")
779 "-C" (string-append (assoc-ref outputs "out")
780 "/share/kicad/modules")
781 "--strip-components=1"))))
782 ;; We change the default global footprint file, which is generated if
783 ;; it doesn't exist in user's home directory, from the one using the
784 ;; github plugin, to the one using the KISYSMOD environment path.
785 (add-after 'install-footprints 'use-pretty-footprint-table
786 (lambda* (#:key outputs #:allow-other-keys)
787 (let* ((out (assoc-ref outputs "out"))
788 (template-dir (string-append out "/share/kicad/template"))
789 (fp-lib-table (string-append template-dir "/fp-lib-table")))
790 (delete-file fp-lib-table)
791 (copy-file (string-append fp-lib-table ".for-pretty")
792 fp-lib-table))
793 #t)))))
794 (native-search-paths
795 (list (search-path-specification
796 (variable "KISYSMOD") ; footprint path
797 (files '("share/kicad/modules")))
798 (search-path-specification
799 (variable "KISYS3DMOD") ; 3D model path
800 (files '("share/kicad/modules/packages3d")))))
801 ;; Kicad distributes footprints in a separate tarball
802 (native-inputs
803 `(("kicad-footprints"
804 ,(origin
805 (method url-fetch)
806 (uri (string-append
807 "http://downloads.kicad-pcb.org/libraries/kicad-footprints-"
808 version ".tar.gz"))
809 (sha256
810 (base32
811 "0vmgqhdw05k5fdnqv42grnvlz7v75g9md82jp2d3dvw2zw050lfb"))))))
812 (home-page "http://kicad-pcb.org/")
813 (synopsis "Libraries for kicad")
814 (description "This package provides Kicad component, footprint and 3D
815 render model libraries.")
816 (license license:lgpl2.0+))))
817
818 (define-public linsmith
819 (package
820 (name "linsmith")
821 (version "0.99.30")
822 (source (origin
823 (method url-fetch)
824 (uri (string-append
825 "mirror://sourceforge/linsmith/linsmith/linsmith-"
826 version "/linsmith-" version ".tar.gz"))
827 (sha256
828 (base32
829 "18qslhr2r45rhpj4v6bjcqx189vs0bflvsj271wr7w8kvh69qwvn"))))
830 (build-system gnu-build-system)
831 (native-inputs
832 `(("pkg-config" ,pkg-config)
833 ("gtk" ,gtk+-2)
834 ("libgnome" ,libgnomeui)))
835 (home-page "http://jcoppens.com/soft/linsmith/index.en.php")
836 (synopsis "Smith Charting program")
837 (description "LinSmith is a Smith Charting program, mainly designed for
838 educational use. As such, there is an emphasis on capabilities that improve
839 the 'showing the effect of'-style of operation.")
840 (license license:gpl2+)))
841
842 (define-public volk
843 (package
844 (name "volk")
845 (version "1.3")
846 (source
847 (origin
848 (method url-fetch)
849 (uri (string-append "http://libvolk.org/releases/volk-"
850 version ".tar.gz"))
851 (sha256
852 (base32
853 "1bz3ywc6y5wmz3i8p4z2wbzhns8bc0ywdkl9qnxpcvfcscarbdlh"))))
854 (build-system cmake-build-system)
855 (inputs
856 `(("boost" ,boost)))
857 (native-inputs
858 `(("python-2", python-2)
859 ("python2-cheetah" ,python2-cheetah)))
860 (home-page "http://libvolk.org/")
861 (synopsis "Vector-Optimized Library of Kernels")
862 (description
863 "@code{volk} contains procedures with machine-specific optimizations
864 for mathematical functions. It also provides an machine-independent
865 interface to select the best such procedures to use on a given system.")
866 (license license:gpl3+)))
867
868 (define-public minicom
869 (package
870 (name "minicom")
871 (version "2.7.1")
872 (source
873 (origin
874 (method url-fetch)
875 (uri (string-append "https://alioth.debian.org/frs/download.php/"
876 "file/4215/" name "-" version ".tar.gz"))
877 (sha256
878 (base32
879 "1wa1l36fa4npd21xa9nz60yrqwkk5cq713fa3p5v0zk7g9mq6bsk"))))
880 (build-system gnu-build-system)
881 (arguments
882 `(#:configure-flags '("--enable-lock-dir=/var/lock")
883 #:phases
884 (modify-phases %standard-phases
885 (add-after 'unpack 'patch-lock-check
886 (lambda _
887 (substitute* "configure"
888 (("test -d [$]UUCPLOCK") "true"))
889 #t)))))
890 (inputs
891 `(("ncurses" ,ncurses)))
892 (home-page "https://alioth.debian.org/projects/minicom/")
893 (synopsis "Serial terminal emulator")
894 (description "@code{minicom} is a serial terminal emulator.")
895 (license license:gpl2+)))
896
897 (define-public harminv
898 (package
899 (name "harminv")
900 (version "1.4.1")
901 (source (origin
902 (method url-fetch)
903 (uri
904 (string-append "https://github.com/stevengj/harminv/"
905 "releases/download/v" version "/"
906 name "-" version ".tar.gz"))
907 (sha256
908 (base32
909 "0w1n4d249vlpda0hi6z1v13qp21vlbp3ykn0m8qg4rd5132j7fg1"))))
910 (build-system gnu-build-system)
911 (arguments
912 `(#:phases
913 (modify-phases %standard-phases
914 (add-before 'configure 'fix-tests
915 (lambda _
916 (substitute* "./sines-test.sh"
917 ; change test frequency range - default fails
918 (("0\\.15") "0.16"))
919 #t)))))
920 (native-inputs
921 `(("fortran" ,gfortran)))
922 (inputs
923 `(("lapack" ,lapack)))
924 (home-page "https://github.com/stevengj/harminv")
925 (synopsis "Harmonic inversion solver")
926 (description
927 "Harminv is a free program (and accompanying library) to solve the problem of
928 harmonic inversion — given a discrete-time, finite-length signal that consists of a sum
929 of finitely-many sinusoids (possibly exponentially decaying) in a given bandwidth, it
930 determines the frequencies, decay constants, amplitudes, and phases of those sinusoids.")
931 (license license:gpl2+)))
932
933 (define-public guile-libctl
934 (package
935 (name "guile-libctl")
936 (version "3.2.2")
937 (source (origin
938 (method url-fetch)
939 (uri
940 (string-append
941 "http://ab-initio.mit.edu/libctl/libctl-"
942 version ".tar.gz"))
943 (sha256
944 (base32
945 "1g7gqybq20jhdnw5vg18bgbj9jz0408gfmjvs8b4xs30pic8pgca"))))
946 (build-system gnu-build-system)
947 (native-inputs
948 `(("fortran" ,gfortran)))
949 (inputs
950 `(("guile" ,guile-2.2)))
951 (home-page "http://ab-initio.mit.edu/wiki/index.php/Libctl")
952 (synopsis "Flexible control files implementation for scientific simulations")
953 (description
954 "Libctl is a Guile-based library implementing flexible control files
955 for scientific simulations.")
956 (license license:gpl2+)))
957
958 (define-public mpb
959 (package
960 (name "mpb")
961 (version "1.5")
962 (source (origin
963 (method url-fetch)
964 (uri
965 (string-append
966 "http://ab-initio.mit.edu/mpb/mpb-"
967 version ".tar.gz"))
968 (sha256
969 (base32
970 "1mqb2d8jq957nksayjygq58iy8i42vjryzg9iy5fpfay31wzxsix"))))
971 (build-system gnu-build-system)
972 (arguments
973 `(#:configure-flags
974 (list (string-append "--with-libctl="
975 (assoc-ref %build-inputs "libctl")
976 "/share/libctl"))))
977 (native-inputs
978 `(("fortran" ,gfortran)
979 ("pkg-config" ,pkg-config)
980 ("swig" ,swig)))
981 (inputs
982 `(("fftw" ,fftw)
983 ("gsl" ,gsl)
984 ("guile" ,guile-2.2)
985 ("hdf5" ,hdf5)
986 ("lapack" ,lapack)
987 ("libctl" ,guile-libctl)
988 ("readline" ,readline)
989 ("zlib" ,zlib)))
990 (home-page "http://ab-initio.mit.edu/wiki/index.php/MIT_Photonic_Bands")
991 (synopsis "Computes band structures and electromagnetic modes of dielectric
992 structures")
993 (description
994 "MIT Photonic-Bands (MPB) computes definite-frequency eigenstates (harmonic modes)
995 of Maxwell's equations in periodic dielectric structures for arbitrary wavevectors, using
996 fully-vectorial and three-dimensional methods.")
997 (license license:gpl2+)))
998
999 (define-public meep
1000 (package
1001 (name "meep")
1002 (version "1.3")
1003 (source (origin
1004 (method url-fetch)
1005 (uri
1006 (string-append
1007 "http://ab-initio.mit.edu/meep/meep-"
1008 version ".tar.gz"))
1009 (sha256
1010 (base32
1011 "0f6lbw2hrksg7xscwdqs78jc9nmzx9fs8j0hz1y4i8qknkqiyk2n"))))
1012 (build-system gnu-build-system)
1013 (arguments
1014 `(#:configure-flags
1015 (list (string-append "--with-libctl="
1016 (assoc-ref %build-inputs "libctl")
1017 "/share/libctl"))))
1018 (native-inputs
1019 `(("fortran" ,gfortran)
1020 ("pkg-config" ,pkg-config)
1021 ("swig" ,swig)))
1022 (inputs
1023 `(("fftw" ,fftw)
1024 ("gsl" ,gsl)
1025 ("guile" ,guile-2.0) ; doesn't build with guile-2.2
1026 ("harminv" ,harminv)
1027 ("hdf5" ,hdf5)
1028 ("lapack" ,lapack)
1029 ("libctl" ,guile-libctl)
1030 ("mpb" ,mpb)
1031 ("zlib" ,zlib)))
1032 (home-page "http://ab-initio.mit.edu/wiki/index.php/Meep")
1033 (synopsis "Finite-difference time-domain (FDTD) simulation software")
1034 (description
1035 "Meep is a finite-difference time-domain (FDTD) simulation software package
1036 developed at MIT to model electromagnetic systems.")
1037 (license license:gpl2+)))
1038
1039 (define-public adms
1040 (package
1041 (name "adms")
1042 (version "2.3.6")
1043 (source (origin
1044 (method url-fetch)
1045 (uri
1046 (string-append
1047 "mirror://sourceforge/mot-adms/adms-source/"
1048 (version-major+minor version) "/adms-" version ".tar.gz"))
1049 (sha256
1050 (base32
1051 "1rn98l6jxcjhi6ai5f7p588khra9z80m0m0lql4n4sb7773fh1vk"))))
1052 (build-system gnu-build-system)
1053 (native-inputs
1054 `(("flex" ,flex)
1055 ("bison" ,bison)))
1056 (home-page "https://sourceforge.net/projects/mot-adms")
1057 (synopsis "Automatic device model synthesizer")
1058 (description
1059 "ADMS is a code generator that converts electrical compact device models
1060 specified in high-level description language into ready-to-compile C code for
1061 the API of spice simulators. Based on transformations specified in XML
1062 language, ADMS transforms Verilog-AMS code into other target languages.")
1063 (license license:gpl3)))
1064
1065 (define-public capstone
1066 (package
1067 (name "capstone")
1068 (version "3.0.5-rc2")
1069 (source (origin
1070 (method url-fetch)
1071 (uri (string-append "https://github.com/aquynh/capstone/archive/"
1072 version ".tar.gz"))
1073 (file-name (string-append name "-" version ".tar.gz"))
1074 (sha256
1075 (base32
1076 "1cqms9r2p43aiwp5spd84zaccp16ih03r7sjhrv16nddahj0jz2q"))))
1077 (build-system gnu-build-system)
1078 (arguments
1079 `(#:tests? #f
1080 #:make-flags (list (string-append "PREFIX=" %output)
1081 "CC=gcc")
1082 #:phases
1083 (modify-phases %standard-phases
1084 (delete 'configure)
1085 ;; cstool's Makefile overrides LDFLAGS, so we cannot pass it as a make flag.
1086 (add-before 'build 'fix-cstool-ldflags
1087 (lambda* (#:key outputs #:allow-other-keys)
1088 (substitute* "cstool/Makefile"
1089 (("LDFLAGS =")
1090 (string-append "LDFLAGS = -Wl,-rpath=" (assoc-ref outputs "out")
1091 "/lib")))
1092 #t)))))
1093 (home-page "http://www.capstone-engine.org")
1094 (synopsis "Lightweight multi-platform, multi-architecture disassembly framework")
1095 (description
1096 "Capstone is a lightweight multi-platform, multi-architecture disassembly
1097 framework. Capstone can disassemble machine code for many supported architectures
1098 such as x86, x86_64, arm, arm64, mips, ppc, sparc, sysz and xcore. It provides
1099 bindings for Python, Java, OCaml and more.")
1100 (license license:bsd-3)))
1101
1102 ;; FIXME: This package has a timestamp embedded in
1103 ;; lib/python3.5/site-packages/capstone/__pycache__/__iti__.cpython-35.pyc
1104 (define-public python-capstone
1105 (package
1106 (inherit capstone)
1107 (name "python-capstone")
1108 (propagated-inputs
1109 `(("capstone" ,capstone)))
1110 (build-system python-build-system)
1111 (arguments
1112 `(#:phases
1113 (modify-phases %standard-phases
1114 (add-after 'unpack 'chdir-and-fix-setup-py
1115 (lambda _
1116 (chdir "bindings/python")
1117 ;; Do not build the library again, because we already have it.
1118 (substitute* "setup.py" ((".* build_libraries.*") ""))
1119 ;; This substitution tells python-capstone where to find the
1120 ;; library.
1121 (substitute* "capstone/__init__.py"
1122 (("pkg_resources.resource_filename.*")
1123 (string-append "'" (assoc-ref %build-inputs "capstone") "/lib',\n")))
1124 #t)))))))
1125
1126 (define-public python2-capstone
1127 (package-with-python2 python-capstone))
1128
1129 (define-public radare2
1130 (package
1131 (name "radare2")
1132 (version "1.6.0")
1133 (source (origin
1134 (method url-fetch)
1135 (uri (string-append "http://radare.mikelloc.com/get/" version "/"
1136 name "-" version ".tar.gz"))
1137 (sha256
1138 (base32
1139 "16ggsk40zz6hyvclvqj1r4bh4hb78jf0d6ppry1jk4r0j30wm7cm"))
1140 (modules '((guix build utils)))
1141 (snippet
1142 '(begin
1143 (substitute* "libr/asm/p/Makefile"
1144 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))
1145 (substitute* "libr/parse/p/Makefile"
1146 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))
1147 (substitute* "libr/bin/p/Makefile"
1148 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))))))
1149 (build-system gnu-build-system)
1150 (arguments
1151 '(#:tests? #f; tests require git and network access
1152 #:phases
1153 (modify-phases %standard-phases
1154 (add-before 'configure 'mklibdir
1155 (lambda* (#:key inputs #:allow-other-keys)
1156 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1157 #t)))
1158 #:configure-flags
1159 (list "--with-sysmagic" "--with-syszip" "--with-openssl"
1160 "--without-nonpic" "--with-rpath" "--with-syscapstone")
1161 #:make-flags
1162 (list "CC=gcc")))
1163 (inputs
1164 `(("openssl" ,openssl)
1165 ("zip" ,zip)
1166 ("gmp" ,gmp)
1167 ("capstone" ,capstone)))
1168 (native-inputs
1169 `(("pkg-config" ,pkg-config)))
1170 (home-page "https://radare.org/")
1171 (synopsis "Portable reversing framework")
1172 (description
1173 "Radare project started as a forensics tool, a scriptable commandline
1174 hexadecimal editor able to open disk files, but later support for analyzing
1175 binaries, disassembling code, debugging programs, attaching to remote gdb
1176 servers, ...")
1177 (license license:lgpl3)))
1178
1179 (define-public asco
1180 (package
1181 (name "asco")
1182 (version "0.4.10")
1183 (source (origin
1184 (method url-fetch)
1185 (uri (string-append "mirror://sourceforge/asco/asco/" version "/ASCO-"
1186 version ".tar.gz"))
1187 (sha256
1188 (base32
1189 "119rbc2dc8xzwxvykgji0v0nrzvymjmlizr1bc2mihspj686kxsl"))))
1190 (build-system gnu-build-system)
1191 (arguments
1192 `(#:tests? #f ; no tests
1193 #:make-flags '("all" "asco-mpi")
1194 #:phases
1195 (modify-phases %standard-phases
1196 (delete 'configure)
1197 (add-before 'build 'fix-paths
1198 (lambda* (#:key inputs #:allow-other-keys)
1199 (let ((coreutils (assoc-ref inputs "coreutils-minimal")))
1200 (substitute* '("errfunc.c" "asco.c")
1201 (("cp ")
1202 (string-append coreutils "/bin/cp "))
1203 (("nice")
1204 (string-append coreutils "/bin/nice")))
1205 (substitute* "Makefile"
1206 (("<FULL_PATH_TO_MPICH>/bin/mpicc") (which "mpicc")))
1207 #t)))
1208 (replace 'install ; no install target
1209 (lambda* (#:key outputs #:allow-other-keys)
1210 (for-each (lambda (file)
1211 (install-file file (string-append
1212 (assoc-ref outputs "out")
1213 "/bin")))
1214 '("asco" "asco-mpi" "asco-test"
1215 "tools/alter/alter" "tools/log/log"))
1216 #t)))))
1217 (native-inputs
1218 `(("mpi" ,openmpi)))
1219 (inputs
1220 `(("coreutils-minimal" ,coreutils-minimal)))
1221 (home-page "http://asco.sourceforge.net/")
1222 (synopsis "SPICE circuit optimizer")
1223 (description
1224 "ASCO brings circuit optimization capabilities to existing SPICE simulators using a
1225 high-performance parallel differential evolution (DE) optimization algorithm.")
1226 (license license:gpl2+)))
1227
1228 (define-public libngspice
1229 ;; Note: The ngspice's build system does not allow us to build both the
1230 ;; library and the executables in one go. Thus, we have two packages.
1231 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27344#236>.
1232 (package
1233 (name "libngspice")
1234 (version "26")
1235 (source (origin
1236 (method url-fetch)
1237 (uri (string-append "mirror://sourceforge/ngspice/ng-spice-rework/"
1238 version "/ngspice-" version ".tar.gz"))
1239 (sha256
1240 (base32
1241 "02019ndcl057nq9z41nxycqba7wxlb081ibvfj9jv010nz431qji"))
1242 (modules '((guix build utils)))
1243 ;; We remove the non-free cider and build without it.
1244 (snippet
1245 '(begin
1246 (delete-file-recursively "src/ciderlib")
1247 (delete-file "src/ciderinit")
1248 (substitute* "configure"
1249 (("src/ciderlib/Makefile") "")
1250 (("src/ciderlib/input/Makefile") "")
1251 (("src/ciderlib/support/Makefile") "")
1252 (("src/ciderlib/oned/Makefile") "")
1253 (("src/ciderlib/twod/Makefile") ""))))))
1254 (build-system gnu-build-system)
1255 (arguments
1256 `(;; No tests for libngspice exist.
1257 ;; The transient tests for ngspice fail.
1258 #:tests? #f
1259 #:phases
1260 (modify-phases %standard-phases
1261 (add-after 'unpack 'patch-timestamps
1262 (lambda _
1263 (substitute* "configure"
1264 (("`date`") "Do 1. Jan 00:00:00 UTC 1970"))
1265 #t))
1266 (add-after 'unpack 'delete-program-manuals
1267 (lambda _
1268 (substitute* "man/man1/Makefile.in"
1269 (("^man_MANS = ngspice\\.1 ngnutmeg\\.1 ngsconvert\\.1 ngmultidec\\.1")
1270 "man_MANS = "))
1271 #t))
1272 (add-after 'install 'delete-script-files
1273 (lambda* (#:key outputs #:allow-other-keys)
1274 (delete-file-recursively
1275 (string-append (assoc-ref outputs "out")
1276 "/share/ngspice/scripts")))))
1277 #:configure-flags
1278 (list "--enable-openmp"
1279 "--enable-xspice"
1280 "--with-ngshared"
1281 "--with-readline=yes")))
1282 (native-inputs
1283 `(("bison" ,bison)
1284 ("flex" ,flex)))
1285 (inputs
1286 `(("libxaw" ,libxaw)
1287 ("mpi" ,openmpi)
1288 ("readline" ,readline)))
1289 (home-page "http://ngspice.sourceforge.net/")
1290 (synopsis "Mixed-level/mixed-signal circuit simulator")
1291 (description
1292 "Ngspice is a mixed-level/mixed-signal circuit simulator. It includes
1293 @code{Spice3f5}, a circuit simulator, and @code{Xspice}, an extension that
1294 provides code modeling support and simulation of digital components through
1295 an embedded event driven algorithm.")
1296 (license (list license:lgpl2.0+ ; code in frontend/numparam
1297 (license:non-copyleft "file:///COPYING") ; spice3 bsd-style
1298 license:public-domain)))) ; xspice
1299
1300 (define-public ngspice
1301 ;; The ngspice executables (see libngpsice above.)
1302 (package (inherit libngspice)
1303 (name "ngspice")
1304 (arguments
1305 (substitute-keyword-arguments (package-arguments libngspice)
1306 ((#:configure-flags flags)
1307 `(delete "--with-ngshared" ,flags))
1308 ((#:phases phases)
1309 `(modify-phases ,phases
1310 (add-after 'unpack 'delete-include-files
1311 (lambda _
1312 (substitute* "src/Makefile.in"
1313 (("^SUBDIRS = misc maths frontend spicelib include/ngspice")
1314 "SUBDIRS = misc maths frontend spicelib"))
1315 #t))
1316 (add-after 'install 'delete-cmpp-dlmain
1317 (lambda* (#:key outputs #:allow-other-keys)
1318 (for-each (lambda (file)
1319 (delete-file
1320 (string-append (assoc-ref outputs "out")
1321 file)))
1322 '("/bin/cmpp" "/share/ngspice/dlmain.c"))
1323 #t))
1324 (delete 'delete-program-manuals)
1325 (delete 'delete-script-files)))))
1326 (inputs
1327 `(("libngspice" ,libngspice)
1328 ("readline" ,readline)))))
1329
1330 (define trilinos-serial-xyce
1331 ;; Note: This is a Trilinos containing only the packages Xyce needs, so we
1332 ;; keep it private. See
1333 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27344#248>.
1334 ;; TODO: Remove when we have modular Trilinos packages?
1335 (package
1336 (name "trilinos-serial-xyce")
1337 (version "12.6.3")
1338 (source
1339 (origin (method url-fetch)
1340 (uri (string-append "https://trilinos.org/oldsite/download/files/trilinos-"
1341 version "-Source.tar.gz"))
1342 (sha256
1343 (base32
1344 "07jd1qpsbf31cmbyyngr4l67xzwyan24dyx5wlcahgbw7x6my3wn"))))
1345 (build-system cmake-build-system)
1346 (arguments
1347 `(#:out-of-source? #t
1348 #:configure-flags
1349 (list "-DCMAKE_CXX_FLAGS=-O3 -fPIC"
1350 "-DCMAKE_C_FLAGS=-O3 -fPIC"
1351 "-DCMAKE_Fortran_FLAGS=-O3 -fPIC"
1352 "-DTrilinos_ENABLE_NOX=ON"
1353 "-DNOX_ENABLE_LOCA=ON"
1354 "-DTrilinos_ENABLE_EpetraExt=ON"
1355 "-DEpetraExt_BUILD_BTF=ON"
1356 "-DEpetraExt_BUILD_EXPERIMENTAL=ON"
1357 "-DEpetraExt_BUILD_GRAPH_REORDERINGS=ON"
1358 "-DTrilinos_ENABLE_TrilinosCouplings=ON"
1359 "-DTrilinos_ENABLE_Ifpack=ON"
1360 "-DTrilinos_ENABLE_Isorropia=ON"
1361 "-DTrilinos_ENABLE_AztecOO=ON"
1362 "-DTrilinos_ENABLE_Belos=ON"
1363 "-DTrilinos_ENABLE_Teuchos=ON"
1364 "-DTeuchos_ENABLE_COMPLEX=ON"
1365 "-DTrilinos_ENABLE_Amesos=ON"
1366 "-DAmesos_ENABLE_KLU=ON"
1367 "-DAmesos_ENABLE_UMFPACK=ON"
1368 "-DTrilinos_ENABLE_Sacado=ON"
1369 "-DTrilinos_ENABLE_Kokkos=OFF"
1370 "-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF"
1371 "-DTPL_ENABLE_AMD=ON"
1372 "-DTPL_ENABLE_UMFPACK=ON"
1373 "-DTPL_ENABLE_BLAS=ON"
1374 "-DTPL_ENABLE_LAPACK=ON")))
1375 (native-inputs
1376 `(("fortran" ,gfortran)
1377 ("swig" ,swig)))
1378 (inputs
1379 `(("boost" ,boost)
1380 ("lapack" ,lapack-3.5)
1381 ("suitesparse" ,suitesparse)))
1382 (home-page "https://trilinos.org")
1383 (synopsis "Engineering and scientific problems algorithms")
1384 (description
1385 "The Trilinos Project is an effort to develop algorithms and enabling
1386 technologies within an object-oriented software framework for the solution of
1387 large-scale, complex multi-physics engineering and scientific problems. A
1388 unique design feature of Trilinos is its focus on packages.")
1389 (license (list license:lgpl2.1+
1390 license:bsd-3))))
1391
1392 (define-public xyce-serial
1393 (package
1394 (name "xyce-serial")
1395 (version "6.7")
1396 (source
1397 (origin (method url-fetch)
1398 (uri (string-append "https://archive.org/download/Xyce-"
1399 version "/Xyce-" version ".tar.gz"))
1400 (sha256
1401 (base32
1402 "02k952mnvrnc5kv7r65fdrn7khwq1lbyhwyvd7jznafzdpsvgm4x"))))
1403 (build-system gnu-build-system)
1404 (arguments
1405 `(#:tests? #f
1406 #:configure-flags
1407 (list
1408 "CXXFLAGS=-O3 -std=c++11"
1409 (string-append "ARCHDIR="
1410 (assoc-ref %build-inputs "trilinos")))))
1411 (native-inputs
1412 `(("bison" ,bison)
1413 ("flex" ,flex)
1414 ("fortran" ,gfortran)))
1415 (inputs
1416 `(("fftw" ,fftw)
1417 ("suitesparse" ,suitesparse)
1418 ("lapack" ,lapack-3.5)
1419 ("trilinos" ,trilinos-serial-xyce)))
1420 (home-page "https://xyce.sandia.gov/")
1421 (synopsis "High-performance analog circuit simulator")
1422 (description
1423 "Xyce is a SPICE-compatible, high-performance analog circuit simulator,
1424 capable of solving extremely large circuit problems by supporting large-scale
1425 parallel computing platforms. It also supports serial execution.")
1426 (license license:gpl3+)))
1427
1428 (define trilinos-parallel-xyce
1429 (package (inherit trilinos-serial-xyce)
1430 (name "trilinos-parallel-xyce")
1431 (arguments
1432 `(,@(substitute-keyword-arguments (package-arguments trilinos-serial-xyce)
1433 ((#:configure-flags flags)
1434 `(append (list "-DTrilinos_ENABLE_ShyLU=ON"
1435 "-DTrilinos_ENABLE_Zoltan=ON"
1436 "-DTPL_ENABLE_MPI=ON")
1437 ,flags)))))
1438 (inputs
1439 `(("mpi" ,openmpi)
1440 ,@(package-inputs trilinos-serial-xyce)))))
1441
1442 (define-public xyce-parallel
1443 (package (inherit xyce-serial)
1444 (name "xyce-parallel")
1445 (arguments
1446 `(,@(substitute-keyword-arguments (package-arguments xyce-serial)
1447 ((#:configure-flags flags)
1448 `(list "CXXFLAGS=-O3 -std=c++11"
1449 "CXX=mpiCC"
1450 "CC=mpicc"
1451 "F77=mpif77"
1452 "--enable-mpi"
1453 "--enable-isorropia=no"
1454 "--enable-zoltan=no"
1455 (string-append
1456 "ARCHDIR="
1457 (assoc-ref %build-inputs "trilinos")))))))
1458 (propagated-inputs
1459 `(("mpi" ,openmpi)))
1460 (inputs
1461 `(("trilinos" ,trilinos-parallel-xyce)
1462 ,@(alist-delete "trilinos"
1463 (package-inputs xyce-serial))))))
1464
1465 (define-public freehdl
1466 (package
1467 (name "freehdl")
1468 (version "0.0.8")
1469 (source (origin
1470 (method url-fetch)
1471 (uri (string-append "http://downloads.sourceforge.net/qucs/freehdl-"
1472 version ".tar.gz"))
1473 (sha256
1474 (base32
1475 "117dqs0d4pcgbzvr3jn5ppra7n7x2m6c161ywh6laa934pw7h2bz"))))
1476 (build-system gnu-build-system)
1477 (arguments
1478 `(#:phases
1479 (modify-phases %standard-phases
1480 (add-before 'configure 'patch-pkg-config
1481 (lambda* (#:key inputs #:allow-other-keys)
1482 (substitute* "freehdl/freehdl-config"
1483 (("pkg-config")
1484 (string-append (assoc-ref inputs "pkg-config")
1485 "/bin/pkg-config"))
1486 (("cat")
1487 (string-append (assoc-ref inputs "coreutils")
1488 "/bin/cat")))
1489 #t))
1490 (add-after 'patch-pkg-config 'setenv
1491 (lambda* (#:key inputs #:allow-other-keys)
1492 (setenv "CXX" (string-append (assoc-ref inputs "gcc")
1493 "/bin/g++"))
1494 (setenv "SYSTEM_LIBTOOL" (string-append (assoc-ref inputs "libtool")
1495 "/bin/libtool"))
1496 #t))
1497 (add-after 'setenv 'patch-gvhdl
1498 (lambda _
1499 (substitute* "v2cc/gvhdl.in"
1500 (("--mode=link") "--mode=link --tag=CXX")
1501 (("-lm") "-lm FREEHDL/lib/freehdl/libieee.la"))
1502 #t))
1503 (add-after 'patch-gvhdl 'patch-freehdl-gennodes
1504 (lambda* (#:key inputs #:allow-other-keys)
1505 (substitute* "freehdl/freehdl-gennodes.in"
1506 (("guile")
1507 (string-append (assoc-ref inputs "guile") "/bin/guile"))
1508 (("\\(debug") ";(debug")
1509 (("\\(@ ") "(apply-emit")
1510 (("\\(@@ ") "(apply-mini-format"))
1511 #t))
1512 (add-after 'configure 'patch-freehdl-pc
1513 (lambda* (#:key inputs #:allow-other-keys)
1514 (substitute* "freehdl.pc"
1515 (("=g\\+\\+")
1516 (string-append "=" (assoc-ref inputs "gcc-toolchain")
1517 "/bin/g++"))
1518 (("=libtool")
1519 (string-append "=" (assoc-ref inputs "libtool")
1520 "/bin/libtool")))
1521 #t))
1522 (add-after 'install-scripts 'make-wrapper
1523 (lambda* (#:key inputs outputs #:allow-other-keys)
1524 (let ((out (assoc-ref outputs "out")))
1525 ;; 'gvhdl' invokes the C compiler directly, so hard-code its
1526 ;; file name.
1527 (wrap-program (string-append out "/bin/gvhdl")
1528 `("CPLUS_INCLUDE_PATH" ":" prefix
1529 (,(string-append (assoc-ref inputs "gcc-toolchain")
1530 "/include")))
1531 `("LIBRARY_PATH" ":" prefix
1532 (,(string-append (assoc-ref inputs "gcc-toolchain")
1533 "/lib")))
1534 `("PATH" ":" prefix
1535 (,(string-append (assoc-ref inputs "gcc-toolchain")
1536 "/bin")
1537 ,(string-append (assoc-ref inputs "coreutils")
1538 "/bin"))))
1539 (wrap-program (string-append out "/bin/freehdl-config")
1540 `("PKG_CONFIG_PATH" ":" prefix (,(string-append out "/lib/pkgconfig")))))
1541 #t)))))
1542 (inputs
1543 `(("coreutils" ,coreutils)
1544 ("gcc-toolchain" ,gcc-toolchain)
1545 ("guile" ,guile-2.2)
1546 ("perl" ,perl)
1547 ("pkg-config" ,pkg-config)
1548 ("libtool" ,libtool)))
1549 (native-inputs
1550 `(("pkg-config-native" ,pkg-config)
1551 ("libtool-native" ,libtool)))
1552 (home-page "http://www.freehdl.seul.org/")
1553 (synopsis "VHDL simulator")
1554 (description
1555 "FreeHDL is a compiler/simulator suite for the hardware description language VHDL.
1556 VHDL'93 as well as VHDL'87 standards are supported.")
1557 (license (list license:gpl2+
1558 license:lgpl2.0+)))) ; freehdl's libraries
1559
1560 (define-public qucs
1561 (package
1562 (name "qucs")
1563 (version "0.0.19")
1564 (source (origin
1565 (method url-fetch)
1566 (uri
1567 (string-append
1568 "https://sourceforge.net/projects/qucs/files/qucs/" version
1569 "/qucs-" version ".tar.gz"))
1570 (sha256
1571 (base32
1572 "0giv9gfyfdizvjhq56x2pdncrlyv3k15lrsh6pk37i94vr7l7ij5"))))
1573 (build-system gnu-build-system)
1574 (arguments
1575 `(#:phases
1576 (modify-phases %standard-phases
1577 (add-before 'configure 'patch-configure
1578 (lambda* (#:key inputs #:allow-other-keys)
1579 (substitute* "qucs/configure"
1580 (("\\$QTDIR") (assoc-ref inputs "qt4")))
1581 #t))
1582 (add-after 'patch-configure 'patch-scripts
1583 (lambda* (#:key inputs outputs #:allow-other-keys)
1584 (substitute* '("qucs/qucs/qucsdigi"
1585 "qucs/qucs/qucsdigilib"
1586 "qucs/qucs/qucsveri")
1587 (("\\$BINDIR")
1588 (string-append (assoc-ref outputs "out") "/bin"))
1589 (("freehdl-config")
1590 (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-config"))
1591 (("freehdl-v2cc")
1592 (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-v2cc"))
1593 (("cp ")
1594 (string-append (assoc-ref inputs "coreutils") "/bin/cp "))
1595 (("glibtool")
1596 (string-append (assoc-ref inputs "libtool") "/bin/libtool"))
1597 (("sed")
1598 (string-append (assoc-ref inputs "sed") "/bin/sed"))
1599 (("iverilog")
1600 (string-append (assoc-ref inputs "iverilog") "/bin/iverilog"))
1601 (("vvp")
1602 (string-append (assoc-ref inputs "iverilog") "/bin/vvp")))
1603 #t))
1604 (add-before 'check 'pre-check
1605 (lambda _
1606 ;; The test suite requires a running X server.
1607 (system "Xvfb :1 &")
1608 (setenv "DISPLAY" ":1")
1609 #t))
1610 (add-after 'install 'make-wrapper
1611 (lambda* (#:key inputs outputs #:allow-other-keys)
1612 (let ((out (assoc-ref outputs "out")))
1613 ;; 'qucs' directly invokes gcc, hence this wrapping.
1614 (wrap-program (string-append out "/bin/qucs")
1615 `("CPLUS_INCLUDE_PATH" ":" prefix
1616 (,(string-append (assoc-ref inputs "gcc-toolchain")
1617 "/include")))
1618 `("PATH" ":" prefix
1619 (,(string-append (assoc-ref inputs "gcc-toolchain")
1620 "/bin")))
1621 `("LIBRARY_PATH" ":" prefix
1622 (,(string-append (assoc-ref inputs "gcc-toolchain")
1623 "/lib")))
1624 `("ADMSXMLBINDIR" ":" prefix
1625 (,(string-append (assoc-ref inputs "adms") "/bin")))
1626 `("ASCOBINDIR" ":" prefix
1627 (,(string-append (assoc-ref inputs "asco") "/bin")))
1628 `("QUCS_OCTAVE" ":" prefix
1629 (,(string-append (assoc-ref inputs "octave") "/bin/octave")))))
1630 #t)))
1631 #:parallel-build? #f ; race condition
1632 #:configure-flags '("--disable-doc"))) ; we need octave-epstk
1633 (native-inputs
1634 `(("gperf" ,gperf)
1635 ("libtool-native" ,libtool)
1636 ("python" ,python-2) ; for tests
1637 ("matplotlib" ,python2-matplotlib) ; for tests
1638 ("numpy" ,python2-numpy) ; for tests
1639 ("xorg-server" ,xorg-server))) ; for tests
1640 (inputs
1641 `(("adms" ,adms)
1642 ("asco" ,asco)
1643 ("coreutils" ,coreutils)
1644 ("freehdl" ,freehdl)
1645 ("gcc-toolchain" ,gcc-toolchain)
1646 ("iverilog" ,iverilog)
1647 ("libtool" ,libtool)
1648 ("octave" ,octave)
1649 ("qt4" ,qt-4)
1650 ("sed" ,sed)))
1651 (home-page "http://qucs.sourceforge.net/")
1652 (synopsis "Circuit simulator with graphical user interface")
1653 (description
1654 "Qucs is a circuit simulator with graphical user interface. The software
1655 aims to support all kinds of circuit simulation types---e.g. DC, AC,
1656 S-parameter, transient, noise and harmonic balance analysis. Pure digital
1657 simulations are also supported.")
1658 (license license:gpl2+)))
1659
1660 (define-public qucs-s
1661 (package
1662 (name "qucs-s")
1663 (version "0.0.19S")
1664 (source (origin
1665 (method url-fetch)
1666 (uri (string-append "https://github.com/ra3xdh/qucs/releases/download/"
1667 version "/qucs-" version ".tar.gz"))
1668 (sha256
1669 (base32
1670 "1bhahvdqmayaw0306fxz1ghmjhd4fq05yk3rk7zi0z703w5imgjv"))))
1671 (build-system cmake-build-system)
1672 (arguments
1673 `(#:tests? #f ; no tests
1674 #:phases
1675 (modify-phases %standard-phases
1676 (add-before 'configure 'patch-scripts
1677 (lambda* (#:key inputs #:allow-other-keys)
1678 (substitute* '("qucs/qucsdigi"
1679 "qucs/qucsdigilib"
1680 "qucs/qucsveri")
1681 (("\\$BINDIR")
1682 (string-append (assoc-ref inputs "qucs") "/bin"))
1683 (("freehdl-config")
1684 (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-config"))
1685 (("freehdl-v2cc")
1686 (string-append (assoc-ref inputs "freehdl") "/bin/freehdl-v2cc"))
1687 (("cp ")
1688 (string-append (assoc-ref inputs "coreutils") "/bin/cp "))
1689 (("glibtool")
1690 (string-append (assoc-ref inputs "libtool") "/bin/libtool"))
1691 (("sed")
1692 (string-append (assoc-ref inputs "sed") "/bin/sed"))
1693 (("iverilog")
1694 (string-append (assoc-ref inputs "iverilog") "/bin/iverilog"))
1695 (("vvp")
1696 (string-append (assoc-ref inputs "iverilog") "/bin/vvp")))
1697 #t))
1698 (add-after 'patch-scripts 'patch-paths
1699 (lambda* (#:key inputs #:allow-other-keys)
1700 (substitute* "qucs/main.cpp"
1701 (((string-append "QucsSettings\\.Qucsator = QucsSettings\\.BinDir "
1702 "\\+ \"qucsator\" \\+ executableSuffix"))
1703 (string-append "}{ QucsSettings.Qucsator = \""
1704 (assoc-ref inputs "qucs") "/bin/qucsator\""))
1705 (((string-append "else QucsSettings\\.XyceExecutable = "
1706 "\"/usr/local/Xyce-Release-6.2.0-OPENSOURCE/bin/runxyce"))
1707 (string-append "QucsSettings.XyceExecutable = \""
1708 (assoc-ref inputs "xyce-serial") "/bin/Xyce"))
1709 (((string-append "else QucsSettings\\.XyceParExecutable = \"/usr/local"
1710 "/Xyce-Release-6.2.0-OPENMPI-OPENSOURCE/bin/xmpirun"))
1711 (string-append "QucsSettings.XyceParExecutable = \""
1712 (assoc-ref inputs "mpi") "/bin/mpirun"))
1713 (("%p")
1714 (string-append "%p "(assoc-ref inputs "xyce-parallel") "/bin/Xyce"))
1715 (("else QucsSettings\\.NgspiceExecutable = \"ngspice\"")
1716 (string-append "QucsSettings.NgspiceExecutable = " "\""
1717 (assoc-ref inputs "ngspice") "/bin/ngspice\"")))
1718 (substitute* "qucs/qucs_actions.cpp"
1719 (("qucstrans")
1720 (string-append (assoc-ref inputs "qucs") "/bin/qucstrans"))
1721 (("qucsattenuator")
1722 (string-append (assoc-ref inputs "qucs") "/bin/qucsattenuator"))
1723 (("qucsrescodes")
1724 (string-append (assoc-ref inputs "qucs") "/bin/qucsrescodes")))
1725 #t))
1726 (add-after 'install 'install-scripts
1727 (lambda* (#:key inputs outputs #:allow-other-keys)
1728 (for-each
1729 (lambda (script)
1730 (let ((file (string-append "../qucs-" ,version
1731 "/qucs/" script))
1732 (out (assoc-ref outputs "out")))
1733 (install-file file (string-append out "/bin"))
1734 (chmod (string-append out "/bin/" script) #o555)))
1735 '("qucsdigi" "qucsdigilib" "qucsveri"))
1736 #t))
1737 (add-after 'install-scripts 'make-wrapper
1738 (lambda* (#:key inputs outputs #:allow-other-keys)
1739 (let* ((out (assoc-ref outputs "out"))
1740 (file (string-append out "/bin/qucs-s"))
1741 (qucs (assoc-ref inputs "qucs"))
1742 (qucsator (string-append qucs "/bin/qucsator")))
1743 (wrap-program file
1744 `("CPLUS_INCLUDE_PATH" ":" prefix
1745 (,(string-append (assoc-ref inputs "gcc-toolchain")
1746 "/include")))
1747 `("PATH" ":" prefix
1748 (,(string-append (assoc-ref inputs "gcc-toolchain")
1749 "/bin")))
1750 `("LIBRARY_PATH" ":" prefix
1751 (,(string-append (assoc-ref inputs "gcc-toolchain")
1752 "/lib")))
1753 `("QUCSATOR" ":" prefix (,qucsator))
1754 `("QUCSCONV" ":" prefix (,(string-append qucsator "/bin/qucsconv")))
1755 `("ADMSXMLBINDIR" ":" prefix (,(string-append (assoc-ref inputs "adms")
1756 "/bin")))
1757 `("ASCOBINDIR" ":" prefix (,(string-append (assoc-ref inputs "asco")
1758 "/bin")))
1759 `("QUCS_OCTAVE" ":" prefix (,(string-append (assoc-ref inputs "octave")
1760 "/bin/octave"))))
1761 (symlink qucsator (string-append out "/bin/qucsator"))
1762 #t))))))
1763 (native-inputs
1764 `(("libtool-native" ,libtool)))
1765 (inputs
1766 `(("adms" ,adms)
1767 ("asco" ,asco)
1768 ("coreutils" ,coreutils)
1769 ("freehdl" ,freehdl)
1770 ("gcc-toolchain" ,gcc-toolchain)
1771 ("iverilog" ,iverilog)
1772 ("libtool" ,libtool)
1773 ("mpi" ,openmpi)
1774 ("ngspice" ,ngspice)
1775 ("octave" ,octave)
1776 ("qt4" ,qt-4)
1777 ("qucs" ,qucs)
1778 ("sed" ,sed)
1779 ("xyce-serial" ,xyce-serial)
1780 ("xyce-parallel" ,xyce-parallel)))
1781 (home-page "https://ra3xdh.github.io/")
1782 (synopsis "Circuit simulator with graphical user interface")
1783 (description
1784 "Qucs-S is a spin-off of the Qucs cross-platform circuit simulator.
1785 The S letter indicates SPICE. The purpose of the Qucs-S subproject is to use
1786 free SPICE circuit simulation kernels with the Qucs GUI. It provides the
1787 simulator backends @code{Qucsator}, @code{ngspice} and @code{Xyce}.")
1788 (license license:gpl2+)))