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