Commit | Line | Data |
---|---|---|
ffb010b5 RW |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> | |
93094501 | 3 | ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> |
ffb010b5 RW |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
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. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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/>. | |
19 | ||
40fbd52a | 20 | (define-module (gnu packages engineering) |
ffb010b5 RW |
21 | #:use-module (guix packages) |
22 | #:use-module (guix download) | |
93094501 | 23 | #:use-module (guix gexp) |
ffb010b5 | 24 | #:use-module (guix git-download) |
93094501 FB |
25 | #:use-module (guix monads) |
26 | #:use-module (guix store) | |
412726ee | 27 | #:use-module (guix utils) |
ffb010b5 RW |
28 | #:use-module ((guix licenses) #:prefix license:) |
29 | #:use-module (guix build-system gnu) | |
30 | #:use-module (gnu packages) | |
95283f3f | 31 | #:use-module (gnu packages autotools) |
5699a3cf | 32 | #:use-module (gnu packages base) |
20500662 | 33 | #:use-module (gnu packages bison) |
ffb010b5 | 34 | #:use-module (gnu packages boost) |
93094501 | 35 | #:use-module (gnu packages compression) |
20500662 | 36 | #:use-module (gnu packages flex) |
ffb010b5 | 37 | #:use-module (gnu packages fontutils) |
20500662 | 38 | #:use-module (gnu packages gd) |
95283f3f | 39 | #:use-module (gnu packages gettext) |
93094501 | 40 | #:use-module (gnu packages ghostscript) |
20500662 | 41 | #:use-module (gnu packages gl) |
412726ee RW |
42 | #:use-module (gnu packages glib) |
43 | #:use-module (gnu packages gnome) | |
44 | #:use-module (gnu packages gtk) | |
45 | #:use-module (gnu packages guile) | |
38cf2ba0 | 46 | #:use-module (gnu packages linux) ;FIXME: for pcb |
ffb010b5 | 47 | #:use-module (gnu packages maths) |
412726ee | 48 | #:use-module (gnu packages perl) |
ffb010b5 RW |
49 | #:use-module (gnu packages pkg-config) |
50 | #:use-module (gnu packages qt) | |
20500662 | 51 | #:use-module (gnu packages tcl) |
93094501 | 52 | #:use-module (gnu packages texlive) |
ffb010b5 RW |
53 | #:use-module (srfi srfi-1)) |
54 | ||
55 | (define-public librecad | |
56 | (package | |
57 | (name "librecad") | |
58 | (version "2.0.6-rc") | |
59 | (source (origin | |
60 | (method url-fetch) | |
61 | (uri (string-append | |
62 | "https://github.com/LibreCAD/LibreCAD/archive/" | |
63 | version ".tar.gz")) | |
64 | (file-name (string-append name "-" version)) | |
65 | (sha256 | |
66 | (base32 | |
67 | "1n1mh8asj6yrl5hi438dvizmrbqk1kni5xkizhi3pdmkg7z3hksm")))) | |
68 | (build-system gnu-build-system) | |
69 | (arguments | |
70 | '(#:phases | |
71 | (alist-cons-after | |
72 | 'unpack | |
73 | 'patch-paths | |
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"))))) | |
78 | (alist-replace | |
79 | 'configure | |
80 | (lambda* (#:key inputs #:allow-other-keys) | |
81 | (system* "qmake" (string-append "BOOST_DIR=" | |
82 | (assoc-ref inputs "boost")))) | |
83 | (alist-replace | |
84 | '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 | %standard-phases))))) | |
94 | (inputs | |
95 | `(("boost" ,boost) | |
96 | ("muparser" ,muparser) | |
97 | ("freetype" ,freetype) | |
98 | ("qt" ,qt-4))) | |
99 | (native-inputs | |
100 | `(("pkg-config" ,pkg-config) | |
101 | ("which" ,which))) | |
102 | (home-page "http://librecad.org/") | |
103 | (synopsis "Computer-aided design (CAD) application") | |
104 | (description | |
105 | "LibreCAD is a 2D Computer-aided design (CAD) application for creating | |
106 | plans and designs.") | |
107 | (license license:gpl2))) | |
412726ee RW |
108 | |
109 | (define-public geda-gaf | |
110 | (package | |
111 | (name "geda-gaf") | |
112 | (version "1.8.2") | |
113 | (source (origin | |
114 | (method url-fetch) | |
115 | (uri (string-append | |
116 | "http://ftp.geda-project.org/geda-gaf/stable/v" | |
117 | (version-major+minor version) "/" | |
118 | version "/geda-gaf-" version ".tar.gz")) | |
119 | (sha256 | |
120 | (base32 | |
121 | "08dpa506xk4gjbbi8vnxcb640wq4ihlgmhzlssl52nhvxwx7gx5v")))) | |
122 | (build-system gnu-build-system) | |
123 | (arguments | |
124 | '(#:phases | |
125 | ;; tests require a writable HOME | |
126 | (alist-cons-before | |
127 | 'check 'set-home | |
128 | (lambda _ | |
129 | (setenv "HOME" (getenv "TMPDIR"))) | |
130 | %standard-phases))) | |
131 | (inputs | |
132 | `(("glib" ,glib) | |
133 | ("gtk" ,gtk+-2) | |
134 | ("guile" ,guile-2.0) | |
135 | ("desktop-file-utils" ,desktop-file-utils) | |
136 | ("shared-mime-info" ,shared-mime-info))) | |
137 | (native-inputs | |
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") | |
142 | (description | |
a124bbd2 | 143 | "Gaf stands for “gschem and friends”. It is a subset of the entire tool |
412726ee RW |
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 | |
150 | utilities.") | |
151 | (license license:gpl2+))) | |
152 | ||
20500662 RW |
153 | (define-public pcb |
154 | (package | |
155 | (name "pcb") | |
156 | (version "20140316") | |
157 | (source (origin | |
158 | (method url-fetch) | |
159 | (uri (string-append | |
160 | "http://ftp.geda-project.org/pcb/pcb-" version "/pcb-" | |
161 | version ".tar.gz")) | |
162 | (sha256 | |
163 | (base32 | |
164 | "0l6944hq79qsyp60i5ai02xwyp8l47q7xdm3js0jfkpf72ag7i42")))) | |
165 | (build-system gnu-build-system) | |
166 | (arguments | |
167 | `(#:phases | |
168 | (alist-cons-after | |
169 | 'unpack 'use-wish8.6 | |
170 | (lambda _ | |
171 | (substitute* "configure" | |
172 | (("wish85") "wish8.6"))) | |
173 | (alist-cons-after | |
174 | 'install 'wrap | |
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))))) | |
183 | %standard-phases)))) | |
184 | (inputs | |
185 | `(("dbus" ,dbus) | |
186 | ("mesa" ,mesa) | |
187 | ("udev" ,eudev) ;FIXME: required by mesa | |
188 | ("glu" ,glu) | |
189 | ("gd" ,gd) | |
190 | ("gtk" ,gtk+-2) | |
191 | ("gtkglext" ,gtkglext) | |
192 | ("desktop-file-utils" ,desktop-file-utils) | |
193 | ("shared-mime-info" ,shared-mime-info) | |
194 | ("tk" ,tk))) | |
195 | (native-inputs | |
196 | `(("pkg-config" ,pkg-config) | |
197 | ("intltool" ,intltool) | |
198 | ("bison" ,bison) | |
199 | ("flex" ,flex))) | |
200 | (home-page "http://pcb.geda-project.org/") | |
201 | (synopsis "Design printed circuit board layouts") | |
202 | (description | |
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+))) | |
93094501 FB |
208 | |
209 | (define* (broken-tarball-fetch url hash-algo hash | |
210 | #:optional name | |
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) | |
215 | #:system system | |
216 | #:guile guile))) | |
217 | ;; Take the tar bomb, and simply unpack it as a directory. | |
218 | (gexp->derivation name | |
219 | #~(begin | |
220 | (mkdir #$output) | |
221 | (setenv "PATH" | |
222 | (string-append #$gzip "/bin")) | |
223 | (chdir #$output) | |
224 | (zero? (system* (string-append #$tar "/bin/tar") | |
225 | "xf" #$drv)))))) | |
226 | ||
227 | ||
228 | (define-public fastcap | |
229 | (package | |
230 | (name "fastcap") | |
231 | (version "2.0-18Sep92") | |
232 | (source (origin | |
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")) | |
237 | (sha256 | |
238 | (base32 | |
239 | "0x37vfp6k0d2z3gnig0hbicvi0jp8v267xjnn3z8jdllpiaa6p3k")) | |
3dac53be FB |
240 | (snippet |
241 | ;; Remove a non-free file. | |
242 | '(delete-file "doc/psfig.sty")) | |
93094501 FB |
243 | (modules '((guix build utils) |
244 | (guix build download) | |
245 | (guix ftp-client))) | |
246 | (patches (list (search-patch "fastcap-mulSetup.patch") | |
247 | (search-patch "fastcap-mulGlobal.patch"))))) | |
248 | (build-system gnu-build-system) | |
249 | (native-inputs | |
250 | `(("texlive" ,texlive) | |
251 | ("ghostscript" ,ghostscript))) | |
252 | (arguments | |
253 | `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all") | |
254 | #:parallel-build? #f | |
255 | #:tests? #f ;; no tests-suite | |
256 | #:modules ((srfi srfi-1) | |
257 | ,@%gnu-build-system-modules) | |
258 | #:phases | |
259 | (modify-phases %standard-phases | |
260 | (add-after 'build 'make-doc | |
261 | (lambda _ | |
262 | (zero? (system* "make" "CC=gcc" "RM=rm" "SHELL=sh" | |
263 | "manual")))) | |
264 | (add-before 'make-doc 'fix-doc | |
265 | (lambda _ | |
266 | (substitute* "doc/Makefile" (("/bin/rm") (which "rm"))) | |
267 | (substitute* (find-files "doc" "\\.tex") | |
268 | (("\\\\special\\{psfile=([^,]*),.*scale=([#0-9.]*).*\\}" | |
269 | all file scale) | |
270 | (string-append "\\includegraphics[scale=" scale "]{" | |
1f7ffd6f FB |
271 | file "}")) |
272 | (("\\\\psfig\\{figure=([^,]*),.*width=([#0-9.]*in).*\\}" | |
273 | all file width) | |
274 | (string-append "\\includegraphics[width=" width "]{" | |
275 | file "}")) | |
276 | (("\\\\psfig\\{figure=([^,]*),.*height=([#0-9.]*in).*\\}" | |
277 | all file height) | |
278 | (string-append "\\includegraphics[height=" height "]{" | |
279 | file "}")) | |
280 | (("\\\\psfig\\{figure=([^,]*)\\}" all file) | |
281 | (string-append "\\includegraphics{" file "}"))) | |
282 | (substitute* '("doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex") | |
93094501 FB |
283 | (("^\\\\documentstyle\\[(.*)\\]\\{(.*)\\}" |
284 | all options class) | |
285 | (string-append "\\documentclass[" options "]{" | |
286 | class "}\n" | |
287 | "\\usepackage{graphicx}\n" | |
288 | "\\usepackage{robinspace}")) | |
289 | (("\\\\setlength\\{\\\\footheight\\}\\{.*\\}" all) | |
290 | (string-append "%" all)) | |
291 | (("\\\\setstretch\\{.*\\}" all) | |
292 | (string-append "%" all))) | |
293 | #t)) | |
294 | (delete 'configure) | |
295 | (add-before 'install 'clean-bin | |
296 | (lambda _ | |
297 | (delete-file (string-append (getcwd) "/bin/README")) | |
298 | #t)) | |
299 | (add-before 'install 'make-pdf | |
300 | (lambda _ | |
301 | (with-directory-excursion "doc" | |
302 | (and | |
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")))))) | |
310 | (replace 'install | |
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" | |
96c46210 LC |
318 | (for-each (lambda (f) |
319 | (install-file f bin)) | |
320 | (find-files "." ".*"))) | |
93094501 FB |
321 | (copy-recursively "doc" doc) |
322 | (copy-recursively "examples" examples) | |
323 | #t)))))) | |
324 | (home-page "http://www.rle.mit.edu/cpg/research_codes.htm") | |
325 | (synopsis "Multipole-accelerated capacitance extraction program") | |
326 | (description | |
327 | "Fastcap is a capacitance extraction program based on a | |
328 | multipole-accelerated algorithm.") | |
329 | (license (license:non-copyleft #f "See fastcap.c.")))) | |
23bae7bb FB |
330 | |
331 | (define-public fasthenry | |
332 | (package | |
333 | (name "fasthenry") | |
334 | (version "3.0-12Nov96") | |
335 | (source (origin | |
336 | (method url-fetch) | |
337 | (file-name (string-append name "-" version ".tar.gz")) | |
338 | (uri (string-append | |
339 | "http://www.rle.mit.edu/cpg/codes/" name | |
340 | "-" version ".tar.z")) | |
341 | (sha256 | |
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) | |
349 | (arguments | |
350 | `(#:make-flags '("CC=gcc" "RM=rm" "SHELL=sh" "all") | |
351 | #:parallel-build? #f | |
352 | #:tests? #f ;; no tests-suite | |
353 | #:modules ((srfi srfi-1) | |
354 | ,@%gnu-build-system-modules) | |
355 | #:phases | |
356 | (modify-phases %standard-phases | |
357 | (delete 'configure) | |
358 | (replace 'install | |
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" | |
96c46210 LC |
366 | (for-each (lambda (f) |
367 | (install-file f bin)) | |
368 | (find-files "." ".*"))) | |
23bae7bb FB |
369 | (copy-recursively "doc" doc) |
370 | (copy-recursively "examples" examples) | |
371 | #t)))))) | |
372 | (home-page "http://www.rle.mit.edu/cpg/research_codes.htm") | |
373 | (synopsis "Multipole-accelerated inductance analysis program") | |
374 | (description | |
375 | "Fasthenry is an inductance extraction program based on a | |
376 | multipole-accelerated algorithm.") | |
377 | (license (license:non-copyleft #f "See induct.c.")))) | |
95283f3f RW |
378 | |
379 | (define-public gerbv | |
380 | (package | |
381 | (name "gerbv") | |
382 | (version "2.6.1") | |
383 | (source (origin | |
384 | (method url-fetch) | |
385 | (uri (string-append "mirror://sourceforge/gerbv/gerbv/gerbv-" | |
386 | version "/gerbv-" version ".tar.gz")) | |
387 | (sha256 | |
388 | (base32 | |
389 | "0v6ry0mxi5qym4z0y0lpblxsw9dfjpgxs4c4v2ngg7yw4b3a59ks")))) | |
390 | (build-system gnu-build-system) | |
391 | (arguments | |
392 | `(#:phases | |
393 | (modify-phases %standard-phases | |
394 | (add-before 'configure 'autoconf | |
395 | (lambda _ | |
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"))))))) | |
404 | (native-inputs | |
405 | `(("autoconf" ,autoconf) | |
406 | ("automake" ,automake) | |
407 | ("libtool" ,libtool) | |
408 | ("gettext" ,gnu-gettext) | |
409 | ("po4a" ,po4a) | |
410 | ("pkg-config" ,pkg-config))) | |
411 | (inputs | |
412 | `(("cairo" ,cairo) | |
413 | ("gtk" ,gtk+-2) | |
414 | ("desktop-file-utils" ,desktop-file-utils))) | |
415 | (home-page "http://gerbv.geda-project.org/") | |
416 | (synopsis "Gerber file viewer") | |
417 | (description | |
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+))) |