gnu: Add poppler-qt5.
[jackhill/guix/guix.git] / gnu / packages / engineering.scm
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>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
57
58 (define-public librecad
59 (package
60 (name "librecad")
61 (version "2.0.9")
62 (source (origin
63 (method url-fetch)
64 (uri (string-append
65 "https://github.com/LibreCAD/LibreCAD/archive/"
66 version ".tar.gz"))
67 (file-name (string-append name "-" version ".tar.gz"))
68 (sha256
69 (base32
70 "0xyn4ps9ia94h0vg53rsww8xfd1bgp4200phl8ihyhv7w5v4d8d0"))))
71 (build-system gnu-build-system)
72 (arguments
73 '(#:phases
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"))))))
80 (replace 'configure
81 (lambda* (#:key inputs #:allow-other-keys)
82 (system* "qmake" (string-append "BOOST_DIR="
83 (assoc-ref inputs "boost")))))
84 (replace 'install
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"))))))))
93 (inputs
94 `(("boost" ,boost)
95 ("muparser" ,muparser)
96 ("freetype" ,freetype)
97 ("qt" ,qt)))
98 (native-inputs
99 `(("pkg-config" ,pkg-config)
100 ("which" ,which)))
101 (home-page "http://librecad.org/")
102 (synopsis "Computer-aided design (CAD) application")
103 (description
104 "LibreCAD is a 2D Computer-aided design (CAD) application for creating
105 plans and designs.")
106 (license license:gpl2)))
107
108 (define-public geda-gaf
109 (package
110 (name "geda-gaf")
111 (version "1.8.2")
112 (source (origin
113 (method url-fetch)
114 (uri (string-append
115 "http://ftp.geda-project.org/geda-gaf/stable/v"
116 (version-major+minor version) "/"
117 version "/geda-gaf-" version ".tar.gz"))
118 (sha256
119 (base32
120 "08dpa506xk4gjbbi8vnxcb640wq4ihlgmhzlssl52nhvxwx7gx5v"))))
121 (build-system gnu-build-system)
122 (arguments
123 '(#:phases
124 ;; tests require a writable HOME
125 (alist-cons-before
126 'check 'set-home
127 (lambda _
128 (setenv "HOME" (getenv "TMPDIR")))
129 %standard-phases
130 )
131 #:configure-flags
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")))))
137 (inputs
138 `(("glib" ,glib)
139 ("gtk" ,gtk+-2)
140 ("guile" ,guile-2.0)
141 ("desktop-file-utils" ,desktop-file-utils)
142 ("shared-mime-info" ,shared-mime-info)
143 ("m4" ,m4)
144 ("pcb" ,pcb)))
145 (native-inputs
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")
150 (description
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
158 utilities.")
159 (license license:gpl2+)))
160
161 (define-public pcb
162 (package
163 (name "pcb")
164 (version "20140316")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append
168 "http://ftp.geda-project.org/pcb/pcb-" version "/pcb-"
169 version ".tar.gz"))
170 (sha256
171 (base32
172 "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42"))))
173 (build-system gnu-build-system)
174 (arguments
175 `(#:phases
176 (alist-cons-after
177 'unpack 'use-wish8.6
178 (lambda _
179 (substitute* "configure"
180 (("wish85") "wish8.6")))
181 (alist-cons-after
182 'install 'wrap
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)))))
191 %standard-phases))))
192 (inputs
193 `(("dbus" ,dbus)
194 ("mesa" ,mesa)
195 ("udev" ,eudev) ;FIXME: required by mesa
196 ("glu" ,glu)
197 ("gd" ,gd)
198 ("gtk" ,gtk+-2)
199 ("gtkglext" ,gtkglext)
200 ("desktop-file-utils" ,desktop-file-utils)
201 ("shared-mime-info" ,shared-mime-info)
202 ("tk" ,tk)))
203 (native-inputs
204 `(("pkg-config" ,pkg-config)
205 ("intltool" ,intltool)
206 ("bison" ,bison)
207 ("flex" ,flex)))
208 (home-page "http://pcb.geda-project.org/")
209 (synopsis "Design printed circuit board layouts")
210 (description
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+)))
216
217 (define-public fastcap
218 (package
219 (name "fastcap")
220 (version "2.0-18Sep92")
221 (source (origin
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"))
226 (sha256
227 (base32
228 "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k"))
229 (snippet
230 ;; Remove a non-free file.
231 '(delete-file "doc/psfig.sty"))
232 (modules '((guix build utils)
233 (guix build download)
234 (guix ftp-client)))
235 (patches (search-patches "fastcap-mulSetup.patch"
236 "fastcap-mulGlobal.patch"))))
237 (build-system gnu-build-system)
238 (native-inputs
239 `(("texlive" ,texlive)
240 ("ghostscript" ,ghostscript)))
241 (arguments
242 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
243 #:parallel-build? #f
244 #:tests? #f ;; no tests-suite
245 #:modules ((srfi srfi-1)
246 ,@%gnu-build-system-modules)
247 #:phases
248 (modify-phases %standard-phases
249 (add-after 'build 'make-doc
250 (lambda _
251 (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh"
252 "manual"))))
253 (add-before 'make-doc 'fix-doc
254 (lambda _
255 (substitute* "doc/Makefile" (("/bin/rm") (which "rm")))
256 (substitute* (find-files "doc" "\\.tex")
257 (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}"
258 all file scale)
259 (string-append "\\includegraphics[scale=" scale "]{"
260 file "}"))
261 (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}"
262 all file width)
263 (string-append "\\includegraphics[width=" width "]{"
264 file "}"))
265 (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}"
266 all file height)
267 (string-append "\\includegraphics[height=" height "]{"
268 file "}"))
269 (("\\\\psfig\\{figure=([^,]*)\\}" all file)
270 (string-append "\\includegraphics{" file "}")))
271 (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex")
272 (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}"
273 all options class)
274 (string-append "\\documentclass[" options "]{"
275 class "}\n"
276 "\\usepackage{graphicx}\n"
277 "\\usepackage{robinspace}"))
278 (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all)
279 (string-append "%" all))
280 (("\\\\setstretch\\{.*\\}" all)
281 (string-append "%" all)))
282 #t))
283 (delete 'configure)
284 (add-before 'install 'clean-bin
285 (lambda _
286 (delete-file (string-append (getcwd) "/bin/README"))
287 #t))
288 (add-before 'install 'make-pdf
289 (lambda _
290 (with-directory-excursion "doc"
291 (and
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"))))))
299 (replace 'install
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)
312 #t))))))
313 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
314 (synopsis "Multipole-accelerated capacitance extraction program")
315 (description
316 "Fastcap is a capacitance extraction program based on a
317 multipole-accelerated algorithm.")
318 (license (license:non-copyleft #f "See fastcap.c."))))
319
320 (define-public fasthenry
321 (package
322 (name "fasthenry")
323 (version "3.0-12Nov96")
324 (source (origin
325 (method url-fetch)
326 (file-name (string-append name "-" version ".tar.gz"))
327 (uri (string-append
328 "http://www.rle.mit.edu/cpg/codes/" name
329 "-" version ".tar.z"))
330 (sha256
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)
338 (arguments
339 `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all")
340 #:parallel-build? #f
341 #:tests? #f ;; no tests-suite
342 #:modules ((srfi srfi-1)
343 ,@%gnu-build-system-modules)
344 #:phases
345 (modify-phases %standard-phases
346 (delete 'configure)
347 (replace 'install
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)
360 #t))))))
361 (home-page "http://www.rle.mit.edu/cpg/research_codes.htm")
362 (synopsis "Multipole-accelerated inductance analysis program")
363 (description
364 "Fasthenry is an inductance extraction program based on a
365 multipole-accelerated algorithm.")
366 (license (license:non-copyleft #f "See induct.c."))))
367
368 (define-public fritzing
369 (package
370 (name "fritzing")
371 (version "0.9.2b")
372 (source (origin
373 (method url-fetch)
374 (uri (string-append "https://github.com/fritzing/"
375 "fritzing-app/archive/" version ".tar.gz"))
376 (file-name (string-append name "-" version ".tar.gz"))
377 (sha256
378 (base32
379 "0pvk57z2pxz89pcwwm61lkpvj4w9qxqz8mi0zkpj6pnaljabp7bf"))))
380 (build-system gnu-build-system)
381 (arguments
382 `(#:phases
383 (modify-phases %standard-phases
384 (replace 'configure
385 (lambda* (#:key inputs outputs #:allow-other-keys)
386 (and (zero? (system* "tar"
387 "-xvf" (assoc-ref inputs "fritzing-parts-db")
388 "-C" "parts"))
389 (zero? (system* "qmake"
390 (string-append "PREFIX="
391 (assoc-ref outputs "out"))
392 "phoenix.pro"))))))))
393 (inputs
394 `(("qt" ,qt)
395 ("boost" ,boost)
396 ("zlib" ,zlib)
397 ("fritzing-parts-db"
398 ,(origin
399 (method url-fetch)
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"))
403 (sha256
404 (base32
405 "0jqr8yjg7177f3pk1fcns584r0qavwpr280nggsi2ff3pwk5wpsz"))))))
406 (home-page "http://fritzing.org")
407 (synopsis "Electronic circuit design")
408 (description
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))))
418
419 (define-public gerbv
420 (package
421 (name "gerbv")
422 (version "2.6.1")
423 (source (origin
424 (method url-fetch)
425 (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-"
426 version "/gerbv-" version ".tar.gz"))
427 (sha256
428 (base32
429 "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks"))))
430 (build-system gnu-build-system)
431 (arguments
432 `(#:phases
433 (modify-phases %standard-phases
434 (add-before 'configure 'autoconf
435 (lambda _
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")))))))
444 (native-inputs
445 `(("autoconf" ,autoconf)
446 ("automake" ,automake)
447 ("libtool" ,libtool)
448 ("gettext" ,gnu-gettext)
449 ("po4a" ,po4a)
450 ("pkg-config" ,pkg-config)))
451 (inputs
452 `(("cairo" ,cairo)
453 ("gtk" ,gtk+-2)
454 ("desktop-file-utils" ,desktop-file-utils)))
455 (home-page "http://gerbv.geda-project.org/")
456 (synopsis "Gerber file viewer")
457 (description
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+)))