gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / electronics.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
3 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019 Clément Lassieur <clement@lassieur.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages electronics)
22 #:use-module (guix utils)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system cmake)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages bash)
31 #:use-module (gnu packages boost)
32 #:use-module (gnu packages check)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages gawk)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages graphviz)
38 #:use-module (gnu packages libftdi)
39 #:use-module (gnu packages libusb)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages qt)
43 #:use-module (gnu packages sdcc))
44
45 (define-public libserialport
46 (package
47 (name "libserialport")
48 (version "0.1.1")
49 (source (origin
50 (method url-fetch)
51 (uri (string-append
52 "http://sigrok.org/download/source/libserialport/libserialport-"
53 version ".tar.gz"))
54 (sha256
55 (base32
56 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
57 (build-system gnu-build-system)
58 (home-page "https://sigrok.org/wiki/Libserialport")
59 (synopsis "Library for using serial ports")
60 (description "Libserialport is a minimal shared library written in C that is intended
61 to take care of the OS-specific details when writing software that uses serial ports.")
62 (license license:lgpl3+)))
63
64 (define-public libsigrokdecode
65 (package
66 (name "libsigrokdecode")
67 (version "0.5.3")
68 (source (origin
69 (method url-fetch)
70 (uri (string-append
71 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
72 version ".tar.gz"))
73 (sha256
74 (base32
75 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))))
76 (outputs '("out" "doc"))
77 (arguments
78 `(#:phases
79 (modify-phases %standard-phases
80 (add-after 'build 'build-doc
81 (lambda _
82 (invoke "doxygen")
83 #t))
84 (add-after 'install 'install-doc
85 (lambda* (#:key outputs #:allow-other-keys)
86 (copy-recursively "doxy/html-api"
87 (string-append (assoc-ref outputs "doc")
88 "/share/doc/libsigrokdecode"))
89 #t)))))
90 (native-inputs
91 `(("check" ,check)
92 ("doxygen" ,doxygen)
93 ("graphviz" ,graphviz)
94 ("pkg-config" ,pkg-config)))
95 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
96 (propagated-inputs
97 `(("glib" ,glib)
98 ("python" ,python)))
99 (build-system gnu-build-system)
100 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
101 (synopsis "Library providing (streaming) protocol decoding functionality")
102 (description "Libsigrokdecode is a shared library written in C, which provides
103 (streaming) protocol decoding functionality.")
104 (license license:gpl3+)))
105
106 (define-public sigrok-firmware-fx2lafw
107 (package
108 (name "sigrok-firmware-fx2lafw")
109 (version "0.1.7")
110 (source (origin
111 (method url-fetch)
112 (uri (string-append
113 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
114 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
115 (sha256
116 (base32
117 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
118 (arguments
119 `(#:implicit-inputs? #f))
120 (native-inputs
121 `(("awk" ,gawk)
122 ("bash" ,bash)
123 ("coreutils" ,coreutils)
124 ("grep" ,grep)
125 ("gzip" ,gzip)
126 ("make" ,gnu-make)
127 ("sdcc" ,sdcc)
128 ("sed" ,sed)
129 ("tar" ,tar)))
130 (build-system gnu-build-system)
131 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
132 (synopsis "Firmware for Cypress FX2 chips")
133 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
134 as simple logic analyzer and/or oscilloscope hardware.")
135 (license license:gpl2+)))
136
137 (define-public libsigrok
138 (package
139 (name "libsigrok")
140 (version "0.5.2")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append
144 "http://sigrok.org/download/source/libsigrok/libsigrok-"
145 version ".tar.gz"))
146 (sha256
147 (base32
148 "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d"))))
149 (outputs '("out" "doc"))
150 (arguments
151 `(#:tests? #f ; tests need USB access
152 #:phases
153 (modify-phases %standard-phases
154 (add-before 'configure 'change-udev-group
155 (lambda _
156 (substitute* (find-files "contrib" "\\.rules$")
157 (("plugdev") "dialout"))
158 #t))
159 (add-after 'build 'build-doc
160 (lambda _
161 (invoke "doxygen")))
162 (add-after 'install 'install-doc
163 (lambda* (#:key outputs #:allow-other-keys)
164 (copy-recursively "doxy/html-api"
165 (string-append (assoc-ref outputs "doc")
166 "/share/doc/libsigrok"))
167 #t))
168 (add-after 'install-doc 'install-udev-rules
169 (lambda* (#:key outputs #:allow-other-keys)
170 (let* ((out (assoc-ref outputs "out"))
171 (rules (string-append out "/lib/udev/rules.d/")))
172 (for-each (lambda (file)
173 (install-file file rules))
174 (find-files "contrib" "\\.rules$"))
175 #t)))
176 (add-after 'install-udev-rules 'install-fw
177 (lambda* (#:key inputs outputs #:allow-other-keys)
178 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
179 (out (assoc-ref outputs "out"))
180 (dir-suffix "/share/sigrok-firmware/")
181 (input-dir (string-append fx2lafw dir-suffix))
182 (output-dir (string-append out dir-suffix)))
183 (for-each
184 (lambda (file)
185 (install-file file output-dir))
186 (find-files input-dir ".")))
187 #t)))))
188 (native-inputs
189 `(("doxygen" ,doxygen)
190 ("graphviz" ,graphviz)
191 ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
192 ("pkg-config" ,pkg-config)))
193 (inputs
194 `(("python" ,python)
195 ("zlib" ,zlib)))
196 ;; libsigrokcxx.pc lists "glibmm" in Requires
197 ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
198 ;; Requires.private and "glib" in Requires
199 (propagated-inputs
200 `(("glib" ,glib)
201 ("glibmm" ,glibmm)
202 ("libserialport" ,libserialport)
203 ("libusb" ,libusb)
204 ("libftdi" ,libftdi)
205 ("libzip" ,libzip)))
206 (build-system gnu-build-system)
207 (home-page "https://www.sigrok.org/wiki/Libsigrok")
208 (synopsis "Library which provides the basic hardware access drivers for logic
209 analyzers")
210 (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
211 access drivers for logic analyzers and other supported devices, as well as input/output file
212 format support.")
213 (license license:gpl3+)))
214
215 (define-public sigrok-cli
216 (package
217 (name "sigrok-cli")
218 (version "0.7.1")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append
222 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
223 version ".tar.gz"))
224 (sha256
225 (base32
226 "15vpn1psriadcbl6v9swwgws7dva85ld03yv6g1mgm27kx11697m"))))
227 (native-inputs
228 `(("pkg-config" ,pkg-config)))
229 (inputs
230 `(("glib" ,glib)
231 ("libsigrok" ,libsigrok)
232 ("libsigrokdecode" ,libsigrokdecode)))
233 (build-system gnu-build-system)
234 (home-page "https://sigrok.org/wiki/Sigrok-cli")
235 (synopsis "Command-line frontend for sigrok")
236 (description "Sigrok-cli is a command-line frontend for sigrok.")
237 (license license:gpl3+)))
238
239 (define-public pulseview
240 (package
241 (name "pulseview")
242 (version "0.4.1")
243 (source (origin
244 (method url-fetch)
245 (uri (string-append
246 "http://sigrok.org/download/source/pulseview/pulseview-"
247 version ".tar.gz"))
248 (sha256
249 (base32
250 "0bvgmkgz37n2bi9niskpl05hf7rsj1lj972fbrgnlz25s4ywxrwy"))))
251 (build-system cmake-build-system)
252 (arguments
253 `(#:configure-flags '("-DENABLE_TESTS=y")
254 #:phases
255 (modify-phases %standard-phases
256 (add-after 'install 'remove-empty-doc-directory
257 (lambda* (#:key outputs #:allow-other-keys)
258 (let ((out (assoc-ref outputs "out")))
259 (with-directory-excursion (string-append out "/share")
260 ;; Use RMDIR to never risk silently deleting files.
261 (rmdir "doc/pulseview")
262 (rmdir "doc"))
263 #t))))))
264 (native-inputs
265 `(("pkg-config" ,pkg-config)))
266 (inputs
267 `(("boost" ,boost)
268 ("glib" ,glib)
269 ("glibmm" ,glibmm)
270 ("libsigrok" ,libsigrok)
271 ("libsigrokdecode" ,libsigrokdecode)
272 ("qtbase" ,qtbase)
273 ("qtsvg" ,qtsvg)))
274 (home-page "https://www.sigrok.org/wiki/PulseView")
275 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
276 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
277 for sigrok.")
278 (license license:gpl3+)))