gnu: Add wlgreet.
[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 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
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.
15 ;;;
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.
20 ;;;
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/>.
23
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))
61
62 (define-public libserialport
63 (package
64 (name "libserialport")
65 (version "0.1.1")
66 (source (origin
67 (method url-fetch)
68 (uri (string-append
69 "http://sigrok.org/download/source/libserialport/libserialport-"
70 version ".tar.gz"))
71 (sha256
72 (base32
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+)))
80
81 (define-public libsigrokdecode
82 (package
83 (name "libsigrokdecode")
84 (version "0.5.3")
85 (source (origin
86 (method url-fetch)
87 (uri (string-append
88 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
89 version ".tar.gz"))
90 (sha256
91 (base32
92 "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))
93 (patches
94 (search-patches "libsigrokdecode-python3.9-fix.patch"))))
95 (outputs '("out" "doc"))
96 (arguments
97 `(#:phases
98 (modify-phases %standard-phases
99 (replace 'bootstrap
100 (lambda _
101 (invoke "autoconf")
102 (invoke "aclocal")
103 (invoke "automake" "-ac")))
104 (add-after 'build 'build-doc
105 (lambda _
106 (invoke "doxygen")
107 #t))
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"))
113 #t)))))
114 (native-inputs
115 (list check doxygen graphviz pkg-config automake autoconf))
116 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
117 (propagated-inputs
118 (list glib python))
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+)))
125
126 (define-public sigrok-firmware-fx2lafw
127 (package
128 (name "sigrok-firmware-fx2lafw")
129 (version "0.1.7")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append
133 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
134 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
135 (sha256
136 (base32
137 "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
138 (arguments
139 `(#:implicit-inputs? #f))
140 (native-inputs
141 `(("awk" ,gawk)
142 ("bash" ,bash)
143 ("coreutils" ,coreutils)
144 ("grep" ,grep)
145 ("gzip" ,gzip)
146 ("make" ,gnu-make)
147 ("sdcc" ,sdcc)
148 ("sed" ,sed)
149 ("tar" ,tar)))
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+)))
156
157 (define-public libsigrok
158 (let ((commit "a7e919a3a6b7fd511acbe1a280536b76c70c28d2")
159 (revision "1"))
160 (package
161 (name "libsigrok")
162 (version (git-version "0.5.2" revision commit))
163 (source
164 (origin
165 (method git-fetch)
166 (uri (git-reference
167 (url "git://sigrok.org/libsigrok")
168 (commit commit)))
169 (sha256
170 (base32 "0km3fyv5s2byrm4zpbss2527ynhw4nb67imnbawwic2a6zh9jiyc"))
171 (file-name (git-file-name name version))))
172 (outputs '("out" "doc"))
173 (arguments
174 `(#:tests? #f ; tests need USB access
175 #:phases
176 (modify-phases %standard-phases
177 (add-before 'configure 'change-udev-group
178 (lambda _
179 (substitute* (find-files "contrib" "\\.rules$")
180 (("plugdev") "dialout"))))
181 (add-after 'build 'build-doc
182 (lambda _
183 (invoke "doxygen")))
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)))
203 (for-each
204 (lambda (file)
205 (install-file file output-dir))
206 (find-files input-dir "."))))))))
207 (native-inputs
208 (list autoconf automake doxygen graphviz libtool
209 sigrok-firmware-fx2lafw pkg-config))
210 (inputs
211 (list python zlib))
212 ;; libsigrokcxx.pc lists "glibmm" in Requires libsigrok.pc lists
213 ;; "libserialport", "libusb", "libftdi" and "libzip" in Requires.private
214 ;; and "glib" in Requires
215 (propagated-inputs
216 (list glib
217 glibmm-2.64
218 libserialport
219 libusb
220 libftdi
221 libzip))
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+))))
229
230 (define-public sigrok-cli
231 (package
232 (name "sigrok-cli")
233 (version "0.7.2")
234 (source (origin
235 (method url-fetch)
236 (uri (string-append
237 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
238 version ".tar.gz"))
239 (sha256
240 (base32
241 "1f0a2k8qdcin0pqiqq5ni4khzsnv61l21v1dfdjzayw96qzl9l3i"))))
242 (native-inputs
243 (list pkg-config))
244 (inputs
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+)))
251
252 (define-public openboardview
253 (package
254 (name "openboardview")
255 (version "8.95.2")
256 (source (origin
257 (method git-fetch)
258 (uri (git-reference
259 (url "https://github.com/OpenBoardView/OpenBoardView")
260 (commit version)))
261 (file-name (git-file-name name version))
262 (modules '((ice-9 ftw)
263 (srfi srfi-26)
264 (guix build utils)))
265 (snippet
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))))))
272 (patches
273 (search-patches "openboardview-use-system-imgui.patch"
274 "openboardview-use-system-utf8.patch"))
275 (sha256
276 (base32
277 "1n2yfi8wpky0y231kq2zdgwn7f7kff8m53m904hxi5ppmwhx1d6q"))))
278 (build-system cmake-build-system)
279 (arguments
280 (list
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)
285 (guix build utils)
286 ((guix build glib-or-gtk-build-system) #:prefix gtk:))
287 #:phases
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\\)")
293 (string-append
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.
298 "add_subdirectory("
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".
304 (lambda _
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"
314 (("libgtk-3.so")
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)))))
321 (native-inputs
322 (list pkg-config
323 python
324 glad
325 stb-image
326 utf8-h))
327 (inputs
328 (list fontconfig
329 gtk+
330 imgui
331 sdl2
332 sqlite
333 zlib))
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
338 such as:
339 @itemize
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.
346 @end itemize")
347 (license license:expat)))
348
349 (define-public pulseview
350 (package
351 (name "pulseview")
352 (version "0.4.2")
353 (source (origin
354 (method url-fetch)
355 (uri (string-append
356 "https://sigrok.org/download/source/pulseview/pulseview-"
357 version ".tar.gz"))
358 (sha256
359 (base32
360 "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
361 (patches (search-patches "pulseview-qt515-compat.patch"
362 "pulseview-glib-2.68.patch"))))
363 (build-system cmake-build-system)
364 (arguments
365 `(#:tests? #f ;format_time_minutes_test is failing
366 #:phases
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")
374 (rmdir "doc"))))))))
375 (native-inputs
376 (list pkg-config qttools-5))
377 (inputs
378 (list boost
379 glib
380 glibmm
381 libsigrok
382 libsigrokdecode
383 qtbase-5
384 qtsvg-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
388 for sigrok.")
389 (license license:gpl3+)))
390
391 (define-public comedilib
392 (package
393 (name "comedilib")
394 (version "0.12.0")
395 (source (origin
396 (method url-fetch)
397 (uri (string-append "https://www.comedi.org/download/comedilib-"
398 version ".tar.gz"))
399 (sha256
400 (base32
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)))
411
412 (define-public xoscope
413 (package
414 (name "xoscope")
415 (version "2.3")
416 (source (origin
417 (method url-fetch)
418 (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
419 version "/xoscope-" version ".tar.gz"))
420 (sha256
421 (base32
422 "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
423 (build-system gnu-build-system)
424 (native-inputs
425 (list m4 pkg-config))
426 (inputs
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+)))