96b8b121427bbb817e01a6677ad451aaeae37c5e
[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–2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019 Clément Lassieur <clement@lassieur.org>
5 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages electronics)
24 #:use-module (guix utils)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system cmake)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages bash)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages documentation)
39 #:use-module (gnu packages embedded)
40 #:use-module (gnu packages gawk)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages graphviz)
43 #:use-module (gnu packages gtk)
44 #:use-module (gnu packages libftdi)
45 #:use-module (gnu packages libusb)
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages m4)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages qt))
51
52 (define-public libserialport
53 (package
54 (name "libserialport")
55 (version "0.1.1")
56 (source (origin
57 (method url-fetch)
58 (uri (string-append
59 "http://sigrok.org/download/source/libserialport/libserialport-"
60 version ".tar.gz"))
61 (sha256
62 (base32
63 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
64 (build-system gnu-build-system)
65 (home-page "https://sigrok.org/wiki/Libserialport")
66 (synopsis "Library for using serial ports")
67 (description "Libserialport is a minimal shared library written in C that is intended
68 to take care of the OS-specific details when writing software that uses serial ports.")
69 (license license:lgpl3+)))
70
71 (define-public libsigrokdecode
72 (package
73 (name "libsigrokdecode")
74 (version "0.5.3")
75 (source (origin
76 (method url-fetch)
77 (uri (string-append
78 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
79 version ".tar.gz"))
80 (sha256
81 (base32
82 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))
83 (patches
84 (search-patches "libsigrokdecode-python3.9-fix.patch"))))
85 (outputs '("out" "doc"))
86 (arguments
87 `(#:phases
88 (modify-phases %standard-phases
89 (replace 'bootstrap
90 (lambda _
91 (invoke "autoconf")
92 (invoke "aclocal")
93 (invoke "automake" "-ac")))
94 (add-after 'build 'build-doc
95 (lambda _
96 (invoke "doxygen")
97 #t))
98 (add-after 'install 'install-doc
99 (lambda* (#:key outputs #:allow-other-keys)
100 (copy-recursively "doxy/html-api"
101 (string-append (assoc-ref outputs "doc")
102 "/share/doc/libsigrokdecode"))
103 #t)))))
104 (native-inputs
105 (list check-0.14 doxygen graphviz pkg-config automake autoconf))
106 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
107 (propagated-inputs
108 (list glib python))
109 (build-system gnu-build-system)
110 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
111 (synopsis "Library providing (streaming) protocol decoding functionality")
112 (description "Libsigrokdecode is a shared library written in C, which provides
113 (streaming) protocol decoding functionality.")
114 (license license:gpl3+)))
115
116 (define-public sigrok-firmware-fx2lafw
117 (package
118 (name "sigrok-firmware-fx2lafw")
119 (version "0.1.7")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append
123 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
124 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
125 (sha256
126 (base32
127 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
128 (arguments
129 `(#:implicit-inputs? #f))
130 (native-inputs
131 `(("awk" ,gawk)
132 ("bash" ,bash)
133 ("coreutils" ,coreutils)
134 ("grep" ,grep)
135 ("gzip" ,gzip)
136 ("make" ,gnu-make)
137 ("sdcc" ,sdcc)
138 ("sed" ,sed)
139 ("tar" ,tar)))
140 (build-system gnu-build-system)
141 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
142 (synopsis "Firmware for Cypress FX2 chips")
143 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
144 as simple logic analyzer and/or oscilloscope hardware.")
145 (license license:gpl2+)))
146
147 (define-public libsigrok
148 (package
149 (name "libsigrok")
150 (version "0.5.2")
151 (source (origin
152 (method url-fetch)
153 (uri (string-append
154 "http://sigrok.org/download/source/libsigrok/libsigrok-"
155 version ".tar.gz"))
156 (sha256
157 (base32
158 "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d"))))
159 (outputs '("out" "doc"))
160 (arguments
161 `(#:tests? #f ; tests need USB access
162 #:phases
163 (modify-phases %standard-phases
164 (add-before 'configure 'change-udev-group
165 (lambda _
166 (substitute* (find-files "contrib" "\\.rules$")
167 (("plugdev") "dialout"))
168 #t))
169 (add-after 'build 'build-doc
170 (lambda _
171 (invoke "doxygen")))
172 (add-after 'install 'install-doc
173 (lambda* (#:key outputs #:allow-other-keys)
174 (copy-recursively "doxy/html-api"
175 (string-append (assoc-ref outputs "doc")
176 "/share/doc/libsigrok"))
177 #t))
178 (add-after 'install-doc 'install-udev-rules
179 (lambda* (#:key outputs #:allow-other-keys)
180 (let* ((out (assoc-ref outputs "out"))
181 (rules (string-append out "/lib/udev/rules.d/")))
182 (for-each (lambda (file)
183 (install-file file rules))
184 (find-files "contrib" "\\.rules$"))
185 #t)))
186 (add-after 'install-udev-rules 'install-fw
187 (lambda* (#:key inputs outputs #:allow-other-keys)
188 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
189 (out (assoc-ref outputs "out"))
190 (dir-suffix "/share/sigrok-firmware/")
191 (input-dir (string-append fx2lafw dir-suffix))
192 (output-dir (string-append out dir-suffix)))
193 (for-each
194 (lambda (file)
195 (install-file file output-dir))
196 (find-files input-dir ".")))
197 #t)))))
198 (native-inputs
199 (list doxygen graphviz sigrok-firmware-fx2lafw pkg-config))
200 (inputs
201 (list python zlib))
202 ;; libsigrokcxx.pc lists "glibmm" in Requires
203 ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
204 ;; Requires.private and "glib" in Requires
205 (propagated-inputs
206 (list glib
207 glibmm-2.64
208 libserialport
209 libusb
210 libftdi
211 libzip))
212 (build-system gnu-build-system)
213 (home-page "https://www.sigrok.org/wiki/Libsigrok")
214 (synopsis "Library which provides the basic hardware access drivers for logic
215 analyzers")
216 (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
217 access drivers for logic analyzers and other supported devices, as well as input/output file
218 format support.")
219 (license license:gpl3+)))
220
221 (define-public sigrok-cli
222 (package
223 (name "sigrok-cli")
224 (version "0.7.2")
225 (source (origin
226 (method url-fetch)
227 (uri (string-append
228 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
229 version ".tar.gz"))
230 (sha256
231 (base32
232 "1f0a2k8qdcin0pqiqq5ni4khzsnv61l21v1dfdjzayw96qzl9l3i"))))
233 (native-inputs
234 (list pkg-config))
235 (inputs
236 (list glib libsigrok libsigrokdecode))
237 (build-system gnu-build-system)
238 (home-page "https://sigrok.org/wiki/Sigrok-cli")
239 (synopsis "Command-line frontend for sigrok")
240 (description "Sigrok-cli is a command-line frontend for sigrok.")
241 (license license:gpl3+)))
242
243 (define-public pulseview
244 (package
245 (name "pulseview")
246 (version "0.4.2")
247 (source (origin
248 (method url-fetch)
249 (uri (string-append
250 "https://sigrok.org/download/source/pulseview/pulseview-"
251 version ".tar.gz"))
252 (sha256
253 (base32
254 "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
255 (patches (search-patches "pulseview-qt515-compat.patch"
256 "pulseview-glib-2.68.patch"))))
257 (build-system cmake-build-system)
258 (arguments
259 `(#:tests? #f ;format_time_minutes_test is failing
260 #:phases
261 (modify-phases %standard-phases
262 (add-after 'install 'remove-empty-doc-directory
263 (lambda* (#:key outputs #:allow-other-keys)
264 (let ((out (assoc-ref outputs "out")))
265 (with-directory-excursion (string-append out "/share")
266 ;; Use RMDIR to never risk silently deleting files.
267 (rmdir "doc/pulseview")
268 (rmdir "doc"))))))))
269 (native-inputs
270 (list pkg-config qttools))
271 (inputs
272 (list boost
273 glib
274 glibmm
275 libsigrok
276 libsigrokdecode
277 qtbase-5
278 qtsvg))
279 (home-page "https://www.sigrok.org/wiki/PulseView")
280 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
281 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
282 for sigrok.")
283 (license license:gpl3+)))
284
285 (define-public comedilib
286 (package
287 (name "comedilib")
288 (version "0.12.0")
289 (source (origin
290 (method url-fetch)
291 (uri (string-append "https://www.comedi.org/download/comedilib-"
292 version ".tar.gz"))
293 (sha256
294 (base32
295 "0wzh23iyix4xj211fsd8hwrdcjhg2w5jswk9kywb1gpd3h8afajj"))))
296 (build-system gnu-build-system)
297 (synopsis "Library for Comedi")
298 (description "Comedilib is a user-space library that provides a
299 developer-friendly interface to Comedi devices. Comedi is a collection of
300 drivers for a variety of common data acquisition plug-in boards. The drivers
301 are implemented as a core Linux kernel module providing common functionality and
302 individual low-level driver modules.")
303 (home-page "https://www.comedi.org/")
304 (license license:lgpl2.1)))
305
306 (define-public xoscope
307 (package
308 (name "xoscope")
309 (version "2.3")
310 (source (origin
311 (method url-fetch)
312 (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
313 version "/xoscope-" version ".tar.gz"))
314 (sha256
315 (base32
316 "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
317 (build-system gnu-build-system)
318 (native-inputs
319 (list m4 pkg-config))
320 (inputs
321 (list alsa-lib comedilib fftw gtk+ gtkdatabox))
322 (synopsis "Digital oscilloscope")
323 (description "Xoscope is a digital oscilloscope that can acquire signals
324 from ALSA, ESD, and COMEDI sources. This package currently does not include
325 support for ESD sources.")
326 (home-page "http://xoscope.sourceforge.net/")
327 (license license:gpl2+)))