0955bb4ae3196d8a2b0b91adf23b2bafba791683
[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.for@openmailbox.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 ((guix licenses) #:prefix license:)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages base)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages curl)
46 #:use-module (gnu packages flex)
47 #:use-module (gnu packages fontutils)
48 #:use-module (gnu packages freedesktop)
49 #:use-module (gnu packages gcc)
50 #:use-module (gnu packages gd)
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages ghostscript)
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages gnome)
56 #:use-module (gnu packages gtk)
57 #:use-module (gnu packages guile)
58 #:use-module (gnu packages image)
59 #:use-module (gnu packages imagemagick)
60 #:use-module (gnu packages linux) ;FIXME: for pcb
61 #:use-module (gnu packages m4)
62 #:use-module (gnu packages maths)
63 #:use-module (gnu packages multiprecision)
64 #:use-module (gnu packages ncurses)
65 #:use-module (gnu packages perl)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages qt)
69 #:use-module (gnu packages readline)
70 #:use-module (gnu packages swig)
71 #:use-module (gnu packages tcl)
72 #:use-module (gnu packages tls)
73 #:use-module (gnu packages tex)
74 #:use-module (gnu packages wxwidgets)
75 #:use-module (gnu packages xorg))
76
77 (define-public librecad
78 (package
79 (name "librecad")
80 (version "2.1.3")
81 (source (origin
82 (method url-fetch)
83 (uri (string-append
84 "https://github.com/LibreCAD/LibreCAD/archive/"
85 version ".tar.gz"))
86 (file-name (string-append name "-" version ".tar.gz"))
87 (sha256
88 (base32
89 "01nvc1g3si05r5np1pzn62ah9w84p8nxa32wqrjh6gdi17jfvi3l"))))
90 (build-system gnu-build-system)
91 (arguments
92 '(#:phases
93 (modify-phases %standard-phases
94 (add-after 'unpack 'patch-paths
95 (lambda* (#:key outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out")))
97 (substitute* "librecad/src/lib/engine/rs_system.cpp"
98 (("/usr/share") (string-append out "/share"))))))
99 (replace 'configure
100 (lambda* (#:key inputs #:allow-other-keys)
101 (system* "qmake" (string-append "BOOST_DIR="
102 (assoc-ref inputs "boost")))))
103 (replace 'install
104 (lambda* (#:key outputs #:allow-other-keys)
105 (let* ((out (assoc-ref outputs "out"))
106 (bin (string-append out "/bin"))
107 (share (string-append out "/share/librecad")))
108 (mkdir-p bin)
109 (install-file "unix/librecad" bin)
110 (mkdir-p share)
111 (copy-recursively "unix/resources" share)))))))
112 (inputs
113 `(("boost" ,boost)
114 ("muparser" ,muparser)
115 ("freetype" ,freetype)
116 ("qtbase" ,qtbase)
117 ("qtsvg" ,qtsvg)))
118 (native-inputs
119 `(("pkg-config" ,pkg-config)
120 ("which" ,which)))
121 (home-page "http://librecad.org/")
122 (synopsis "Computer-aided design (CAD) application")
123 (description
124 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
125 plans and designs.")
126 (license license:gpl2)))
127
128 (define-public geda-gaf
129 (package
130 (name "geda-gaf")
131 (version "1.9.2")
132 (source (origin
133 (method url-fetch)
134 (uri (string-append
135 "http://ftp.geda-project.org/geda-gaf/unstable/v"
136 (version-major+minor version) "/"
137 version "/geda-gaf-" version ".tar.gz"))
138 (sha256
139 (base32
140 "14mk45pfz11v54q66gafw2l68n1p5ssvvjmdm8ffgc8x1w5ajfrz"))))
141 (build-system gnu-build-system)
142 (arguments
143 '(#:phases
144 (modify-phases %standard-phases
145 ;; tests require a writable HOME
146 (add-before 'check 'set-home
147 (lambda _
148 (setenv "HOME" (getenv "TMPDIR"))
149 #t)))
150 #:configure-flags
151 (let ((pcb (assoc-ref %build-inputs "pcb")))
152 (list (string-append "--with-pcb-datadir=" pcb "/share")
153 (string-append "--with-pcb-lib-path="
154 pcb "/share/pcb/pcblib-newlib:"
155 pcb "/share/pcb/newlib")))))
156 (inputs
157 `(("glib" ,glib)
158 ("gtk" ,gtk+-2)
159 ("guile" ,guile-2.0)
160 ("desktop-file-utils" ,desktop-file-utils)
161 ("shared-mime-info" ,shared-mime-info)
162 ("m4" ,m4)
163 ("pcb" ,pcb)))
164 (native-inputs
165 `(("pkg-config" ,pkg-config)
166 ("perl" ,perl))) ; for tests
167 (home-page "http://geda-project.org/")
168 (synopsis "Schematic capture, netlister, symbols, symbol checker, and utils")
169 (description
170 "Gaf stands for “gschem and friends”. It is a subset of the entire tool
171 suite grouped together under the gEDA name. gEDA/gaf is a collection of tools
172 which currently includes: gschem, a schematic capture program; gnetlist, a
173 netlist generation program; gsymcheck, a syntax checker for schematic symbols;
174 gattrib, a spreadsheet programm that manipulates the properties of symbols of
175 a schematic; libgeda, libraries for gschem gnetlist and gsymcheck; gsch2pcb, a
176 tool to forward annotation from your schematic to layout using PCB; some minor
177 utilities.")
178 (license license:gpl2+)))
179
180 (define-public pcb
181 (package
182 (name "pcb")
183 (version "4.0.0")
184 (source (origin
185 (method url-fetch)
186 (uri (string-append "mirror://sourceforge/pcb/pcb/pcb-" version
187 "/pcb-" version ".tar.gz"))
188 (sha256
189 (base32
190 "1i6sk8g8h9avms142wl07yv20m1cm4c3fq3v6hybrhdxs2n17plf"))))
191 (build-system gnu-build-system)
192 (arguments
193 `(#:phases
194 (alist-cons-after
195 'unpack 'use-wish8.6
196 (lambda _
197 (substitute* "configure"
198 (("wish85") "wish8.6")))
199 (alist-cons-after
200 'install 'wrap
201 (lambda* (#:key inputs outputs #:allow-other-keys)
202 ;; FIXME: Mesa tries to dlopen libudev.so.0 and fails. Pending a
203 ;; fix of the mesa package we wrap the pcb executable such that
204 ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
205 (let* ((out (assoc-ref outputs "out"))
206 (path (string-append (assoc-ref inputs "udev") "/lib")))
207 (wrap-program (string-append out "/bin/pcb")
208 `("LD_LIBRARY_PATH" ":" prefix (,path)))))
209 (alist-cons-before
210 'check 'pre-check
211 (lambda _
212 (system "Xvfb :1 &")
213 (setenv "DISPLAY" ":1")
214 #t)
215 %standard-phases)))))
216 (inputs
217 `(("dbus" ,dbus)
218 ("mesa" ,mesa)
219 ("udev" ,eudev) ;FIXME: required by mesa
220 ("glu" ,glu)
221 ("gd" ,gd)
222 ("gtk" ,gtk+-2)
223 ("gtkglext" ,gtkglext)
224 ("desktop-file-utils" ,desktop-file-utils)
225 ("shared-mime-info" ,shared-mime-info)
226 ("tk" ,tk)))
227 (native-inputs
228 `(("pkg-config" ,pkg-config)
229 ("intltool" ,intltool)
230 ("bison" ,bison)
231 ("flex" ,flex)
232 ;; For tests
233 ("imagemagick" ,imagemagick)
234 ("gerbv" ,gerbv)
235 ("ghostscript" ,ghostscript)
236 ("xvfb" ,xorg-server)))
237 (home-page "http://pcb.geda-project.org/")
238 (synopsis "Design printed circuit board layouts")
239 (description
240 "GNU PCB is an interactive tool for editing printed circuit board
241 layouts. It features a rats-nest implementation, schematic/netlist import,
242 and design rule checking. It also includes an autorouter and a trace
243 optimizer; and it can produce photorealistic and design review images.")
244 (license license:gpl2+)))
245
246 (define-public pcb-rnd
247 (package (inherit pcb)
248 (name "pcb-rnd")
249 (version "1.1.3")
250 (source (origin
251 (method url-fetch)
252 (uri (string-append "http://repo.hu/projects/pcb-rnd/releases/"
253 "pcb-rnd-" version ".tar.gz"))
254 (sha256
255 (base32
256 "0pycynla60b96jkb6fh6f4sx663pqbzjwnixhw5ym8sym2absm09"))))
257 (arguments
258 `(#:tests? #f ; no check target
259 #:phases
260 (modify-phases %standard-phases
261 (add-after 'unpack 'cc-is-gcc
262 (lambda _ (setenv "CC" "gcc") #t))
263 (replace 'configure
264 ;; The configure script doesn't tolerate most of our configure flags.
265 (lambda* (#:key outputs #:allow-other-keys)
266 (zero? (system* "sh" "configure"
267 (string-append "--prefix="
268 (assoc-ref outputs "out")))))))))
269 (home-page "http://repo.hu/projects/pcb-rnd/")
270 (description "PCB RND is a fork of the GNU PCB circuit board editing tool
271 featuring various improvements and bug fixes.")))
272
273 (define-public fastcap
274 (package
275 (name "fastcap")
276 (version "2.0-18Sep92")
277 (source (origin
278 (method url-fetch/tarbomb)
279 (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
280 name "-" version ".tgz"))
281 (sha256
282 (base32
283 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
284 (snippet
285 ;; Remove a non-free file.
286 '(delete-file "doc/psfig.sty"))
287 (patches (search-patches "fastcap-mulSetup.patch"
288 "fastcap-mulGlobal.patch"))))
289 (build-system gnu-build-system)
290 (native-inputs
291 `(("texlive" ,texlive)
292 ("ghostscript" ,ghostscript)))
293 (arguments
294 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
295 #:parallel-build? #f
296 #:tests? #f ;; no tests-suite
297 #:modules ((srfi srfi-1)
298 ,@%gnu-build-system-modules)
299 #:phases
300 (modify-phases %standard-phases
301 (add-after 'build 'make-doc
302 (lambda _
303 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
304 "manual"))))
305 (add-before 'make-doc 'fix-doc
306 (lambda _
307 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
308 (substitute* (find-files "doc" "\\.tex")
309 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
310 all file scale)
311 (string-append "\\includegraphics[scale=" scale "]{"
312 file "}"))
313 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
314 all file width)
315 (string-append "\\includegraphics[width=" width "]{"
316 file "}"))
317 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
318 all file height)
319 (string-append "\\includegraphics[height=" height "]{"
320 file "}"))
321 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
322 (string-append "\\includegraphics{" file "}")))
323 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
324 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
325 all options class)
326 (string-append "\\documentclass[" options "]{"
327 class "}\n"
328 "\\usepackage{graphicx}\n"
329 "\\usepackage{robinspace}"))
330 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
331 (string-append "%" all))
332 (("\\\\setstretch\\{.*\\}" all)
333 (string-append "%" all)))
334 #t))
335 (delete 'configure)
336 (add-before 'install 'clean-bin
337 (lambda _
338 (delete-file (string-append (getcwd) "/bin/README"))
339 #t))
340 (add-before 'install 'make-pdf
341 (lambda _
342 (with-directory-excursion "doc"
343 (and
344 (every (lambda (file)
345 (zero? (system* "dvips" file "-o")))
346 (find-files "." "\\.dvi"))
347 (every (lambda (file)
348 (zero? (system* "ps2pdf" file)))
349 '("mtt.ps" "ug.ps" "tcad.ps"))
350 (zero? (system* "make" "clean"))))))
351 (replace 'install
352 (lambda* (#:key outputs #:allow-other-keys)
353 (let* ((out (assoc-ref outputs "out"))
354 (data (string-append out "/share"))
355 (bin (string-append out "/bin"))
356 (doc (string-append data "/doc/" ,name "-" ,version))
357 (examples (string-append doc "/examples")))
358 (with-directory-excursion "bin"
359 (for-each (lambda (f)
360 (install-file f bin))
361 (find-files "." ".*")))
362 (copy-recursively "doc" doc)
363 (copy-recursively "examples" examples)
364 #t))))))
365 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
366 (synopsis "Multipole-accelerated capacitance extraction program")
367 (description
368 "Fastcap is a capacitance extraction program based on a
369 multipole-accelerated algorithm.")
370 (license (license:non-copyleft #f "See fastcap.c."))))
371
372 (define-public fasthenry
373 (package
374 (name "fasthenry")
375 (version "3.0-12Nov96")
376 (source (origin
377 (method url-fetch)
378 (file-name (string-append name "-" version ".tar.gz"))
379 (uri (string-append
380 "http://www.rle.mit.edu/cpg/codes/" name
381 "-" version ".tar.z"))
382 (sha256
383 (base32 "1a06xyyd40zhknrkz17xppl2zd5ig4w9g1grc8qrs0zqqcl5hpzi"))
384 (patches (search-patches "fasthenry-spAllocate.patch"
385 "fasthenry-spBuild.patch"
386 "fasthenry-spUtils.patch"
387 "fasthenry-spSolve.patch"
388 "fasthenry-spFactor.patch"))))
389 (build-system gnu-build-system)
390 (arguments
391 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
392 #:parallel-build? #f
393 #:tests? #f ;; no tests-suite
394 #:modules ((srfi srfi-1)
395 ,@%gnu-build-system-modules)
396 #:phases
397 (modify-phases %standard-phases
398 (delete 'configure)
399 (replace 'install
400 (lambda* (#:key outputs #:allow-other-keys)
401 (let* ((out (assoc-ref outputs "out"))
402 (data (string-append out "/share"))
403 (bin (string-append out "/bin"))
404 (doc (string-append data "/doc/" ,name "-" ,version))
405 (examples (string-append doc "/examples")))
406 (with-directory-excursion "bin"
407 (for-each (lambda (f)
408 (install-file f bin))
409 (find-files "." ".*")))
410 (copy-recursively "doc" doc)
411 (copy-recursively "examples" examples)
412 #t))))))
413 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
414 (synopsis "Multipole-accelerated inductance analysis program")
415 (description
416 "Fasthenry is an inductance extraction program based on a
417 multipole-accelerated algorithm.")
418 (license (license:non-copyleft #f "See induct.c."))))
419
420 (define-public fritzing
421 (package
422 (name "fritzing")
423 (version "0.9.2b")
424 (source (origin
425 (method url-fetch)
426 (uri (string-append "https://github.com/fritzing/"
427 "fritzing-app/archive/" version ".tar.gz"))
428 (file-name (string-append name "-" version ".tar.gz"))
429 (sha256
430 (base32
431 "0pvk57z2pxz89pcwwm61lkpvj4w9qxqz8mi0zkpj6pnaljabp7bf"))))
432 (build-system gnu-build-system)
433 (arguments
434 `(#:phases
435 (modify-phases %standard-phases
436 (replace 'configure
437 (lambda* (#:key inputs outputs #:allow-other-keys)
438 (and (zero? (system* "tar"
439 "-xvf" (assoc-ref inputs "fritzing-parts-db")
440 "-C" "parts"))
441 (zero? (system* "qmake"
442 (string-append "PREFIX="
443 (assoc-ref outputs "out"))
444 "phoenix.pro"))))))))
445 (inputs
446 `(("qtbase" ,qtbase)
447 ("qtserialport" ,qtserialport)
448 ("qtsvg" ,qtsvg)
449 ("boost" ,boost)
450 ("zlib" ,zlib)
451 ("fritzing-parts-db"
452 ,(origin
453 (method url-fetch)
454 (uri (string-append "https://github.com/fritzing/"
455 "fritzing-parts/archive/" version ".tar.gz"))
456 (file-name (string-append "fritzing-parts-" version ".tar.gz"))
457 (sha256
458 (base32
459 "0jqr8yjg7177f3pk1fcns584r0qavwpr280nggsi2ff3pwk5wpsz"))))))
460 (home-page "http://fritzing.org")
461 (synopsis "Electronic circuit design")
462 (description
463 "The Fritzing application is @dfn{Electronic Design Automation} (EDA)
464 software with a low entry barrier, suited for the needs of makers and
465 hobbyists. It offers a unique real-life \"breadboard\" view, and a parts
466 library with many commonly used high-level components. Fritzing makes it very
467 easy to communicate about circuits, as well as to turn them into PCB layouts
468 ready for production.")
469 ;; Documentation and parts are released under CC-BY-SA 3.0; source code is
470 ;; released under GPLv3+.
471 (license (list license:gpl3+ license:cc-by-sa3.0))))
472
473 (define-public gerbv
474 (package
475 (name "gerbv")
476 (version "2.6.1")
477 (source (origin
478 (method url-fetch)
479 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
480 version "/gerbv-" version ".tar.gz"))
481 (sha256
482 (base32
483 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
484 (build-system gnu-build-system)
485 (arguments
486 `(#:phases
487 (modify-phases %standard-phases
488 (add-after 'unpack 'autoconf
489 (lambda _
490 ;; Build rules contain references to Russian translation, but the
491 ;; needed files are missing; see
492 ;; http://sourceforge.net/p/gerbv/bugs/174/
493 (delete-file "po/LINGUAS")
494 (substitute* "man/Makefile.am"
495 (("PO_FILES= gerbv.ru.1.in.po") "")
496 (("man_MANS = gerbv.1 gerbv.ru.1") "man_MANS = gerbv.1"))
497 (zero? (system* "autoreconf" "-vfi")))))))
498 (native-inputs
499 `(("autoconf" ,autoconf)
500 ("automake" ,automake)
501 ("libtool" ,libtool)
502 ("gettext" ,gettext-minimal)
503 ("po4a" ,po4a)
504 ("pkg-config" ,pkg-config)))
505 (inputs
506 `(("cairo" ,cairo)
507 ("gtk" ,gtk+-2)
508 ("desktop-file-utils" ,desktop-file-utils)))
509 (home-page "http://gerbv.geda-project.org/")
510 (synopsis "Gerber file viewer")
511 (description
512 "Gerbv is a viewer for files in the Gerber format (RS-274X only), which
513 is commonly used to represent printed circuit board (PCB) layouts. Gerbv lets
514 you load several files on top of each other, do measurements on the displayed
515 image, etc. Besides viewing Gerbers, you may also view Excellon drill files
516 as well as pick-place files.")
517 (license license:gpl2+)))
518
519 (define-public ao
520 (let ((commit "0bc2354b8dcd1a82a0fd6647706b126045e52734"))
521 (package
522 (name "ao-cad") ;XXX: really "ao", but it collides with libao
523 (version (string-append "0." (string-take commit 7)))
524 (source (origin
525 (method git-fetch)
526 (uri (git-reference
527 (url "https://github.com/mkeeter/ao")
528 (commit commit)))
529 (sha256
530 (base32
531 "0lm7iljklafs8dhlvaab2yhwx4xymrdjrqk9c5xvn59hlvbgl1j5"))
532 (file-name (string-append name "-" version "-checkout"))
533 (modules '((guix build utils)))
534 (snippet
535 ;; Remove bundled libraries: Eigen, glm, and catch. TODO:
536 ;; Unbundle efsw <https://github.com/diegostamigni/efsw>.
537 '(begin
538 (delete-file-recursively "vendor")
539
540 ;; Use #include <catch.hpp>.
541 (substitute* (find-files "." "\\.[ch]pp$")
542 (("catch/catch\\.hpp")
543 "catch.hpp"))))))
544 (build-system cmake-build-system)
545 (arguments
546 `(;; Have the RUNPATH of libao.so point to $libdir, where libefsw.so
547 ;; lives.
548 #:configure-flags (list (string-append "-DCMAKE_SHARED_LINKER_FLAGS="
549 "-Wl,-rpath="
550 (assoc-ref %outputs "out")
551 "/lib"))
552
553 #:phases
554 (modify-phases %standard-phases
555 (add-before 'build 'add-eigen-to-search-path
556 (lambda* (#:key inputs #:allow-other-keys)
557 ;; Allow things to find our own Eigen and Catch.
558 (let ((eigen (assoc-ref inputs "eigen")))
559 (setenv "CPLUS_INCLUDE_PATH"
560 (string-append eigen "/include/eigen3:"
561 (getenv "CPLUS_INCLUDE_PATH")))
562 #t)))
563 (add-after 'install 'install-guile-bindings
564 (lambda* (#:key inputs outputs #:allow-other-keys)
565 ;; Install the Guile bindings (the build system only installs
566 ;; libao.so.)
567 (let* ((out (assoc-ref outputs "out"))
568 (moddir (string-append out "/share/guile/site/2.0")))
569 (install-file "bind/libao.so"
570 (string-append out "/lib"))
571
572 ;; Go to the source directory.
573 (with-directory-excursion ,(string-append "../"
574 name "-" version
575 "-checkout")
576 (substitute* "bind/guile/ao/bind.scm"
577 (("\\(define libao \\(dynamic-link .*$")
578 (string-append "(define libao (dynamic-link \""
579 out "/lib/libao\")) ;")))
580
581 (for-each (lambda (file)
582 (install-file file
583 (string-append moddir
584 "/ao")))
585 (find-files "bind/guile" "\\.scm$"))
586
587 (substitute* "bin/ao-guile"
588 (("\\(add-to-load-path .*")
589 (string-append "(add-to-load-path \"" moddir "\")")))
590
591 (install-file "bin/ao-guile"
592 (string-append out "/bin"))
593
594 ;; Allow Ao to dlopen the relevant GL libraries. Otherwise
595 ;; it fails with:
596 ;; Couldn't find current GLX or EGL context.
597 (let ((mesa (assoc-ref inputs "mesa")))
598 (wrap-program (string-append out "/bin/ao-guile")
599 `("LD_LIBRARY_PATH" ":" prefix
600 (,(string-append mesa "/lib")))))
601 #t)))))))
602 (native-inputs
603 `(("pkg-config" ,pkg-config)))
604 (inputs
605 `(("boost" ,boost)
606 ("catch" ,catch-framework)
607 ("libpng" ,libpng)
608 ("glfw" ,glfw)
609 ("libepoxy" ,libepoxy)
610 ("mesa" ,mesa)
611 ("eigen" ,eigen)
612 ("glm" ,glm)
613 ("guile" ,guile-2.0)))
614 (home-page "http://www.mattkeeter.com/projects/ao/")
615 (synopsis "Tool for programmatic computer-aided design")
616 (description
617 "Ao is a tool for programmatic computer-aided design (CAD). In Ao,
618 solid models are defined as Scheme scripts, and there are no opaque function
619 calls into the geometry kernel: everything is visible to the user. Even
620 fundamental, primitive shapes are represented as code in the user-level
621 language.")
622 (license (list license:lgpl2.1+ ;library
623 license:gpl2+))))) ;Guile bindings
624
625 ;; We use kicad from a git commit, because support for boost 1.61.0 has been
626 ;; recently added.
627 (define-public kicad
628 (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
629 (revision "1"))
630 (package
631 (name "kicad")
632 (version (string-append "4.0-" revision "."
633 (string-take commit 7)))
634 (source
635 (origin
636 (method git-fetch)
637 (uri (git-reference
638 (url "https://git.launchpad.net/kicad")
639 (commit commit)))
640 (sha256
641 (base32 "0kf6r92nps0658i9n3p9vp5dzbssmc22lvjv5flyvnlf83l63s4n"))
642 (file-name (string-append name "-" version "-checkout"))))
643 (build-system cmake-build-system)
644 (arguments
645 `(#:out-of-source? #t
646 #:tests? #f ; no tests
647 #:configure-flags
648 (list "-DKICAD_STABLE_VERSION=ON"
649 "-DKICAD_REPO_NAME=stable"
650 ,(string-append "-DKICAD_BUILD_VERSION=4.0-"
651 (string-take commit 7))
652 "-DCMAKE_BUILD_TYPE=Release"
653 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library.
654 "-DKICAD_SCRIPTING=ON"
655 "-DKICAD_SCRIPTING_MODULES=ON"
656 "-DKICAD_SCRIPTING_WXPYTHON=ON"
657 ;; Has to be set explicitely, as we don't have the wxPython
658 ;; headers in the wxwidgets store item, but in wxPython.
659 (string-append "-DCMAKE_CXX_FLAGS=-I"
660 (assoc-ref %build-inputs "wxpython")
661 "/include/wx-3.0")
662 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
663 ;; TODO: Enable this when CA certs are working with curl.
664 "-DBUILD_GITHUB_PLUGIN=OFF")
665 #:phases
666 (modify-phases %standard-phases
667 (add-after 'install 'wrap-program
668 ;; Ensure correct Python at runtime.
669 (lambda* (#:key inputs outputs #:allow-other-keys)
670 (let* ((out (assoc-ref outputs "out"))
671 (python (assoc-ref inputs "python"))
672 (file (string-append out "/bin/kicad"))
673 (path (string-append
674 out
675 "/lib/python2.7/site-packages:"
676 (getenv "PYTHONPATH"))))
677 (wrap-program file
678 `("PYTHONPATH" ":" prefix (,path))
679 `("PATH" ":" prefix
680 (,(string-append python "/bin:")))))
681 #t)))))
682 (native-inputs
683 `(("boost" ,boost)
684 ("gettext" ,gnu-gettext)
685 ("pkg-config" ,pkg-config)
686 ("swig" ,swig)
687 ("zlib" ,zlib)))
688 (inputs
689 `(("cairo" ,cairo)
690 ("curl" ,curl)
691 ("desktop-file-utils" ,desktop-file-utils)
692 ("glew" ,glew)
693 ("glm" ,glm)
694 ("hicolor-icon-theme" ,hicolor-icon-theme)
695 ("libsm" ,libsm)
696 ("mesa" ,mesa)
697 ("openssl" ,openssl)
698 ("python" ,python-2)
699 ("wxwidgets" ,wxwidgets-gtk2)
700 ("wxpython" ,python2-wxpython)))
701 (home-page "http://kicad-pcb.org/")
702 (synopsis "Electronics Design Automation Suite")
703 (description "Kicad is a program for the formation of printed circuit
704 boards and electrical circuits. The software has a number of programs that
705 perform specific functions, for example, pcbnew (Editing PCB), eeschema (editing
706 electrical diagrams), gerbview (viewing Gerber files) and others.")
707 (license license:gpl3+))))
708
709 (define-public kicad-library
710 (let ((version "4.0.4"))
711 (package
712 (name "kicad-library")
713 (version version)
714 (source (origin
715 (method url-fetch)
716 (uri (string-append
717 "http://downloads.kicad-pcb.org/libraries/kicad-library-"
718 version ".tar.gz"))
719 (sha256
720 (base32
721 "1wyda58y39lhxml0xv1ngvddi0nqihx9bnlza46ajzms38ajvh12"))))
722 (build-system cmake-build-system)
723 (arguments
724 `(#:out-of-source? #t
725 #:tests? #f ; no tests
726 #:phases
727 (modify-phases %standard-phases
728 (add-after 'install 'install-footprints ; from footprints tarball
729 (lambda* (#:key inputs outputs #:allow-other-keys)
730 (zero? (system* "tar" "xvf"
731 (assoc-ref inputs "kicad-footprints")
732 "-C" (string-append (assoc-ref outputs "out")
733 "/share/kicad/modules")
734 "--strip-components=1"))))
735 ;; We change the default global footprint file, which is generated if
736 ;; it doesn't exist in user's home directory, from the one using the
737 ;; github plugin, to the one using the KISYSMOD environment path.
738 (add-after 'install-footprints 'use-pretty-footprint-table
739 (lambda* (#:key outputs #:allow-other-keys)
740 (let* ((out (assoc-ref outputs "out"))
741 (template-dir (string-append out "/share/kicad/template"))
742 (fp-lib-table (string-append template-dir "/fp-lib-table")))
743 (delete-file fp-lib-table)
744 (copy-file (string-append fp-lib-table ".for-pretty")
745 fp-lib-table))
746 #t)))))
747 (native-search-paths
748 (list (search-path-specification
749 (variable "KISYSMOD") ; footprint path
750 (files '("share/kicad/modules")))
751 (search-path-specification
752 (variable "KISYS3DMOD") ; 3D model path
753 (files '("share/kicad/modules/packages3d")))))
754 ;; Kicad distributes footprints in a separate tarball
755 (native-inputs
756 `(("kicad-footprints"
757 ,(origin
758 (method url-fetch)
759 (uri (string-append
760 "http://downloads.kicad-pcb.org/libraries/kicad-footprints-"
761 version ".tar.gz"))
762 (sha256
763 (base32
764 "0ya4gg6clz3vp2wrb67xwg0bhwh5q8ag39jjmpcp4zjcqs1f48rb"))))))
765 (home-page "http://kicad-pcb.org/")
766 (synopsis "Libraries for kicad")
767 (description "This package provides Kicad component, footprint and 3D
768 render model libraries.")
769 (license license:lgpl2.0+))))
770
771 (define-public linsmith
772 (package
773 (name "linsmith")
774 (version "0.99.30")
775 (source (origin
776 (method url-fetch)
777 (uri (string-append
778 "mirror://sourceforge/linsmith/linsmith/linsmith-"
779 version "/linsmith-" version ".tar.gz"))
780 (sha256
781 (base32
782 "18qslhr2r45rhpj4v6bjcqx189vs0bflvsj271wr7w8kvh69qwvn"))))
783 (build-system gnu-build-system)
784 (native-inputs
785 `(("pkg-config" ,pkg-config)
786 ("gtk" ,gtk+-2)
787 ("libgnome" ,libgnomeui)))
788 (home-page "http://jcoppens.com/soft/linsmith/index.en.php")
789 (synopsis "Smith Charting program")
790 (description "LinSmith is a Smith Charting program, mainly designed for
791 educational use. As such, there is an emphasis on capabilities that improve
792 the 'showing the effect of'-style of operation.")
793 (license license:gpl2+)))
794
795 (define-public volk
796 (package
797 (name "volk")
798 (version "1.3")
799 (source
800 (origin
801 (method url-fetch)
802 (uri (string-append "http://libvolk.org/releases/volk-"
803 version ".tar.gz"))
804 (sha256
805 (base32
806 "1bz3ywc6y5wmz3i8p4z2wbzhns8bc0ywdkl9qnxpcvfcscarbdlh"))))
807 (build-system cmake-build-system)
808 (inputs
809 `(("boost" ,boost)))
810 (native-inputs
811 `(("python-2", python-2)
812 ("python2-cheetah" ,python2-cheetah)))
813 (home-page "http://libvolk.org/")
814 (synopsis "Vector-Optimized Library of Kernels")
815 (description
816 "@code{volk} contains procedures with machine-specific optimizations
817 for mathematical functions. It also provides an machine-independent
818 interface to select the best such procedures to use on a given system.")
819 (license license:gpl3+)))
820
821 (define-public minicom
822 (package
823 (name "minicom")
824 (version "2.7.1")
825 (source
826 (origin
827 (method url-fetch)
828 (uri (string-append "https://alioth.debian.org/frs/download.php/"
829 "file/4215/" name "-" version ".tar.gz"))
830 (sha256
831 (base32
832 "1wa1l36fa4npd21xa9nz60yrqwkk5cq713fa3p5v0zk7g9mq6bsk"))))
833 (build-system gnu-build-system)
834 (arguments
835 `(#:configure-flags '("--enable-lock-dir=/var/lock")
836 #:phases
837 (modify-phases %standard-phases
838 (add-after 'unpack 'patch-lock-check
839 (lambda _
840 (substitute* "configure"
841 (("test -d [$]UUCPLOCK") "true"))
842 #t)))))
843 (inputs
844 `(("ncurses" ,ncurses)))
845 (home-page "https://alioth.debian.org/projects/minicom/")
846 (synopsis "Serial terminal emulator")
847 (description "@code{minicom} is a serial terminal emulator.")
848 (license license:gpl2+)))
849
850 (define-public harminv
851 (package
852 (name "harminv")
853 (version "1.4")
854 (source (origin
855 (method url-fetch)
856 (uri
857 (string-append
858 "http://ab-initio.mit.edu/harminv/harminv-"
859 version ".tar.gz"))
860 (sha256
861 (base32
862 "1pmm8d6fx9ahhnk7w12bfa6zx3afbkg4gkvlvgwhpjxbcrvrp3jk"))))
863 (build-system gnu-build-system)
864 (arguments
865 `(#:phases
866 (modify-phases %standard-phases
867 (add-before 'configure 'fix-tests
868 (lambda _
869 (substitute* "./sines-test.sh"
870 ; change test frequency range - default fails
871 (("0\\.15") "0.16"))
872 #t)))))
873 (native-inputs
874 `(("fortran" ,gfortran)))
875 (inputs
876 `(("lapack" ,lapack)))
877 (home-page "http://ab-initio.mit.edu/wiki/index.php/Harminv")
878 (synopsis "Harmonic inversion solver")
879 (description
880 "Harminv is a free program (and accompanying library) to solve the problem of
881 harmonic inversion — given a discrete-time, finite-length signal that consists of a sum
882 of finitely-many sinusoids (possibly exponentially decaying) in a given bandwidth, it
883 determines the frequencies, decay constants, amplitudes, and phases of those sinusoids.")
884 (license license:gpl2+)))
885
886 (define-public guile-libctl
887 (package
888 (name "guile-libctl")
889 (version "3.2.2")
890 (source (origin
891 (method url-fetch)
892 (uri
893 (string-append
894 "http://ab-initio.mit.edu/libctl/libctl-"
895 version ".tar.gz"))
896 (sha256
897 (base32
898 "1g7gqybq20jhdnw5vg18bgbj9jz0408gfmjvs8b4xs30pic8pgca"))))
899 (build-system gnu-build-system)
900 (native-inputs
901 `(("fortran" ,gfortran)))
902 (inputs
903 `(("guile" ,guile-2.2)))
904 (home-page "http://ab-initio.mit.edu/wiki/index.php/Libctl")
905 (synopsis "Flexible control files implementation for scientific simulations")
906 (description
907 "Libctl is a Guile-based library implementing flexible control files
908 for scientific simulations.")
909 (license license:gpl2+)))
910
911 (define-public mpb
912 (package
913 (name "mpb")
914 (version "1.5")
915 (source (origin
916 (method url-fetch)
917 (uri
918 (string-append
919 "http://ab-initio.mit.edu/mpb/mpb-"
920 version ".tar.gz"))
921 (sha256
922 (base32
923 "1mqb2d8jq957nksayjygq58iy8i42vjryzg9iy5fpfay31wzxsix"))))
924 (build-system gnu-build-system)
925 (arguments
926 `(#:configure-flags
927 (list (string-append "--with-libctl="
928 (assoc-ref %build-inputs "libctl")
929 "/share/libctl"))))
930 (native-inputs
931 `(("fortran" ,gfortran)
932 ("pkg-config" ,pkg-config)
933 ("swig" ,swig)))
934 (inputs
935 `(("fftw" ,fftw)
936 ("gsl" ,gsl)
937 ("guile" ,guile-2.2)
938 ("hdf5" ,hdf5)
939 ("lapack" ,lapack)
940 ("libctl" ,guile-libctl)
941 ("readline" ,readline)
942 ("zlib" ,zlib)))
943 (home-page "http://ab-initio.mit.edu/wiki/index.php/MIT_Photonic_Bands")
944 (synopsis "Computes band structures and electromagnetic modes of dielectric
945 structures")
946 (description
947 "MIT Photonic-Bands (MPB) computes definite-frequency eigenstates (harmonic modes)
948 of Maxwell's equations in periodic dielectric structures for arbitrary wavevectors, using
949 fully-vectorial and three-dimensional methods.")
950 (license license:gpl2+)))
951
952 (define-public meep
953 (package
954 (name "meep")
955 (version "1.3")
956 (source (origin
957 (method url-fetch)
958 (uri
959 (string-append
960 "http://ab-initio.mit.edu/meep/meep-"
961 version ".tar.gz"))
962 (sha256
963 (base32
964 "0f6lbw2hrksg7xscwdqs78jc9nmzx9fs8j0hz1y4i8qknkqiyk2n"))))
965 (build-system gnu-build-system)
966 (arguments
967 `(#:configure-flags
968 (list (string-append "--with-libctl="
969 (assoc-ref %build-inputs "libctl")
970 "/share/libctl"))))
971 (native-inputs
972 `(("fortran" ,gfortran)
973 ("pkg-config" ,pkg-config)
974 ("swig" ,swig)))
975 (inputs
976 `(("fftw" ,fftw)
977 ("gsl" ,gsl)
978 ("guile" ,guile-2.0) ; doesn't build with guile-2.2
979 ("harminv" ,harminv)
980 ("hdf5" ,hdf5)
981 ("lapack" ,lapack)
982 ("libctl" ,guile-libctl)
983 ("mpb" ,mpb)
984 ("zlib" ,zlib)))
985 (home-page "http://ab-initio.mit.edu/wiki/index.php/Meep")
986 (synopsis "Finite-difference time-domain (FDTD) simulation software")
987 (description
988 "Meep is a finite-difference time-domain (FDTD) simulation software package
989 developed at MIT to model electromagnetic systems.")
990 (license license:gpl2+)))
991
992 (define-public adms
993 (package
994 (name "adms")
995 (version "2.3.6")
996 (source (origin
997 (method url-fetch)
998 (uri
999 (string-append
1000 "mirror://sourceforge/mot-adms/adms-source/"
1001 (version-major+minor version) "/adms-" version ".tar.gz"))
1002 (sha256
1003 (base32
1004 "1rn98l6jxcjhi6ai5f7p588khra9z80m0m0lql4n4sb7773fh1vk"))))
1005 (build-system gnu-build-system)
1006 (native-inputs
1007 `(("flex" ,flex)
1008 ("bison" ,bison)))
1009 (home-page "https://sourceforge.net/projects/mot-adms")
1010 (synopsis "Automatic device model synthesizer")
1011 (description
1012 "ADMS is a code generator that converts electrical compact device models
1013 specified in high-level description language into ready-to-compile C code for
1014 the API of spice simulators. Based on transformations specified in XML
1015 language, ADMS transforms Verilog-AMS code into other target languages.")
1016 (license license:gpl3)))
1017
1018 (define-public capstone
1019 (package
1020 (name "capstone")
1021 (version "3.0.5-rc2")
1022 (source (origin
1023 (method url-fetch)
1024 (uri (string-append "https://github.com/aquynh/capstone/archive/"
1025 version ".tar.gz"))
1026 (file-name (string-append name "-" version ".tar.gz"))
1027 (sha256
1028 (base32
1029 "1cqms9r2p43aiwp5spd84zaccp16ih03r7sjhrv16nddahj0jz2q"))))
1030 (build-system gnu-build-system)
1031 (arguments
1032 `(#:tests? #f
1033 #:make-flags (list (string-append "PREFIX=" %output)
1034 "CC=gcc")
1035 #:phases
1036 (modify-phases %standard-phases
1037 (delete 'configure)
1038 ;; cstool's Makefile overrides LDFLAGS, so we cannot pass it as a make flag.
1039 (add-before 'build 'fix-cstool-ldflags
1040 (lambda* (#:key outputs #:allow-other-keys)
1041 (substitute* "cstool/Makefile"
1042 (("LDFLAGS =")
1043 (string-append "LDFLAGS = -Wl,-rpath=" (assoc-ref outputs "out")
1044 "/lib")))
1045 #t)))))
1046 (home-page "http://www.capstone-engine.org")
1047 (synopsis "Lightweight multi-platform, multi-architecture disassembly framework")
1048 (description
1049 "Capstone is a lightweight multi-platform, multi-architecture disassembly
1050 framework. Capstone can disassemble machine code for many supported architectures
1051 such as x86, x86_64, arm, arm64, mips, ppc, sparc, sysz and xcore. It provides
1052 bindings for Python, Java, OCaml and more.")
1053 (license license:bsd-3)))
1054
1055 ;; FIXME: This package has a timestamp embedded in
1056 ;; lib/python3.5/site-packages/capstone/__pycache__/__iti__.cpython-35.pyc
1057 (define-public python-capstone
1058 (package
1059 (inherit capstone)
1060 (name "python-capstone")
1061 (propagated-inputs
1062 `(("capstone" ,capstone)))
1063 (build-system python-build-system)
1064 (arguments
1065 `(#:phases
1066 (modify-phases %standard-phases
1067 (add-after 'unpack 'chdir-and-fix-setup-py
1068 (lambda _
1069 (chdir "bindings/python")
1070 ;; Do not build the library again, because we already have it.
1071 (substitute* "setup.py" ((".* build_libraries.*") ""))
1072 ;; This substitution tells python-capstone where to find the
1073 ;; library.
1074 (substitute* "capstone/__init__.py"
1075 (("pkg_resources.resource_filename.*")
1076 (string-append "'" (assoc-ref %build-inputs "capstone") "/lib',\n")))
1077 #t)))))))
1078
1079 (define-public python2-capstone
1080 (package-with-python2 python-capstone))
1081
1082 (define-public radare2
1083 (package
1084 (name "radare2")
1085 (version "1.6.0")
1086 (source (origin
1087 (method url-fetch)
1088 (uri (string-append "http://radare.mikelloc.com/get/" version "/"
1089 name "-" version ".tar.gz"))
1090 (sha256
1091 (base32
1092 "16ggsk40zz6hyvclvqj1r4bh4hb78jf0d6ppry1jk4r0j30wm7cm"))
1093 (modules '((guix build utils)))
1094 (snippet
1095 '(begin
1096 (substitute* "libr/asm/p/Makefile"
1097 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))
1098 (substitute* "libr/parse/p/Makefile"
1099 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))
1100 (substitute* "libr/bin/p/Makefile"
1101 (("LDFLAGS\\+=") "LDFLAGS+=-Wl,-rpath=$(LIBDIR) "))))))
1102 (build-system gnu-build-system)
1103 (arguments
1104 '(#:tests? #f; tests require git and network access
1105 #:phases
1106 (modify-phases %standard-phases
1107 (add-before 'configure 'mklibdir
1108 (lambda* (#:key inputs #:allow-other-keys)
1109 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1110 #t)))
1111 #:configure-flags
1112 (list "--with-sysmagic" "--with-syszip" "--with-openssl"
1113 "--without-nonpic" "--with-rpath" "--with-syscapstone")
1114 #:make-flags
1115 (list "CC=gcc")))
1116 (inputs
1117 `(("openssl" ,openssl)
1118 ("zip" ,zip)
1119 ("gmp" ,gmp)
1120 ("capstone" ,capstone)))
1121 (native-inputs
1122 `(("pkg-config" ,pkg-config)))
1123 (home-page "https://radare.org/")
1124 (synopsis "Portable reversing framework")
1125 (description
1126 "Radare project started as a forensics tool, a scriptable commandline
1127 hexadecimal editor able to open disk files, but later support for analyzing
1128 binaries, disassembling code, debugging programs, attaching to remote gdb
1129 servers, ...")
1130 (license license:lgpl3)))