1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages engineering)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix gexp)
26 #:use-module (guix git-download)
27 #:use-module (guix monads)
28 #:use-module (guix store)
29 #:use-module (guix utils)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gd)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages ghostscript)
43 #:use-module (gnu packages gl)
44 #:use-module (gnu packages glib)
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages guile)
48 #:use-module (gnu packages linux) ;FIXME: for pcb
49 #:use-module (gnu packages m4)
50 #:use-module (gnu packages maths)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages qt)
54 #:use-module (gnu packages tcl)
55 #:use-module (gnu packages texlive)
56 #:use-module (srfi srfi-1))
58 (define-public librecad
65 "https://github.com/LibreCAD/LibreCAD/archive/"
67 (file-name (string-append name "-" version ".tar.gz"))
70 "0xyn4ps9ia94h0vg53rsww8xfd1bgp4200phl8ihyhv7w5v4d8d0"))))
71 (build-system gnu-build-system)
74 (modify-phases %standard-phases
75 (add-after 'unpack 'patch-paths
76 (lambda* (#:key outputs #:allow-other-keys)
77 (let ((out (assoc-ref outputs "out")))
78 (substitute* "librecad/src/lib/engine/rs_system.cpp"
79 (("/usr/share") (string-append out "/share"))))))
81 (lambda* (#:key inputs #:allow-other-keys)
82 (system* "qmake" (string-append "BOOST_DIR="
83 (assoc-ref inputs "boost")))))
85 (lambda* (#:key outputs #:allow-other-keys)
86 (let ((out (assoc-ref outputs "out")))
87 (mkdir-p (string-append out "/bin"))
88 (mkdir-p (string-append out "/share/librecad"))
89 (copy-file "unix/librecad"
90 (string-append out "/bin/librecad"))
91 (copy-recursively "unix/resources"
92 (string-append out "/share/librecad"))))))))
95 ("muparser" ,muparser)
96 ("freetype" ,freetype)
99 `(("pkg-config" ,pkg-config)
101 (home-page "http://librecad.org/")
102 (synopsis "Computer-aided design (CAD) application")
104 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
106 (license license:gpl2)))
108 (define-public geda-gaf
115 "http://ftp.geda-project.org/geda-gaf/stable/v"
116 (version-major+minor version) "/"
117 version "/geda-gaf-" version ".tar.gz"))
120 "08dpa506xk4gjbbi8vnxcb640wq4ihlgmhzlssl52nhvxwx7gx5v"))))
121 (build-system gnu-build-system)
124 ;; tests require a writable HOME
128 (setenv "HOME" (getenv "TMPDIR")))
132 (let ((pcb (assoc-ref %build-inputs "pcb")))
133 (list (string-append "--with-pcb-datadir=" pcb "/share")
134 (string-append "--with-pcb-lib-path="
135 pcb "/share/pcb/pcblib-newlib:"
136 pcb "/share/pcb/newlib")))))
141 ("desktop-file-utils" ,desktop-file-utils)
142 ("shared-mime-info" ,shared-mime-info)
146 `(("pkg-config" ,pkg-config)
147 ("perl" ,perl))) ; for tests
148 (home-page "http://geda-project.org/")
149 (synopsis "Schematic capture, netlister, symbols, symbol checker, and utils")
151 "Gaf stands for “gschem and friends”. It is a subset of the entire tool
152 suite grouped together under the gEDA name. gEDA/gaf is a collection of tools
153 which currently includes: gschem, a schematic capture program; gnetlist, a
154 netlist generation program; gsymcheck, a syntax checker for schematic symbols;
155 gattrib, a spreadsheet programm that manipulates the properties of symbols of
156 a schematic; libgeda, libraries for gschem gnetlist and gsymcheck; gsch2pcb, a
157 tool to forward annotation from your schematic to layout using PCB; some minor
159 (license license:gpl2+)))
168 "http://ftp.geda-project.org/pcb/pcb-" version "/pcb-"
172 "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42"))))
173 (build-system gnu-build-system)
179 (substitute* "configure"
180 (("wish85") "wish8.6")))
183 (lambda* (#:key inputs outputs #:allow-other-keys)
184 ;; FIXME: Mesa tries to dlopen libudev.so.0 and fails. Pending a
185 ;; fix of the mesa package we wrap the pcb executable such that
186 ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
187 (let* ((out (assoc-ref outputs "out"))
188 (path (string-append (assoc-ref inputs "udev") "/lib")))
189 (wrap-program (string-append out "/bin/pcb")
190 `("LD_LIBRARY_PATH" ":" prefix (,path)))))
195 ("udev" ,eudev) ;FIXME: required by mesa
199 ("gtkglext" ,gtkglext)
200 ("desktop-file-utils" ,desktop-file-utils)
201 ("shared-mime-info" ,shared-mime-info)
204 `(("pkg-config" ,pkg-config)
205 ("intltool" ,intltool)
208 (home-page "http://pcb.geda-project.org/")
209 (synopsis "Design printed circuit board layouts")
211 "GNU PCB is an interactive tool for editing printed circuit board
212 layouts. It features a rats-nest implementation, schematic/netlist import,
213 and design rule checking. It also includes an autorouter and a trace
214 optimizer; and it can produce photorealistic and design review images.")
215 (license license:gpl2+)))
217 (define-public fastcap
220 (version "2.0-18Sep92")
222 (method url-fetch/tarbomb)
223 (file-name (string-append name "-" version ".tar.gz"))
224 (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
225 name "-" version ".tgz"))
228 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
230 ;; Remove a non-free file.
231 '(delete-file "doc/psfig.sty"))
232 (modules '((guix build utils)
233 (guix build download)
235 (patches (search-patches "fastcap-mulSetup.patch"
236 "fastcap-mulGlobal.patch"))))
237 (build-system gnu-build-system)
239 `(("texlive" ,texlive)
240 ("ghostscript" ,ghostscript)))
242 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
244 #:tests? #f ;; no tests-suite
245 #:modules ((srfi srfi-1)
246 ,@%gnu-build-system-modules)
248 (modify-phases %standard-phases
249 (add-after 'build 'make-doc
251 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
253 (add-before 'make-doc 'fix-doc
255 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
256 (substitute* (find-files "doc" "\\.tex")
257 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
259 (string-append "\\includegraphics[scale=" scale "]{"
261 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
263 (string-append "\\includegraphics[width=" width "]{"
265 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
267 (string-append "\\includegraphics[height=" height "]{"
269 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
270 (string-append "\\includegraphics{" file "}")))
271 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
272 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
274 (string-append "\\documentclass[" options "]{"
276 "\\usepackage{graphicx}\n"
277 "\\usepackage{robinspace}"))
278 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
279 (string-append "%" all))
280 (("\\\\setstretch\\{.*\\}" all)
281 (string-append "%" all)))
284 (add-before 'install 'clean-bin
286 (delete-file (string-append (getcwd) "/bin/README"))
288 (add-before 'install 'make-pdf
290 (with-directory-excursion "doc"
292 (every (lambda (file)
293 (zero? (system* "dvips" file "-o")))
294 (find-files "." "\\.dvi"))
295 (every (lambda (file)
296 (zero? (system* "ps2pdf" file)))
297 '("mtt.ps" "ug.ps" "tcad.ps"))
298 (zero? (system* "make" "clean"))))))
300 (lambda* (#:key outputs #:allow-other-keys)
301 (let* ((out (assoc-ref outputs "out"))
302 (data (string-append out "/share"))
303 (bin (string-append out "/bin"))
304 (doc (string-append data "/doc/" ,name "-" ,version))
305 (examples (string-append doc "/examples")))
306 (with-directory-excursion "bin"
307 (for-each (lambda (f)
308 (install-file f bin))
309 (find-files "." ".*")))
310 (copy-recursively "doc" doc)
311 (copy-recursively "examples" examples)
313 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
314 (synopsis "Multipole-accelerated capacitance extraction program")
316 "Fastcap is a capacitance extraction program based on a
317 multipole-accelerated algorithm.")
318 (license (license:non-copyleft #f "See fastcap.c."))))
320 (define-public fasthenry
323 (version "3.0-12Nov96")
326 (file-name (string-append name "-" version ".tar.gz"))
328 "http://www.rle.mit.edu/cpg/codes/" name
329 "-" version ".tar.z"))
331 (base32 "1a06xyyd40zhknrkz17xppl2zd5ig4w9g1grc8qrs0zqqcl5hpzi"))
332 (patches (search-patches "fasthenry-spAllocate.patch"
333 "fasthenry-spBuild.patch"
334 "fasthenry-spUtils.patch"
335 "fasthenry-spSolve.patch"
336 "fasthenry-spFactor.patch"))))
337 (build-system gnu-build-system)
339 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
341 #:tests? #f ;; no tests-suite
342 #:modules ((srfi srfi-1)
343 ,@%gnu-build-system-modules)
345 (modify-phases %standard-phases
348 (lambda* (#:key outputs #:allow-other-keys)
349 (let* ((out (assoc-ref outputs "out"))
350 (data (string-append out "/share"))
351 (bin (string-append out "/bin"))
352 (doc (string-append data "/doc/" ,name "-" ,version))
353 (examples (string-append doc "/examples")))
354 (with-directory-excursion "bin"
355 (for-each (lambda (f)
356 (install-file f bin))
357 (find-files "." ".*")))
358 (copy-recursively "doc" doc)
359 (copy-recursively "examples" examples)
361 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
362 (synopsis "Multipole-accelerated inductance analysis program")
364 "Fasthenry is an inductance extraction program based on a
365 multipole-accelerated algorithm.")
366 (license (license:non-copyleft #f "See induct.c."))))
368 (define-public fritzing
374 (uri (string-append "https://github.com/fritzing/"
375 "fritzing-app/archive/" version ".tar.gz"))
376 (file-name (string-append name "-" version ".tar.gz"))
379 "0pvk57z2pxz89pcwwm61lkpvj4w9qxqz8mi0zkpj6pnaljabp7bf"))))
380 (build-system gnu-build-system)
383 (modify-phases %standard-phases
385 (lambda* (#:key inputs outputs #:allow-other-keys)
386 (and (zero? (system* "tar"
387 "-xvf" (assoc-ref inputs "fritzing-parts-db")
389 (zero? (system* "qmake"
390 (string-append "PREFIX="
391 (assoc-ref outputs "out"))
392 "phoenix.pro"))))))))
400 (uri (string-append "https://github.com/fritzing/"
401 "fritzing-parts/archive/" version ".tar.gz"))
402 (file-name (string-append "fritzing-parts-" version ".tar.gz"))
405 "0jqr8yjg7177f3pk1fcns584r0qavwpr280nggsi2ff3pwk5wpsz"))))))
406 (home-page "http://fritzing.org")
407 (synopsis "Electronic circuit design")
409 "The Fritzing application is @dfn{Electronic Design Automation} (EDA)
410 software with a low entry barrier, suited for the needs of makers and
411 hobbyists. It offers a unique real-life \"breadboard\" view, and a parts
412 library with many commonly used high-level components. Fritzing makes it very
413 easy to communicate about circuits, as well as to turn them into PCB layouts
414 ready for production.")
415 ;; Documentation and parts are released under CC-BY-SA 3.0; source code is
416 ;; released under GPLv3+.
417 (license (list license:gpl3+ license:cc-by-sa3.0))))
425 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
426 version "/gerbv-" version ".tar.gz"))
429 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
430 (build-system gnu-build-system)
433 (modify-phases %standard-phases
434 (add-before 'configure 'autoconf
436 ;; Build rules contain references to Russian translation, but the
437 ;; needed files are missing; see
438 ;; http://sourceforge.net/p/gerbv/bugs/174/
439 (delete-file "po/LINGUAS")
440 (substitute* "man/Makefile.am"
441 (("PO_FILES= gerbv.ru.1.in.po") "")
442 (("man_MANS = gerbv.1 gerbv.ru.1") "man_MANS = gerbv.1"))
443 (zero? (system* "autoreconf" "-vfi")))))))
445 `(("autoconf" ,autoconf)
446 ("automake" ,automake)
448 ("gettext" ,gnu-gettext)
450 ("pkg-config" ,pkg-config)))
454 ("desktop-file-utils" ,desktop-file-utils)))
455 (home-page "http://gerbv.geda-project.org/")
456 (synopsis "Gerber file viewer")
458 "Gerbv is a viewer for files in the Gerber format (RS-274X only), which
459 is commonly used to represent printed circuit board (PCB) layouts. Gerbv lets
460 you load several files on top of each other, do measurements on the displayed
461 image, etc. Besides viewing Gerbers, you may also view Excellon drill files
462 as well as pick-place files.")
463 (license license:gpl2+)))