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 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages electronics)
25 #:use-module (guix download)
26 #:use-module (guix gexp)
27 #:use-module (guix git-download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system cmake)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages algebra)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages boost)
39 #:use-module (gnu packages c)
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages documentation)
43 #:use-module (gnu packages embedded)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages gawk)
46 #:use-module (gnu packages gl)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages graphviz)
49 #:use-module (gnu packages gtk)
50 #:use-module (gnu packages libftdi)
51 #:use-module (gnu packages libusb)
52 #:use-module (gnu packages linux)
53 #:use-module (gnu packages m4)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages qt)
57 #:use-module (gnu packages sdl)
58 #:use-module (gnu packages sqlite)
59 #:use-module (gnu packages stb)
60 #:use-module (gnu packages toolkits))
62 (define-public libserialport
64 (name "libserialport")
69 "http://sigrok.org/download/source/libserialport/libserialport-"
73 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
74 (build-system gnu-build-system)
75 (home-page "https://sigrok.org/wiki/Libserialport")
76 (synopsis "Library for using serial ports")
77 (description "Libserialport is a minimal shared library written in C that is intended
78 to take care of the OS-specific details when writing software that uses serial ports.")
79 (license license:lgpl3+)))
81 (define-public libsigrokdecode
83 (name "libsigrokdecode")
88 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
92 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))
94 (search-patches "libsigrokdecode-python3.9-fix.patch"))))
95 (outputs '("out" "doc"))
98 (modify-phases %standard-phases
103 (invoke "automake" "-ac")))
104 (add-after 'build 'build-doc
108 (add-after 'install 'install-doc
109 (lambda* (#:key outputs #:allow-other-keys)
110 (copy-recursively "doxy/html-api"
111 (string-append (assoc-ref outputs "doc")
112 "/share/doc/libsigrokdecode"))
115 (list check doxygen graphviz pkg-config automake autoconf))
116 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
119 (build-system gnu-build-system)
120 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
121 (synopsis "Library providing (streaming) protocol decoding functionality")
122 (description "Libsigrokdecode is a shared library written in C, which provides
123 (streaming) protocol decoding functionality.")
124 (license license:gpl3+)))
126 (define-public sigrok-firmware-fx2lafw
128 (name "sigrok-firmware-fx2lafw")
133 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
134 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
137 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
139 `(#:implicit-inputs? #f))
143 ("coreutils" ,coreutils)
150 (build-system gnu-build-system)
151 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
152 (synopsis "Firmware for Cypress FX2 chips")
153 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
154 as simple logic analyzer and/or oscilloscope hardware.")
155 (license license:gpl2+)))
157 (define-public libsigrok
158 (let ((commit "a7e919a3a6b7fd511acbe1a280536b76c70c28d2")
162 (version (git-version "0.5.2" revision commit))
167 (url "git://sigrok.org/libsigrok")
170 (base32 "0km3fyv5s2byrm4zpbss2527ynhw4nb67imnbawwic2a6zh9jiyc"))
171 (file-name (git-file-name name version))))
172 (outputs '("out" "doc"))
174 `(#:tests? #f ; tests need USB access
176 (modify-phases %standard-phases
177 (add-before 'configure 'change-udev-group
179 (substitute* (find-files "contrib" "\\.rules$")
180 (("plugdev") "dialout"))))
181 (add-after 'build 'build-doc
184 (add-after 'install 'install-doc
185 (lambda* (#:key outputs #:allow-other-keys)
186 (copy-recursively "doxy/html-api"
187 (string-append (assoc-ref outputs "doc")
188 "/share/doc/libsigrok"))))
189 (add-after 'install-doc 'install-udev-rules
190 (lambda* (#:key outputs #:allow-other-keys)
191 (let* ((out (assoc-ref outputs "out"))
192 (rules (string-append out "/lib/udev/rules.d/")))
193 (for-each (lambda (file)
194 (install-file file rules))
195 (find-files "contrib" "\\.rules$")))))
196 (add-after 'install-udev-rules 'install-fw
197 (lambda* (#:key inputs outputs #:allow-other-keys)
198 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
199 (out (assoc-ref outputs "out"))
200 (dir-suffix "/share/sigrok-firmware/")
201 (input-dir (string-append fx2lafw dir-suffix))
202 (output-dir (string-append out dir-suffix)))
205 (install-file file output-dir))
206 (find-files input-dir "."))))))))
208 (list autoconf automake doxygen graphviz libtool
209 sigrok-firmware-fx2lafw pkg-config))
212 ;; libsigrokcxx.pc lists "glibmm" in Requires libsigrok.pc lists
213 ;; "libserialport", "libusb", "libftdi" and "libzip" in Requires.private
214 ;; and "glib" in Requires
222 (build-system gnu-build-system)
223 (home-page "https://www.sigrok.org/wiki/Libsigrok")
224 (synopsis "Basic hardware access drivers for logic analyzers")
225 (description "@code{libsigrok} is a shared library written in C which
226 provides the basic hardware access drivers for logic analyzers and other
227 supported devices, as well as input/output file format support.")
228 (license license:gpl3+))))
230 (define-public sigrok-cli
237 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
241 "1f0a2k8qdcin0pqiqq5ni4khzsnv61l21v1dfdjzayw96qzl9l3i"))))
245 (list glib libsigrok libsigrokdecode))
246 (build-system gnu-build-system)
247 (home-page "https://sigrok.org/wiki/Sigrok-cli")
248 (synopsis "Command-line frontend for sigrok")
249 (description "Sigrok-cli is a command-line frontend for sigrok.")
250 (license license:gpl3+)))
252 (define-public openboardview
254 (name "openboardview")
259 (url "https://github.com/OpenBoardView/OpenBoardView")
261 (file-name (git-file-name name version))
262 (modules '((ice-9 ftw)
266 '(with-directory-excursion "src"
267 (define keep (list "." ".." "openboardview"))
268 (for-each (lambda (f)
269 (when (eq? 'directory (stat:type (lstat f)))
270 (delete-file-recursively f)))
271 (scandir "." (negate (cut member <> keep))))))
273 (search-patches "openboardview-use-system-imgui.patch"
274 "openboardview-use-system-utf8.patch"))
277 "1n2yfi8wpky0y231kq2zdgwn7f7kff8m53m904hxi5ppmwhx1d6q"))))
278 (build-system cmake-build-system)
281 #:tests? #f ;no test suite
282 #:imported-modules `((guix build glib-or-gtk-build-system)
283 ,@%cmake-build-system-modules)
284 #:modules '((guix build cmake-build-system)
286 ((guix build glib-or-gtk-build-system) #:prefix gtk:))
288 #~(modify-phases %standard-phases
289 (add-before 'configure 'configure-glad
290 (lambda* (#:key inputs #:allow-other-keys)
291 (substitute* "src/CMakeLists.txt"
292 (("add_subdirectory\\(glad\\)")
294 ;; Configure Glad to use static Khronos XML specifications
295 ;; instead of attempting to fetch them from the Internet.
296 "option(GLAD_REPRODUCIBLE \"Reproducible build\" ON)\n"
297 ;; Use the CMake files from our glad package.
299 (search-input-directory inputs "share/glad") ;source_dir
300 " src/glad)\n"))))) ;binary dir
301 (add-before 'configure 'fix-utf8-include-directive
302 ;; Our utf8-h package makes the header available as "utf8.h"
303 ;; directly rather than "utf8/utf8.h".
305 (substitute* '("src/openboardview/FileFormats/BRDFile.cpp"
306 "src/openboardview/BoardView.cpp")
307 (("utf8/utf8.h") "utf8.h"))))
308 (add-before 'configure 'dynamically-load-gtk-via-absolute-path
309 ;; The GTK library is not linked thus not present in the RUNPATH of
310 ;; the produced binary; the absolute path of the libraries must to
311 ;; the dynamic loader otherwise they aren't found.
312 (lambda* (#:key inputs #:allow-other-keys)
313 (substitute* "src/openboardview/unix.cpp"
315 (search-input-file inputs "lib/libgtk-3.so")))))
316 ;; Add the two extra phases from `glib-or-gtk-build-system'.
317 (add-after 'install 'glib-or-gtk-compile-schemas
318 (assoc-ref gtk:%standard-phases 'glib-or-gtk-compile-schemas))
319 (add-after 'install 'glib-or-gtk-wrap
320 (assoc-ref gtk:%standard-phases 'glib-or-gtk-wrap)))))
334 (home-page "https://openboardview.org/")
335 (synopsis "Viewer for BoardView files")
336 (description "OpenBoardView is a viewer for BoardView files, which present
337 the details of a printed circuit board (PCB). It comes with features
340 @item Dynamic part outline rendering, including complex connectors
341 @item Annotations, for leaving notes about parts, nets, pins or location
342 @item Configurable colour themes
343 @item Configurable DPI to facilitate usage on 4K monitors
344 @item Configurable for running on slower systems
345 @item Reads FZ (with key), BRD, BRD2, BDV and BV* formats.
347 (license license:expat)))
349 (define-public pulseview
356 "https://sigrok.org/download/source/pulseview/pulseview-"
360 "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
361 (patches (search-patches "pulseview-qt515-compat.patch"
362 "pulseview-glib-2.68.patch"))))
363 (build-system cmake-build-system)
365 `(#:tests? #f ;format_time_minutes_test is failing
367 (modify-phases %standard-phases
368 (add-after 'install 'remove-empty-doc-directory
369 (lambda* (#:key outputs #:allow-other-keys)
370 (let ((out (assoc-ref outputs "out")))
371 (with-directory-excursion (string-append out "/share")
372 ;; Use RMDIR to never risk silently deleting files.
373 (rmdir "doc/pulseview")
376 (list pkg-config qttools-5))
385 (home-page "https://www.sigrok.org/wiki/PulseView")
386 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
387 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
389 (license license:gpl3+)))
391 (define-public comedilib
397 (uri (string-append "https://www.comedi.org/download/comedilib-"
401 "0wzh23iyix4xj211fsd8hwrdcjhg2w5jswk9kywb1gpd3h8afajj"))))
402 (build-system gnu-build-system)
403 (synopsis "Library for Comedi")
404 (description "Comedilib is a user-space library that provides a
405 developer-friendly interface to Comedi devices. Comedi is a collection of
406 drivers for a variety of common data acquisition plug-in boards. The drivers
407 are implemented as a core Linux kernel module providing common functionality and
408 individual low-level driver modules.")
409 (home-page "https://www.comedi.org/")
410 (license license:lgpl2.1)))
412 (define-public xoscope
418 (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
419 version "/xoscope-" version ".tar.gz"))
422 "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
423 (build-system gnu-build-system)
425 (list m4 pkg-config))
427 (list alsa-lib comedilib fftw gtk+ gtkdatabox))
428 (synopsis "Digital oscilloscope")
429 (description "Xoscope is a digital oscilloscope that can acquire signals
430 from ALSA, ESD, and COMEDI sources. This package currently does not include
431 support for ESD sources.")
432 (home-page "http://xoscope.sourceforge.net/")
433 (license license:gpl2+)))