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