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 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))
52 (define-public libserialport
54 (name "libserialport")
59 "http://sigrok.org/download/source/libserialport/libserialport-"
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+)))
71 (define-public libsigrokdecode
73 (name "libsigrokdecode")
78 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
82 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))
84 (search-patches "libsigrokdecode-python3.9-fix.patch"))))
85 (outputs '("out" "doc"))
88 (modify-phases %standard-phases
93 (invoke "automake" "-ac")))
94 (add-after 'build 'build-doc
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"))
105 (list check-0.14 doxygen graphviz pkg-config automake autoconf))
106 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
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+)))
116 (define-public sigrok-firmware-fx2lafw
118 (name "sigrok-firmware-fx2lafw")
123 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
124 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
127 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
129 `(#:implicit-inputs? #f))
133 ("coreutils" ,coreutils)
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+)))
147 (define-public libsigrok
154 "http://sigrok.org/download/source/libsigrok/libsigrok-"
158 "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d"))))
159 (outputs '("out" "doc"))
161 `(#:tests? #f ; tests need USB access
163 (modify-phases %standard-phases
164 (add-before 'configure 'change-udev-group
166 (substitute* (find-files "contrib" "\\.rules$")
167 (("plugdev") "dialout"))
169 (add-after 'build 'build-doc
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"))
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$"))
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)))
195 (install-file file output-dir))
196 (find-files input-dir ".")))
199 (list doxygen graphviz sigrok-firmware-fx2lafw 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
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"))))
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+)))
243 (define-public pulseview
250 "https://sigrok.org/download/source/pulseview/pulseview-"
254 "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
255 (patches (search-patches "pulseview-qt515-compat.patch"
256 "pulseview-glib-2.68.patch"))))
257 (build-system cmake-build-system)
259 `(#:tests? #f ;format_time_minutes_test is failing
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")
270 (list pkg-config qttools))
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
283 (license license:gpl3+)))
285 (define-public comedilib
291 (uri (string-append "https://www.comedi.org/download/comedilib-"
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)))
306 (define-public xoscope
312 (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
313 version "/xoscope-" version ".tar.gz"))
316 "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
317 (build-system gnu-build-system)
319 (list m4 pkg-config))
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+)))