gnu: Add harminv.
[jackhill/guix/guix.git] / gnu / packages / engineering.scm
CommitLineData
ffb010b5 1;;; GNU Guix --- Functional package management for GNU
e981ca36 2;;; Copyright © 2015, 2016, 2017 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>
d7d5050c 6;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
1251c664 7;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros.for@openmailbox.org>
ffb010b5
RW
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
40fbd52a 24(define-module (gnu packages engineering)
ffb010b5
RW
25 #:use-module (guix packages)
26 #:use-module (guix download)
93094501 27 #:use-module (guix gexp)
ffb010b5 28 #:use-module (guix git-download)
93094501
FB
29 #:use-module (guix monads)
30 #:use-module (guix store)
412726ee 31 #:use-module (guix utils)
ffb010b5 32 #:use-module ((guix licenses) #:prefix license:)
befc9ff6 33 #:use-module (guix build-system cmake)
ffb010b5 34 #:use-module (guix build-system gnu)
4534d85e 35 #:use-module (guix build-system cmake)
ffb010b5 36 #:use-module (gnu packages)
4534d85e 37 #:use-module (gnu packages algebra)
95283f3f 38 #:use-module (gnu packages autotools)
5699a3cf 39 #:use-module (gnu packages base)
20500662 40 #:use-module (gnu packages bison)
ffb010b5 41 #:use-module (gnu packages boost)
4534d85e 42 #:use-module (gnu packages check)
93094501 43 #:use-module (gnu packages compression)
befc9ff6 44 #:use-module (gnu packages curl)
20500662 45 #:use-module (gnu packages flex)
ffb010b5 46 #:use-module (gnu packages fontutils)
324b0040 47 #:use-module (gnu packages freedesktop)
1251c664 48 #:use-module (gnu packages gcc)
20500662 49 #:use-module (gnu packages gd)
95283f3f 50 #:use-module (gnu packages gettext)
93094501 51 #:use-module (gnu packages ghostscript)
20500662 52 #:use-module (gnu packages gl)
412726ee
RW
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages gnome)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages guile)
4534d85e 57 #:use-module (gnu packages image)
e981ca36 58 #:use-module (gnu packages imagemagick)
38cf2ba0 59 #:use-module (gnu packages linux) ;FIXME: for pcb
0de98139 60 #:use-module (gnu packages m4)
ffb010b5 61 #:use-module (gnu packages maths)
f37f949d 62 #:use-module (gnu packages ncurses)
412726ee 63 #:use-module (gnu packages perl)
ffb010b5 64 #:use-module (gnu packages pkg-config)
befc9ff6 65 #:use-module (gnu packages python)
ffb010b5 66 #:use-module (gnu packages qt)
befc9ff6 67 #:use-module (gnu packages swig)
20500662 68 #:use-module (gnu packages tcl)
befc9ff6 69 #:use-module (gnu packages tls)
8f9ac901 70 #:use-module (gnu packages tex)
befc9ff6
TF
71 #:use-module (gnu packages wxwidgets)
72 #:use-module (gnu packages xorg)
ffb010b5
RW
73 #:use-module (srfi srfi-1))
74
75(define-public librecad
76 (package
77 (name "librecad")
6e9d5d5f 78 (version "2.1.3")
ffb010b5
RW
79 (source (origin
80 (method url-fetch)
81 (uri (string-append
82 "https://github.com/LibreCAD/LibreCAD/archive/"
83 version ".tar.gz"))
d8a4b932 84 (file-name (string-append name "-" version ".tar.gz"))
ffb010b5
RW
85 (sha256
86 (base32
6e9d5d5f 87 "01nvc1g3si05r5np1pzn62ah9w84p8nxa32wqrjh6gdi17jfvi3l"))))
ffb010b5
RW
88 (build-system gnu-build-system)
89 (arguments
90 '(#:phases
d694230a
EF
91 (modify-phases %standard-phases
92 (add-after 'unpack 'patch-paths
93 (lambda* (#:key outputs #:allow-other-keys)
94 (let ((out (assoc-ref outputs "out")))
95 (substitute* "librecad/src/lib/engine/rs_system.cpp"
96 (("/usr/share") (string-append out "/share"))))))
97 (replace 'configure
ffb010b5
RW
98 (lambda* (#:key inputs #:allow-other-keys)
99 (system* "qmake" (string-append "BOOST_DIR="
d694230a
EF
100 (assoc-ref inputs "boost")))))
101 (replace 'install
102 (lambda* (#:key outputs #:allow-other-keys)
f3860753
TGR
103 (let* ((out (assoc-ref outputs "out"))
104 (bin (string-append out "/bin"))
105 (share (string-append out "/share/librecad")))
106 (mkdir-p bin)
107 (install-file "unix/librecad" bin)
108 (mkdir-p share)
109 (copy-recursively "unix/resources" share)))))))
ffb010b5
RW
110 (inputs
111 `(("boost" ,boost)
112 ("muparser" ,muparser)
113 ("freetype" ,freetype)
9fdda0b2
RW
114 ("qtbase" ,qtbase)
115 ("qtsvg" ,qtsvg)))
ffb010b5
RW
116 (native-inputs
117 `(("pkg-config" ,pkg-config)
118 ("which" ,which)))
119 (home-page "http://librecad.org/")
120 (synopsis "Computer-aided design (CAD) application")
121 (description
122 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
123plans and designs.")
124 (license license:gpl2)))
412726ee
RW
125
126(define-public geda-gaf
127 (package
128 (name "geda-gaf")
12356eb8 129 (version "1.9.2")
412726ee
RW
130 (source (origin
131 (method url-fetch)
132 (uri (string-append
12356eb8 133 "http://ftp.geda-project.org/geda-gaf/unstable/v"
412726ee
RW
134 (version-major+minor version) "/"
135 version "/geda-gaf-" version ".tar.gz"))
136 (sha256
137 (base32
12356eb8 138 "14mk45pfz11v54q66gafw2l68n1p5ssvvjmdm8ffgc8x1w5ajfrz"))))
412726ee
RW
139 (build-system gnu-build-system)
140 (arguments
141 '(#:phases
2352c97d
RW
142 (modify-phases %standard-phases
143 ;; tests require a writable HOME
144 (add-before 'check 'set-home
145 (lambda _
146 (setenv "HOME" (getenv "TMPDIR"))
147 #t)))
0de98139
DT
148 #:configure-flags
149 (let ((pcb (assoc-ref %build-inputs "pcb")))
150 (list (string-append "--with-pcb-datadir=" pcb "/share")
151 (string-append "--with-pcb-lib-path="
152 pcb "/share/pcb/pcblib-newlib:"
153 pcb "/share/pcb/newlib")))))
412726ee
RW
154 (inputs
155 `(("glib" ,glib)
156 ("gtk" ,gtk+-2)
157 ("guile" ,guile-2.0)
158 ("desktop-file-utils" ,desktop-file-utils)
0de98139
DT
159 ("shared-mime-info" ,shared-mime-info)
160 ("m4" ,m4)
161 ("pcb" ,pcb)))
412726ee
RW
162 (native-inputs
163 `(("pkg-config" ,pkg-config)
164 ("perl" ,perl))) ; for tests
165 (home-page "http://geda-project.org/")
166 (synopsis "Schematic capture, netlister, symbols, symbol checker, and utils")
167 (description
a124bbd2 168 "Gaf stands for “gschem and friends”. It is a subset of the entire tool
412726ee
RW
169suite grouped together under the gEDA name. gEDA/gaf is a collection of tools
170which currently includes: gschem, a schematic capture program; gnetlist, a
171netlist generation program; gsymcheck, a syntax checker for schematic symbols;
172gattrib, a spreadsheet programm that manipulates the properties of symbols of
173a schematic; libgeda, libraries for gschem gnetlist and gsymcheck; gsch2pcb, a
174tool to forward annotation from your schematic to layout using PCB; some minor
175utilities.")
176 (license license:gpl2+)))
177
20500662
RW
178(define-public pcb
179 (package
180 (name "pcb")
e981ca36 181 (version "4.0.0")
20500662
RW
182 (source (origin
183 (method url-fetch)
e981ca36
RW
184 (uri (string-append "mirror://sourceforge/pcb/pcb/pcb-" version
185 "/pcb-" version ".tar.gz"))
20500662
RW
186 (sha256
187 (base32
e981ca36 188 "1i6sk8g8h9avms142wl07yv20m1cm4c3fq3v6hybrhdxs2n17plf"))))
20500662
RW
189 (build-system gnu-build-system)
190 (arguments
191 `(#:phases
192 (alist-cons-after
193 'unpack 'use-wish8.6
194 (lambda _
195 (substitute* "configure"
196 (("wish85") "wish8.6")))
197 (alist-cons-after
198 'install 'wrap
199 (lambda* (#:key inputs outputs #:allow-other-keys)
200 ;; FIXME: Mesa tries to dlopen libudev.so.0 and fails. Pending a
201 ;; fix of the mesa package we wrap the pcb executable such that
202 ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
203 (let* ((out (assoc-ref outputs "out"))
204 (path (string-append (assoc-ref inputs "udev") "/lib")))
205 (wrap-program (string-append out "/bin/pcb")
206 `("LD_LIBRARY_PATH" ":" prefix (,path)))))
e981ca36
RW
207 (alist-cons-before
208 'check 'pre-check
209 (lambda _
210 (system "Xvfb :1 &")
211 (setenv "DISPLAY" ":1")
212 #t)
213 %standard-phases)))))
20500662
RW
214 (inputs
215 `(("dbus" ,dbus)
216 ("mesa" ,mesa)
217 ("udev" ,eudev) ;FIXME: required by mesa
218 ("glu" ,glu)
219 ("gd" ,gd)
220 ("gtk" ,gtk+-2)
221 ("gtkglext" ,gtkglext)
222 ("desktop-file-utils" ,desktop-file-utils)
223 ("shared-mime-info" ,shared-mime-info)
224 ("tk" ,tk)))
225 (native-inputs
226 `(("pkg-config" ,pkg-config)
227 ("intltool" ,intltool)
228 ("bison" ,bison)
e981ca36
RW
229 ("flex" ,flex)
230 ;; For tests
231 ("imagemagick" ,imagemagick)
232 ("gerbv" ,gerbv)
233 ("ghostscript" ,ghostscript)
234 ("xvfb" ,xorg-server)))
20500662
RW
235 (home-page "http://pcb.geda-project.org/")
236 (synopsis "Design printed circuit board layouts")
237 (description
238 "GNU PCB is an interactive tool for editing printed circuit board
239layouts. It features a rats-nest implementation, schematic/netlist import,
240and design rule checking. It also includes an autorouter and a trace
241optimizer; and it can produce photorealistic and design review images.")
242 (license license:gpl2+)))
93094501 243
49c2665f
RW
244(define-public pcb-rnd
245 (package (inherit pcb)
246 (name "pcb-rnd")
247 (version "1.1.3")
248 (source (origin
249 (method url-fetch)
250 (uri (string-append "http://repo.hu/projects/pcb-rnd/releases/"
251 "pcb-rnd-" version ".tar.gz"))
252 (sha256
253 (base32
254 "0pycynla60b96jkb6fh6f4sx663pqbzjwnixhw5ym8sym2absm09"))))
255 (arguments
256 `(#:tests? #f ; no check target
257 #:phases
258 (modify-phases %standard-phases
259 (add-after 'unpack 'cc-is-gcc
260 (lambda _ (setenv "CC" "gcc") #t))
261 (replace 'configure
262 ;; The configure script doesn't tolerate most of our configure flags.
263 (lambda* (#:key outputs #:allow-other-keys)
264 (zero? (system* "sh" "configure"
265 (string-append "--prefix="
266 (assoc-ref outputs "out")))))))))
267 (home-page "http://repo.hu/projects/pcb-rnd/")
268 (description "PCB RND is a fork of the GNU PCB circuit board editing tool
269featuring various improvements and bug fixes.")))
270
93094501
FB
271(define-public fastcap
272 (package
273 (name "fastcap")
274 (version "2.0-18Sep92")
275 (source (origin
95001d4b 276 (method url-fetch/tarbomb)
93094501
FB
277 (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
278 name "-" version ".tgz"))
279 (sha256
280 (base32
281 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
3dac53be
FB
282 (snippet
283 ;; Remove a non-free file.
284 '(delete-file "doc/psfig.sty"))
fc1adab1
AK
285 (patches (search-patches "fastcap-mulSetup.patch"
286 "fastcap-mulGlobal.patch"))))
93094501
FB
287 (build-system gnu-build-system)
288 (native-inputs
289 `(("texlive" ,texlive)
fb0b9ff1 290 ("ghostscript" ,ghostscript)))
93094501
FB
291 (arguments
292 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
293 #:parallel-build? #f
294 #:tests? #f ;; no tests-suite
295 #:modules ((srfi srfi-1)
296 ,@%gnu-build-system-modules)
297 #:phases
298 (modify-phases %standard-phases
299 (add-after 'build 'make-doc
300 (lambda _
301 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
302 "manual"))))
303 (add-before 'make-doc 'fix-doc
304 (lambda _
305 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
306 (substitute* (find-files "doc" "\\.tex")
307 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
308 all file scale)
309 (string-append "\\includegraphics[scale=" scale "]{"
1f7ffd6f
FB
310 file "}"))
311 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
312 all file width)
313 (string-append "\\includegraphics[width=" width "]{"
314 file "}"))
315 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
316 all file height)
317 (string-append "\\includegraphics[height=" height "]{"
318 file "}"))
319 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
320 (string-append "\\includegraphics{" file "}")))
321 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
93094501
FB
322 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
323 all options class)
324 (string-append "\\documentclass[" options "]{"
325 class "}\n"
326 "\\usepackage{graphicx}\n"
327 "\\usepackage{robinspace}"))
328 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
329 (string-append "%" all))
330 (("\\\\setstretch\\{.*\\}" all)
331 (string-append "%" all)))
332 #t))
333 (delete 'configure)
334 (add-before 'install 'clean-bin
335 (lambda _
336 (delete-file (string-append (getcwd) "/bin/README"))
337 #t))
338 (add-before 'install 'make-pdf
339 (lambda _
340 (with-directory-excursion "doc"
341 (and
342 (every (lambda (file)
343 (zero? (system* "dvips" file "-o")))
344 (find-files "." "\\.dvi"))
345 (every (lambda (file)
346 (zero? (system* "ps2pdf" file)))
347 '("mtt.ps" "ug.ps" "tcad.ps"))
348 (zero? (system* "make" "clean"))))))
349 (replace 'install
350 (lambda* (#:key outputs #:allow-other-keys)
351 (let* ((out (assoc-ref outputs "out"))
352 (data (string-append out "/share"))
353 (bin (string-append out "/bin"))
354 (doc (string-append data "/doc/" ,name "-" ,version))
355 (examples (string-append doc "/examples")))
356 (with-directory-excursion "bin"
96c46210
LC
357 (for-each (lambda (f)
358 (install-file f bin))
359 (find-files "." ".*")))
93094501
FB
360 (copy-recursively "doc" doc)
361 (copy-recursively "examples" examples)
362 #t))))))
363 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
364 (synopsis "Multipole-accelerated capacitance extraction program")
365 (description
366 "Fastcap is a capacitance extraction program based on a
367multipole-accelerated algorithm.")
368 (license (license:non-copyleft #f "See fastcap.c."))))
23bae7bb
FB
369
370(define-public fasthenry
371 (package
372 (name "fasthenry")
373 (version "3.0-12Nov96")
374 (source (origin
375 (method url-fetch)
376 (file-name (string-append name "-" version ".tar.gz"))
377 (uri (string-append
378 "http://www.rle.mit.edu/cpg/codes/" name
379 "-" version ".tar.z"))
380 (sha256
381 (base32 "1a06xyyd40zhknrkz17xppl2zd5ig4w9g1grc8qrs0zqqcl5hpzi"))
fc1adab1
AK
382 (patches (search-patches "fasthenry-spAllocate.patch"
383 "fasthenry-spBuild.patch"
384 "fasthenry-spUtils.patch"
385 "fasthenry-spSolve.patch"
386 "fasthenry-spFactor.patch"))))
23bae7bb
FB
387 (build-system gnu-build-system)
388 (arguments
389 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
390 #:parallel-build? #f
391 #:tests? #f ;; no tests-suite
392 #:modules ((srfi srfi-1)
393 ,@%gnu-build-system-modules)
394 #:phases
395 (modify-phases %standard-phases
396 (delete 'configure)
397 (replace 'install
398 (lambda* (#:key outputs #:allow-other-keys)
399 (let* ((out (assoc-ref outputs "out"))
400 (data (string-append out "/share"))
401 (bin (string-append out "/bin"))
402 (doc (string-append data "/doc/" ,name "-" ,version))
403 (examples (string-append doc "/examples")))
404 (with-directory-excursion "bin"
96c46210
LC
405 (for-each (lambda (f)
406 (install-file f bin))
407 (find-files "." ".*")))
23bae7bb
FB
408 (copy-recursively "doc" doc)
409 (copy-recursively "examples" examples)
410 #t))))))
411 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
412 (synopsis "Multipole-accelerated inductance analysis program")
413 (description
414 "Fasthenry is an inductance extraction program based on a
415multipole-accelerated algorithm.")
416 (license (license:non-copyleft #f "See induct.c."))))
95283f3f 417
3d5fd240
RW
418(define-public fritzing
419 (package
420 (name "fritzing")
421 (version "0.9.2b")
422 (source (origin
423 (method url-fetch)
424 (uri (string-append "https://github.com/fritzing/"
425 "fritzing-app/archive/" version ".tar.gz"))
426 (file-name (string-append name "-" version ".tar.gz"))
427 (sha256
428 (base32
429 "0pvk57z2pxz89pcwwm61lkpvj4w9qxqz8mi0zkpj6pnaljabp7bf"))))
430 (build-system gnu-build-system)
431 (arguments
432 `(#:phases
433 (modify-phases %standard-phases
434 (replace 'configure
435 (lambda* (#:key inputs outputs #:allow-other-keys)
436 (and (zero? (system* "tar"
437 "-xvf" (assoc-ref inputs "fritzing-parts-db")
438 "-C" "parts"))
439 (zero? (system* "qmake"
440 (string-append "PREFIX="
441 (assoc-ref outputs "out"))
442 "phoenix.pro"))))))))
443 (inputs
a2b99351
DC
444 `(("qtbase" ,qtbase)
445 ("qtserialport" ,qtserialport)
446 ("qtsvg" ,qtsvg)
3d5fd240
RW
447 ("boost" ,boost)
448 ("zlib" ,zlib)
449 ("fritzing-parts-db"
450 ,(origin
451 (method url-fetch)
452 (uri (string-append "https://github.com/fritzing/"
453 "fritzing-parts/archive/" version ".tar.gz"))
454 (file-name (string-append "fritzing-parts-" version ".tar.gz"))
455 (sha256
456 (base32
457 "0jqr8yjg7177f3pk1fcns584r0qavwpr280nggsi2ff3pwk5wpsz"))))))
458 (home-page "http://fritzing.org")
459 (synopsis "Electronic circuit design")
460 (description
461 "The Fritzing application is @dfn{Electronic Design Automation} (EDA)
462software with a low entry barrier, suited for the needs of makers and
463hobbyists. It offers a unique real-life \"breadboard\" view, and a parts
464library with many commonly used high-level components. Fritzing makes it very
465easy to communicate about circuits, as well as to turn them into PCB layouts
466ready for production.")
467 ;; Documentation and parts are released under CC-BY-SA 3.0; source code is
468 ;; released under GPLv3+.
469 (license (list license:gpl3+ license:cc-by-sa3.0))))
470
95283f3f
RW
471(define-public gerbv
472 (package
473 (name "gerbv")
474 (version "2.6.1")
475 (source (origin
476 (method url-fetch)
477 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
478 version "/gerbv-" version ".tar.gz"))
479 (sha256
480 (base32
481 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
482 (build-system gnu-build-system)
483 (arguments
484 `(#:phases
485 (modify-phases %standard-phases
486 (add-before 'configure 'autoconf
487 (lambda _
488 ;; Build rules contain references to Russian translation, but the
489 ;; needed files are missing; see
490 ;; http://sourceforge.net/p/gerbv/bugs/174/
491 (delete-file "po/LINGUAS")
492 (substitute* "man/Makefile.am"
493 (("PO_FILES= gerbv.ru.1.in.po") "")
494 (("man_MANS = gerbv.1 gerbv.ru.1") "man_MANS = gerbv.1"))
495 (zero? (system* "autoreconf" "-vfi")))))))
496 (native-inputs
497 `(("autoconf" ,autoconf)
498 ("automake" ,automake)
499 ("libtool" ,libtool)
b94a6ca0 500 ("gettext" ,gettext-minimal)
95283f3f
RW
501 ("po4a" ,po4a)
502 ("pkg-config" ,pkg-config)))
503 (inputs
504 `(("cairo" ,cairo)
505 ("gtk" ,gtk+-2)
506 ("desktop-file-utils" ,desktop-file-utils)))
507 (home-page "http://gerbv.geda-project.org/")
508 (synopsis "Gerber file viewer")
509 (description
510 "Gerbv is a viewer for files in the Gerber format (RS-274X only), which
511is commonly used to represent printed circuit board (PCB) layouts. Gerbv lets
512you load several files on top of each other, do measurements on the displayed
513image, etc. Besides viewing Gerbers, you may also view Excellon drill files
514as well as pick-place files.")
515 (license license:gpl2+)))
4534d85e
LC
516
517(define-public ao
518 (let ((commit "0bc2354b8dcd1a82a0fd6647706b126045e52734"))
519 (package
520 (name "ao-cad") ;XXX: really "ao", but it collides with libao
521 (version (string-append "0." (string-take commit 7)))
522 (source (origin
523 (method git-fetch)
524 (uri (git-reference
525 (url "https://github.com/mkeeter/ao")
526 (commit commit)))
527 (sha256
528 (base32
529 "0lm7iljklafs8dhlvaab2yhwx4xymrdjrqk9c5xvn59hlvbgl1j5"))
530 (file-name (string-append name "-" version "-checkout"))
531 (modules '((guix build utils)))
532 (snippet
533 ;; Remove bundled libraries: Eigen, glm, and catch. TODO:
534 ;; Unbundle efsw <https://github.com/diegostamigni/efsw>.
535 '(begin
536 (delete-file-recursively "vendor")
537
538 ;; Use #include <catch.hpp>.
539 (substitute* (find-files "." "\\.[ch]pp$")
540 (("catch/catch\\.hpp")
541 "catch.hpp"))))))
542 (build-system cmake-build-system)
543 (arguments
544 `(;; Have the RUNPATH of libao.so point to $libdir, where libefsw.so
545 ;; lives.
546 #:configure-flags (list (string-append "-DCMAKE_SHARED_LINKER_FLAGS="
547 "-Wl,-rpath="
548 (assoc-ref %outputs "out")
549 "/lib"))
550
551 #:phases
552 (modify-phases %standard-phases
553 (add-before 'build 'add-eigen-to-search-path
554 (lambda* (#:key inputs #:allow-other-keys)
555 ;; Allow things to find our own Eigen and Catch.
556 (let ((eigen (assoc-ref inputs "eigen")))
557 (setenv "CPLUS_INCLUDE_PATH"
558 (string-append eigen "/include/eigen3:"
559 (getenv "CPLUS_INCLUDE_PATH")))
560 #t)))
561 (add-after 'install 'install-guile-bindings
d7d5050c 562 (lambda* (#:key inputs outputs #:allow-other-keys)
4534d85e
LC
563 ;; Install the Guile bindings (the build system only installs
564 ;; libao.so.)
565 (let* ((out (assoc-ref outputs "out"))
566 (moddir (string-append out "/share/guile/site/2.0")))
567 (install-file "bind/libao.so"
568 (string-append out "/lib"))
569
570 ;; Go to the source directory.
571 (with-directory-excursion ,(string-append "../"
572 name "-" version
573 "-checkout")
574 (substitute* "bind/guile/ao/bind.scm"
575 (("\\(define libao \\(dynamic-link .*$")
576 (string-append "(define libao (dynamic-link \""
577 out "/lib/libao\")) ;")))
578
579 (for-each (lambda (file)
580 (install-file file
581 (string-append moddir
582 "/ao")))
583 (find-files "bind/guile" "\\.scm$"))
584
585 (substitute* "bin/ao-guile"
586 (("\\(add-to-load-path .*")
587 (string-append "(add-to-load-path \"" moddir "\")")))
588
589 (install-file "bin/ao-guile"
590 (string-append out "/bin"))
d7d5050c
LC
591
592 ;; Allow Ao to dlopen the relevant GL libraries. Otherwise
593 ;; it fails with:
594 ;; Couldn't find current GLX or EGL context.
595 (let ((mesa (assoc-ref inputs "mesa")))
596 (wrap-program (string-append out "/bin/ao-guile")
597 `("LD_LIBRARY_PATH" ":" prefix
598 (,(string-append mesa "/lib")))))
4534d85e
LC
599 #t)))))))
600 (native-inputs
601 `(("pkg-config" ,pkg-config)))
602 (inputs
603 `(("boost" ,boost)
604 ("catch" ,catch-framework)
605 ("libpng" ,libpng)
606 ("glfw" ,glfw)
607 ("libepoxy" ,libepoxy)
d7d5050c 608 ("mesa" ,mesa)
4534d85e
LC
609 ("eigen" ,eigen)
610 ("glm" ,glm)
611 ("guile" ,guile-2.0)))
612 (home-page "http://www.mattkeeter.com/projects/ao/")
613 (synopsis "Tool for programmatic computer-aided design")
614 (description
615 "Ao is a tool for programmatic computer-aided design (CAD). In Ao,
616solid models are defined as Scheme scripts, and there are no opaque function
617calls into the geometry kernel: everything is visible to the user. Even
618fundamental, primitive shapes are represented as code in the user-level
619language.")
620 (license (list license:lgpl2.1+ ;library
621 license:gpl2+))))) ;Guile bindings
befc9ff6
TF
622
623;; We use kicad from a git commit, because support for boost 1.61.0 has been
624;; recently added.
625(define-public kicad
626 (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
627 (revision "1"))
628 (package
629 (name "kicad")
630 (version (string-append "4.0-" revision "."
631 (string-take commit 7)))
632 (source
633 (origin
634 (method git-fetch)
635 (uri (git-reference
636 (url "https://git.launchpad.net/kicad")
637 (commit commit)))
638 (sha256
639 (base32 "0kf6r92nps0658i9n3p9vp5dzbssmc22lvjv5flyvnlf83l63s4n"))
640 (file-name (string-append name "-" version "-checkout"))))
641 (build-system cmake-build-system)
642 (arguments
643 `(#:out-of-source? #t
644 #:tests? #f ; no tests
645 #:configure-flags
646 (list "-DKICAD_STABLE_VERSION=ON"
647 "-DKICAD_REPO_NAME=stable"
648 ,(string-append "-DKICAD_BUILD_VERSION=4.0-"
649 (string-take commit 7))
650 "-DCMAKE_BUILD_TYPE=Release"
651 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library.
652 "-DKICAD_SCRIPTING=ON"
653 "-DKICAD_SCRIPTING_MODULES=ON"
654 "-DKICAD_SCRIPTING_WXPYTHON=ON"
655 ;; Has to be set explicitely, as we don't have the wxPython
656 ;; headers in the wxwidgets store item, but in wxPython.
657 (string-append "-DCMAKE_CXX_FLAGS=-I"
658 (assoc-ref %build-inputs "wxpython")
659 "/include/wx-3.0")
660 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
661 ;; TODO: Enable this when CA certs are working with curl.
662 "-DBUILD_GITHUB_PLUGIN=OFF")
663 #:phases
664 (modify-phases %standard-phases
665 (add-after 'install 'wrap-program
666 ;; Ensure correct Python at runtime.
667 (lambda* (#:key inputs outputs #:allow-other-keys)
668 (let* ((out (assoc-ref outputs "out"))
669 (python (assoc-ref inputs "python"))
670 (file (string-append out "/bin/kicad"))
671 (path (string-append
672 out
673 "/lib/python2.7/site-packages:"
674 (getenv "PYTHONPATH"))))
675 (wrap-program file
676 `("PYTHONPATH" ":" prefix (,path))
677 `("PATH" ":" prefix
678 (,(string-append python "/bin:")))))
679 #t)))))
680 (native-inputs
681 `(("boost" ,boost)
682 ("gettext" ,gnu-gettext)
683 ("pkg-config" ,pkg-config)
684 ("swig" ,swig)
685 ("zlib" ,zlib)))
686 (inputs
687 `(("cairo" ,cairo)
688 ("curl" ,curl)
689 ("desktop-file-utils" ,desktop-file-utils)
690 ("glew" ,glew)
691 ("glm" ,glm)
692 ("hicolor-icon-theme" ,hicolor-icon-theme)
693 ("libsm" ,libsm)
694 ("mesa" ,mesa)
695 ("openssl" ,openssl)
696 ("python" ,python-2)
697 ("wxwidgets" ,wxwidgets-gtk2)
698 ("wxpython" ,python2-wxpython)))
699 (home-page "http://kicad-pcb.org/")
700 (synopsis "Electronics Design Automation Suite")
701 (description "Kicad is a program for the formation of printed circuit
702boards and electrical circuits. The software has a number of programs that
703perform specific functions, for example, pcbnew (Editing PCB), eeschema (editing
704electrical diagrams), gerbview (viewing Gerber files) and others.")
705 (license license:gpl3+))))
8f528bd4
TF
706
707(define-public kicad-library
708 (let ((version "4.0.4"))
709 (package
710 (name "kicad-library")
711 (version version)
712 (source (origin
713 (method url-fetch)
714 (uri (string-append
715 "http://downloads.kicad-pcb.org/libraries/kicad-library-"
716 version ".tar.gz"))
717 (sha256
718 (base32
719 "1wyda58y39lhxml0xv1ngvddi0nqihx9bnlza46ajzms38ajvh12"))))
720 (build-system cmake-build-system)
721 (arguments
722 `(#:out-of-source? #t
723 #:tests? #f ; no tests
724 #:phases
725 (modify-phases %standard-phases
726 (add-after 'install 'install-footprints ; from footprints tarball
727 (lambda* (#:key inputs outputs #:allow-other-keys)
728 (zero? (system* "tar" "xvf"
729 (assoc-ref inputs "kicad-footprints")
730 "-C" (string-append (assoc-ref outputs "out")
731 "/share/kicad/modules")
732 "--strip-components=1"))))
733 ;; We change the default global footprint file, which is generated if
734 ;; it doesn't exist in user's home directory, from the one using the
735 ;; github plugin, to the one using the KISYSMOD environment path.
736 (add-after 'install-footprints 'use-pretty-footprint-table
737 (lambda* (#:key outputs #:allow-other-keys)
738 (let* ((out (assoc-ref outputs "out"))
739 (template-dir (string-append out "/share/kicad/template"))
740 (fp-lib-table (string-append template-dir "/fp-lib-table")))
741 (delete-file fp-lib-table)
742 (copy-file (string-append fp-lib-table ".for-pretty")
743 fp-lib-table))
744 #t)))))
745 (native-search-paths
746 (list (search-path-specification
747 (variable "KISYSMOD") ; footprint path
748 (files '("share/kicad/modules")))
749 (search-path-specification
750 (variable "KISYS3DMOD") ; 3D model path
751 (files '("share/kicad/modules/packages3d")))))
752 ;; Kicad distributes footprints in a separate tarball
753 (native-inputs
754 `(("kicad-footprints"
755 ,(origin
756 (method url-fetch)
757 (uri (string-append
758 "http://downloads.kicad-pcb.org/libraries/kicad-footprints-"
759 version ".tar.gz"))
760 (sha256
761 (base32
762 "0ya4gg6clz3vp2wrb67xwg0bhwh5q8ag39jjmpcp4zjcqs1f48rb"))))))
763 (home-page "http://kicad-pcb.org/")
764 (synopsis "Libraries for kicad")
765 (description "This package provides Kicad component, footprint and 3D
766render model libraries.")
767 (license license:lgpl2.0+))))
5f947808
JD
768
769(define-public linsmith
770 (package
771 (name "linsmith")
772 (version "0.99.30")
773 (source (origin
774 (method url-fetch)
775 (uri (string-append
776 "mirror://sourceforge/linsmith/linsmith/linsmith-"
777 version "/linsmith-" version ".tar.gz"))
778 (sha256
779 (base32
780 "18qslhr2r45rhpj4v6bjcqx189vs0bflvsj271wr7w8kvh69qwvn"))))
781 (build-system gnu-build-system)
782 (native-inputs
783 `(("pkg-config" ,pkg-config)
784 ("gtk" ,gtk+-2)
785 ("libgnome" ,libgnomeui)))
786 (home-page "http://jcoppens.com/soft/linsmith/index.en.php")
787 (synopsis "Smith Charting program")
788 (description "LinSmith is a Smith Charting program, mainly designed for
789educational use. As such, there is an emphasis on capabilities that improve
790the 'showing the effect of'-style of operation.")
791 (license license:gpl2+)))
2766f9e8
DM
792
793(define-public volk
794 (package
795 (name "volk")
796 (version "1.3")
797 (source
798 (origin
799 (method url-fetch)
800 (uri (string-append "http://libvolk.org/releases/volk-"
801 version ".tar.gz"))
802 (sha256
803 (base32
804 "1bz3ywc6y5wmz3i8p4z2wbzhns8bc0ywdkl9qnxpcvfcscarbdlh"))))
805 (build-system cmake-build-system)
806 (inputs
807 `(("boost" ,boost)))
808 (native-inputs
809 `(("python-2", python-2)
810 ("python2-cheetah" ,python2-cheetah)))
811 (home-page "http://libvolk.org/")
812 (synopsis "Vector-Optimized Library of Kernels")
813 (description
814 "@code{volk} contains procedures with machine-specific optimizations
815for mathematical functions. It also provides an machine-independent
816interface to select the best such procedures to use on a given system.")
817 (license license:gpl3+)))
f37f949d
DM
818
819(define-public minicom
820 (package
821 (name "minicom")
822 (version "2.7.1")
823 (source
824 (origin
825 (method url-fetch)
826 (uri (string-append "https://alioth.debian.org/frs/download.php/"
827 "file/4215/" name "-" version ".tar.gz"))
828 (sha256
829 (base32
830 "1wa1l36fa4npd21xa9nz60yrqwkk5cq713fa3p5v0zk7g9mq6bsk"))))
831 (build-system gnu-build-system)
832 (arguments
833 `(#:configure-flags '("--enable-lock-dir=/var/lock")
834 #:phases
835 (modify-phases %standard-phases
836 (add-after 'unpack 'patch-lock-check
837 (lambda _
838 (substitute* "configure"
839 (("test -d [$]UUCPLOCK") "true"))
840 #t)))))
841 (inputs
842 `(("ncurses" ,ncurses)))
843 (home-page "https://alioth.debian.org/projects/minicom/")
844 (synopsis "Serial terminal emulator")
845 (description "@code{minicom} is a serial terminal emulator.")
846 (license license:gpl2+)))
1251c664
TF
847
848(define-public harminv
849 (package
850 (name "harminv")
851 (version "1.4")
852 (source (origin
853 (method url-fetch)
854 (uri
855 (string-append
856 "http://ab-initio.mit.edu/harminv/harminv-"
857 version ".tar.gz"))
858 (sha256
859 (base32
860 "1pmm8d6fx9ahhnk7w12bfa6zx3afbkg4gkvlvgwhpjxbcrvrp3jk"))))
861 (build-system gnu-build-system)
862 (arguments
863 `(#:phases
864 (modify-phases %standard-phases
865 (add-before 'configure 'fix-tests
866 (lambda _
867 (substitute* "./sines-test.sh"
868 ; change test frequency range - default fails
869 (("0\\.15") "0.16"))
870 #t)))))
871 (native-inputs
872 `(("fortran" ,gfortran)))
873 (inputs
874 `(("lapack" ,lapack)))
875 (home-page "http://ab-initio.mit.edu/wiki/index.php/Harminv")
876 (synopsis "Harmonic inversion solver")
877 (description
878 "Harminv is a free program (and accompanying library) to solve the problem of
879harmonic inversion — given a discrete-time, finite-length signal that consists of a sum
880of finitely-many sinusoids (possibly exponentially decaying) in a given bandwidth, it
881determines the frequencies, decay constants, amplitudes, and phases of those sinusoids.")
882 (license license:gpl2+)))