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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 base)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages documentation)
38 #:use-module (gnu packages embedded)
39 #:use-module (gnu packages gawk)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages graphviz)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages libftdi)
44 #:use-module (gnu packages libusb)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages m4)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages qt))
51 (define-public libserialport
53 (name "libserialport")
58 "http://sigrok.org/download/source/libserialport/libserialport-"
62 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
63 (build-system gnu-build-system)
64 (home-page "https://sigrok.org/wiki/Libserialport")
65 (synopsis "Library for using serial ports")
66 (description "Libserialport is a minimal shared library written in C that is intended
67 to take care of the OS-specific details when writing software that uses serial ports.")
68 (license license:lgpl3+)))
70 (define-public libsigrokdecode
72 (name "libsigrokdecode")
77 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
81 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))))
82 (outputs '("out" "doc"))
85 (modify-phases %standard-phases
86 (add-after 'build 'build-doc
90 (add-after 'install 'install-doc
91 (lambda* (#:key outputs #:allow-other-keys)
92 (copy-recursively "doxy/html-api"
93 (string-append (assoc-ref outputs "doc")
94 "/share/doc/libsigrokdecode"))
97 `(("check" ,check-0.14)
99 ("graphviz" ,graphviz)
100 ("pkg-config" ,pkg-config)))
101 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
105 (build-system gnu-build-system)
106 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
107 (synopsis "Library providing (streaming) protocol decoding functionality")
108 (description "Libsigrokdecode is a shared library written in C, which provides
109 (streaming) protocol decoding functionality.")
110 (license license:gpl3+)))
112 (define-public sigrok-firmware-fx2lafw
114 (name "sigrok-firmware-fx2lafw")
119 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
120 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
123 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
125 `(#:implicit-inputs? #f))
129 ("coreutils" ,coreutils)
136 (build-system gnu-build-system)
137 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
138 (synopsis "Firmware for Cypress FX2 chips")
139 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
140 as simple logic analyzer and/or oscilloscope hardware.")
141 (license license:gpl2+)))
143 (define-public libsigrok
150 "http://sigrok.org/download/source/libsigrok/libsigrok-"
154 "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d"))))
155 (outputs '("out" "doc"))
157 `(#:tests? #f ; tests need USB access
159 (modify-phases %standard-phases
160 (add-before 'configure 'change-udev-group
162 (substitute* (find-files "contrib" "\\.rules$")
163 (("plugdev") "dialout"))
165 (add-after 'build 'build-doc
168 (add-after 'install 'install-doc
169 (lambda* (#:key outputs #:allow-other-keys)
170 (copy-recursively "doxy/html-api"
171 (string-append (assoc-ref outputs "doc")
172 "/share/doc/libsigrok"))
174 (add-after 'install-doc 'install-udev-rules
175 (lambda* (#:key outputs #:allow-other-keys)
176 (let* ((out (assoc-ref outputs "out"))
177 (rules (string-append out "/lib/udev/rules.d/")))
178 (for-each (lambda (file)
179 (install-file file rules))
180 (find-files "contrib" "\\.rules$"))
182 (add-after 'install-udev-rules 'install-fw
183 (lambda* (#:key inputs outputs #:allow-other-keys)
184 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
185 (out (assoc-ref outputs "out"))
186 (dir-suffix "/share/sigrok-firmware/")
187 (input-dir (string-append fx2lafw dir-suffix))
188 (output-dir (string-append out dir-suffix)))
191 (install-file file output-dir))
192 (find-files input-dir ".")))
195 `(("doxygen" ,doxygen)
196 ("graphviz" ,graphviz)
197 ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
198 ("pkg-config" ,pkg-config)))
202 ;; libsigrokcxx.pc lists "glibmm" in Requires
203 ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
204 ;; Requires.private and "glib" in Requires
208 ("libserialport" ,libserialport)
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
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
219 (license license:gpl3+)))
221 (define-public sigrok-cli
228 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
232 "1f0a2k8qdcin0pqiqq5ni4khzsnv61l21v1dfdjzayw96qzl9l3i"))))
234 `(("pkg-config" ,pkg-config)))
237 ("libsigrok" ,libsigrok)
238 ("libsigrokdecode" ,libsigrokdecode)))
239 (build-system gnu-build-system)
240 (home-page "https://sigrok.org/wiki/Sigrok-cli")
241 (synopsis "Command-line frontend for sigrok")
242 (description "Sigrok-cli is a command-line frontend for sigrok.")
243 (license license:gpl3+)))
245 (define-public pulseview
252 "https://sigrok.org/download/source/pulseview/pulseview-"
256 "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
257 (patches (search-patches "pulseview-qt515-compat.patch"))))
258 (build-system cmake-build-system)
260 `(#:configure-flags '("-DENABLE_TESTS=y")
262 (modify-phases %standard-phases
263 (add-after 'install 'remove-empty-doc-directory
264 (lambda* (#:key outputs #:allow-other-keys)
265 (let ((out (assoc-ref outputs "out")))
266 (with-directory-excursion (string-append out "/share")
267 ;; Use RMDIR to never risk silently deleting files.
268 (rmdir "doc/pulseview")
272 `(("pkg-config" ,pkg-config)
273 ("qttools" ,qttools)))
278 ("libsigrok" ,libsigrok)
279 ("libsigrokdecode" ,libsigrokdecode)
282 (home-page "https://www.sigrok.org/wiki/PulseView")
283 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
284 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
286 (license license:gpl3+)))
288 (define-public comedilib
294 (uri (string-append "https://www.comedi.org/download/comedilib-"
298 "0wzh23iyix4xj211fsd8hwrdcjhg2w5jswk9kywb1gpd3h8afajj"))))
299 (build-system gnu-build-system)
300 (synopsis "Library for Comedi")
301 (description "Comedilib is a user-space library that provides a
302 developer-friendly interface to Comedi devices. Comedi is a collection of
303 drivers for a variety of common data acquisition plug-in boards. The drivers
304 are implemented as a core Linux kernel module providing common functionality and
305 individual low-level driver modules.")
306 (home-page "https://www.comedi.org/")
307 (license license:lgpl2.1)))
309 (define-public xoscope
315 (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
316 version "/xoscope-" version ".tar.gz"))
319 "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
320 (build-system gnu-build-system)
323 ("pkg-config" ,pkg-config)))
325 `(("alsa-lib" ,alsa-lib)
326 ("comedilib" ,comedilib)
329 ("gtkdatabox" ,gtkdatabox)))
330 (synopsis "Digital oscilloscope")
331 (description "Xoscope is a digital oscilloscope that can acquire signals
332 from ALSA, ESD, and COMEDI sources. This package currently does not include
333 support for ESD sources.")
334 (home-page "http://xoscope.sourceforge.net/")
335 (license license:gpl2+)))