Merge branch 'master' into staging.
[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 git-download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system cmake)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages documentation)
40 #:use-module (gnu packages embedded)
41 #:use-module (gnu packages gawk)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages graphviz)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages libftdi)
46 #:use-module (gnu packages libusb)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages m4)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages qt))
52
53 (define-public libserialport
54 (package
55 (name "libserialport")
56 (version "0.1.1")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append
60 "http://sigrok.org/download/source/libserialport/libserialport-"
61 version ".tar.gz"))
62 (sha256
63 (base32
64 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
65 (build-system gnu-build-system)
66 (home-page "https://sigrok.org/wiki/Libserialport")
67 (synopsis "Library for using serial ports")
68 (description "Libserialport is a minimal shared library written in C that is intended
69 to take care of the OS-specific details when writing software that uses serial ports.")
70 (license license:lgpl3+)))
71
72 (define-public libsigrokdecode
73 (package
74 (name "libsigrokdecode")
75 (version "0.5.3")
76 (source (origin
77 (method url-fetch)
78 (uri (string-append
79 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
80 version ".tar.gz"))
81 (sha256
82 (base32
83 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))
84 (patches
85 (search-patches "libsigrokdecode-python3.9-fix.patch"))))
86 (outputs '("out" "doc"))
87 (arguments
88 `(#:phases
89 (modify-phases %standard-phases
90 (replace 'bootstrap
91 (lambda _
92 (invoke "autoconf")
93 (invoke "aclocal")
94 (invoke "automake" "-ac")))
95 (add-after 'build 'build-doc
96 (lambda _
97 (invoke "doxygen")
98 #t))
99 (add-after 'install 'install-doc
100 (lambda* (#:key outputs #:allow-other-keys)
101 (copy-recursively "doxy/html-api"
102 (string-append (assoc-ref outputs "doc")
103 "/share/doc/libsigrokdecode"))
104 #t)))))
105 (native-inputs
106 (list check-0.14 doxygen graphviz pkg-config automake autoconf))
107 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
108 (propagated-inputs
109 (list glib python))
110 (build-system gnu-build-system)
111 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
112 (synopsis "Library providing (streaming) protocol decoding functionality")
113 (description "Libsigrokdecode is a shared library written in C, which provides
114 (streaming) protocol decoding functionality.")
115 (license license:gpl3+)))
116
117 (define-public sigrok-firmware-fx2lafw
118 (package
119 (name "sigrok-firmware-fx2lafw")
120 (version "0.1.7")
121 (source (origin
122 (method url-fetch)
123 (uri (string-append
124 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
125 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
126 (sha256
127 (base32
128 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
129 (arguments
130 `(#:implicit-inputs? #f))
131 (native-inputs
132 `(("awk" ,gawk)
133 ("bash" ,bash)
134 ("coreutils" ,coreutils)
135 ("grep" ,grep)
136 ("gzip" ,gzip)
137 ("make" ,gnu-make)
138 ("sdcc" ,sdcc)
139 ("sed" ,sed)
140 ("tar" ,tar)))
141 (build-system gnu-build-system)
142 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
143 (synopsis "Firmware for Cypress FX2 chips")
144 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
145 as simple logic analyzer and/or oscilloscope hardware.")
146 (license license:gpl2+)))
147
148 (define-public libsigrok
149 (let ((commit "a7e919a3a6b7fd511acbe1a280536b76c70c28d2")
150 (revision "1"))
151 (package
152 (name "libsigrok")
153 (version (git-version "0.5.2" revision commit))
154 (source
155 (origin
156 (method git-fetch)
157 (uri (git-reference
158 (url "git://sigrok.org/libsigrok")
159 (commit commit)))
160 (sha256
161 (base32 "0km3fyv5s2byrm4zpbss2527ynhw4nb67imnbawwic2a6zh9jiyc"))
162 (file-name (git-file-name name version))))
163 (outputs '("out" "doc"))
164 (arguments
165 `(#:tests? #f ; tests need USB access
166 #:phases
167 (modify-phases %standard-phases
168 (add-before 'configure 'change-udev-group
169 (lambda _
170 (substitute* (find-files "contrib" "\\.rules$")
171 (("plugdev") "dialout"))))
172 (add-after 'build 'build-doc
173 (lambda _
174 (invoke "doxygen")))
175 (add-after 'install 'install-doc
176 (lambda* (#:key outputs #:allow-other-keys)
177 (copy-recursively "doxy/html-api"
178 (string-append (assoc-ref outputs "doc")
179 "/share/doc/libsigrok"))))
180 (add-after 'install-doc 'install-udev-rules
181 (lambda* (#:key outputs #:allow-other-keys)
182 (let* ((out (assoc-ref outputs "out"))
183 (rules (string-append out "/lib/udev/rules.d/")))
184 (for-each (lambda (file)
185 (install-file file rules))
186 (find-files "contrib" "\\.rules$")))))
187 (add-after 'install-udev-rules 'install-fw
188 (lambda* (#:key inputs outputs #:allow-other-keys)
189 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
190 (out (assoc-ref outputs "out"))
191 (dir-suffix "/share/sigrok-firmware/")
192 (input-dir (string-append fx2lafw dir-suffix))
193 (output-dir (string-append out dir-suffix)))
194 (for-each
195 (lambda (file)
196 (install-file file output-dir))
197 (find-files input-dir "."))))))))
198 (native-inputs
199 (list autoconf automake doxygen graphviz libtool
200 sigrok-firmware-fx2lafw pkg-config))
201 (inputs
202 (list python zlib))
203 ;; libsigrokcxx.pc lists "glibmm" in Requires libsigrok.pc lists
204 ;; "libserialport", "libusb", "libftdi" and "libzip" in Requires.private
205 ;; and "glib" in Requires
206 (propagated-inputs
207 (list glib
208 glibmm-2.64
209 libserialport
210 libusb
211 libftdi
212 libzip))
213 (build-system gnu-build-system)
214 (home-page "https://www.sigrok.org/wiki/Libsigrok")
215 (synopsis "Basic hardware access drivers for logic analyzers")
216 (description "@code{libsigrok} is a shared library written in C which
217 provides the basic hardware access drivers for logic analyzers and other
218 supported devices, as well as input/output file 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+)))