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