1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages engineering)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix gexp)
24 #:use-module (guix git-download)
25 #:use-module (guix monads)
26 #:use-module (guix store)
27 #:use-module (guix utils)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system gnu)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gd)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages gl)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages guile)
46 #:use-module (gnu packages linux) ;FIXME: for pcb
47 #:use-module (gnu packages maths)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages qt)
51 #:use-module (gnu packages tcl)
52 #:use-module (gnu packages texlive)
53 #:use-module (srfi srfi-1))
55 (define-public librecad
62 "https://github.com/LibreCAD/LibreCAD/archive/"
64 (file-name (string-append name "-" version))
67 "1n1mh8asj6yrl5hi438dvizmrbqk1kni5xkizhi3pdmkg7z3hksm"))))
68 (build-system gnu-build-system)
74 (lambda* (#:key outputs #:allow-other-keys)
75 (let ((out (assoc-ref outputs "out")))
76 (substitute* "librecad/src/lib/engine/rs_system.cpp"
77 (("/usr/share") (string-append out "/share")))))
80 (lambda* (#:key inputs #:allow-other-keys)
81 (system* "qmake" (string-append "BOOST_DIR="
82 (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"))))
96 ("muparser" ,muparser)
97 ("freetype" ,freetype)
100 `(("pkg-config" ,pkg-config)
102 (home-page "http://librecad.org/")
103 (synopsis "Computer-aided design (CAD) application")
105 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
107 (license license:gpl2)))
109 (define-public geda-gaf
116 "http://ftp.geda-project.org/geda-gaf/stable/v"
117 (version-major+minor version) "/"
118 version "/geda-gaf-" version ".tar.gz"))
121 "08dpa506xk4gjbbi8vnxcb640wq4ihlgmhzlssl52nhvxwx7gx5v"))))
122 (build-system gnu-build-system)
125 ;; tests require a writable HOME
129 (setenv "HOME" (getenv "TMPDIR")))
135 ("desktop-file-utils" ,desktop-file-utils)
136 ("shared-mime-info" ,shared-mime-info)))
138 `(("pkg-config" ,pkg-config)
139 ("perl" ,perl))) ; for tests
140 (home-page "http://geda-project.org/")
141 (synopsis "Schematic capture, netlister, symbols, symbol checker, and utils")
143 "Gaf stands for “gschem and friends”. It is a subset of the entire tool
144 suite grouped together under the gEDA name. gEDA/gaf is a collection of tools
145 which currently includes: gschem, a schematic capture program; gnetlist, a
146 netlist generation program; gsymcheck, a syntax checker for schematic symbols;
147 gattrib, a spreadsheet programm that manipulates the properties of symbols of
148 a schematic; libgeda, libraries for gschem gnetlist and gsymcheck; gsch2pcb, a
149 tool to forward annotation from your schematic to layout using PCB; some minor
151 (license license:gpl2+)))
160 "http://ftp.geda-project.org/pcb/pcb-" version "/pcb-"
164 "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42"))))
165 (build-system gnu-build-system)
171 (substitute* "configure"
172 (("wish85") "wish8.6")))
175 (lambda* (#:key inputs outputs #:allow-other-keys)
176 ;; FIXME: Mesa tries to dlopen libudev.so.0 and fails. Pending a
177 ;; fix of the mesa package we wrap the pcb executable such that
178 ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
179 (let* ((out (assoc-ref outputs "out"))
180 (path (string-append (assoc-ref inputs "udev") "/lib")))
181 (wrap-program (string-append out "/bin/pcb")
182 `("LD_LIBRARY_PATH" ":" prefix (,path)))))
187 ("udev" ,eudev) ;FIXME: required by mesa
191 ("gtkglext" ,gtkglext)
192 ("desktop-file-utils" ,desktop-file-utils)
193 ("shared-mime-info" ,shared-mime-info)
196 `(("pkg-config" ,pkg-config)
197 ("intltool" ,intltool)
200 (home-page "http://pcb.geda-project.org/")
201 (synopsis "Design printed circuit board layouts")
203 "GNU PCB is an interactive tool for editing printed circuit board
204 layouts. It features a rats-nest implementation, schematic/netlist import,
205 and design rule checking. It also includes an autorouter and a trace
206 optimizer; and it can produce photorealistic and design review images.")
207 (license license:gpl2+)))
209 (define* (broken-tarball-fetch url hash-algo hash
211 #:key (system (%current-system))
212 (guile (default-guile)))
213 (mlet %store-monad ((drv (url-fetch url hash-algo hash
214 (string-append "tarbomb-" name)
217 ;; Take the tar bomb, and simply unpack it as a directory.
218 (gexp->derivation name
222 (string-append #$gzip "/bin"))
224 (zero? (system* (string-append #$tar "/bin/tar")
228 (define-public fastcap
231 (version "2.0-18Sep92")
233 (method broken-tarball-fetch)
234 (file-name (string-append name "-" version ".tar.gz"))
235 (uri (string-append "http://www.rle.mit.edu/cpg/codes/"
236 name "-" version ".tgz"))
239 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
241 ;; Remove a non-free file.
242 '(delete-file "doc/psfig.sty"))
243 (modules '((guix build utils)
244 (guix build download)
246 (patches (list (search-patch "fastcap-mulSetup.patch")
247 (search-patch "fastcap-mulGlobal.patch")))))
248 (build-system gnu-build-system)
250 `(("texlive" ,texlive)
251 ("ghostscript" ,ghostscript)))
253 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
255 #:tests? #f ;; no tests-suite
256 #:modules ((srfi srfi-1)
257 ,@%gnu-build-system-modules)
259 (modify-phases %standard-phases
260 (add-after 'build 'make-doc
262 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
264 (add-before 'make-doc 'fix-doc
266 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
267 (substitute* (find-files "doc" "\\.tex")
268 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
270 (string-append "\\includegraphics[scale=" scale "]{"
272 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
274 (string-append "\\includegraphics[width=" width "]{"
276 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
278 (string-append "\\includegraphics[height=" height "]{"
280 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
281 (string-append "\\includegraphics{" file "}")))
282 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
283 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
285 (string-append "\\documentclass[" options "]{"
287 "\\usepackage{graphicx}\n"
288 "\\usepackage{robinspace}"))
289 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
290 (string-append "%" all))
291 (("\\\\setstretch\\{.*\\}" all)
292 (string-append "%" all)))
295 (add-before 'install 'clean-bin
297 (delete-file (string-append (getcwd) "/bin/README"))
299 (add-before 'install 'make-pdf
301 (with-directory-excursion "doc"
303 (every (lambda (file)
304 (zero? (system* "dvips" file "-o")))
305 (find-files "." "\\.dvi"))
306 (every (lambda (file)
307 (zero? (system* "ps2pdf" file)))
308 '("mtt.ps" "ug.ps" "tcad.ps"))
309 (zero? (system* "make" "clean"))))))
311 (lambda* (#:key outputs #:allow-other-keys)
312 (let* ((out (assoc-ref outputs "out"))
313 (data (string-append out "/share"))
314 (bin (string-append out "/bin"))
315 (doc (string-append data "/doc/" ,name "-" ,version))
316 (examples (string-append doc "/examples")))
317 (with-directory-excursion "bin"
318 (for-each (lambda (f)
319 (install-file f bin))
320 (find-files "." ".*")))
321 (copy-recursively "doc" doc)
322 (copy-recursively "examples" examples)
324 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
325 (synopsis "Multipole-accelerated capacitance extraction program")
327 "Fastcap is a capacitance extraction program based on a
328 multipole-accelerated algorithm.")
329 (license (license:non-copyleft #f "See fastcap.c."))))
331 (define-public fasthenry
334 (version "3.0-12Nov96")
337 (file-name (string-append name "-" version ".tar.gz"))
339 "http://www.rle.mit.edu/cpg/codes/" name
340 "-" version ".tar.z"))
342 (base32 "1a06xyyd40zhknrkz17xppl2zd5ig4w9g1grc8qrs0zqqcl5hpzi"))
343 (patches (list (search-patch "fasthenry-spAllocate.patch")
344 (search-patch "fasthenry-spBuild.patch")
345 (search-patch "fasthenry-spUtils.patch")
346 (search-patch "fasthenry-spSolve.patch")
347 (search-patch "fasthenry-spFactor.patch")))))
348 (build-system gnu-build-system)
350 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
352 #:tests? #f ;; no tests-suite
353 #:modules ((srfi srfi-1)
354 ,@%gnu-build-system-modules)
356 (modify-phases %standard-phases
359 (lambda* (#:key outputs #:allow-other-keys)
360 (let* ((out (assoc-ref outputs "out"))
361 (data (string-append out "/share"))
362 (bin (string-append out "/bin"))
363 (doc (string-append data "/doc/" ,name "-" ,version))
364 (examples (string-append doc "/examples")))
365 (with-directory-excursion "bin"
366 (for-each (lambda (f)
367 (install-file f bin))
368 (find-files "." ".*")))
369 (copy-recursively "doc" doc)
370 (copy-recursively "examples" examples)
372 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
373 (synopsis "Multipole-accelerated inductance analysis program")
375 "Fasthenry is an inductance extraction program based on a
376 multipole-accelerated algorithm.")
377 (license (license:non-copyleft #f "See induct.c."))))
385 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
386 version "/gerbv-" version ".tar.gz"))
389 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
390 (build-system gnu-build-system)
393 (modify-phases %standard-phases
394 (add-before 'configure 'autoconf
396 ;; Build rules contain references to Russian translation, but the
397 ;; needed files are missing; see
398 ;; http://sourceforge.net/p/gerbv/bugs/174/
399 (delete-file "po/LINGUAS")
400 (substitute* "man/Makefile.am"
401 (("PO_FILES= gerbv.ru.1.in.po") "")
402 (("man_MANS = gerbv.1 gerbv.ru.1") "man_MANS = gerbv.1"))
403 (zero? (system* "autoreconf" "-vfi")))))))
405 `(("autoconf" ,autoconf)
406 ("automake" ,automake)
408 ("gettext" ,gnu-gettext)
410 ("pkg-config" ,pkg-config)))
414 ("desktop-file-utils" ,desktop-file-utils)))
415 (home-page "http://gerbv.geda-project.org/")
416 (synopsis "Gerber file viewer")
418 "Gerbv is a viewer for files in the Gerber format (RS-274X only), which
419 is commonly used to represent printed circuit board (PCB) layouts. Gerbv lets
420 you load several files on top of each other, do measurements on the displayed
421 image, etc. Besides viewing Gerbers, you may also view Excellon drill files
422 as well as pick-place files.")
423 (license license:gpl2+)))