gnu: nnn: Don't use NAME in source URI.
[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 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages electronics)
21 #:use-module (guix utils)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system cmake)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages boost)
29 #:use-module (gnu packages check)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages documentation)
32 #:use-module (gnu packages glib)
33 #:use-module (gnu packages graphviz)
34 #:use-module (gnu packages libftdi)
35 #:use-module (gnu packages libusb)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages qt)
39 #:use-module (gnu packages sdcc))
40
41 (define-public libserialport
42 (package
43 (name "libserialport")
44 (version "0.1.1")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append
48 "http://sigrok.org/download/source/libserialport/libserialport-"
49 version ".tar.gz"))
50 (sha256
51 (base32
52 "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
53 (build-system gnu-build-system)
54 (home-page "https://sigrok.org/wiki/Libserialport")
55 (synopsis "Library for using serial ports")
56 (description "Libserialport is a minimal shared library written in C that is intended
57 to take care of the OS-specific details when writing software that uses serial ports.")
58 (license license:lgpl3+)))
59
60 (define-public libsigrokdecode
61 (package
62 (name "libsigrokdecode")
63 (version "0.5.2")
64 (source (origin
65 (method url-fetch)
66 (uri (string-append
67 "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
68 version ".tar.gz"))
69 (sha256
70 (base32
71 "1w434nl1syjkvwl08lji3r9sr60lbxp1nqys8hqwzv2lgiwrx3g0"))))
72 (outputs '("out" "doc"))
73 (arguments
74 `(#:phases
75 (modify-phases %standard-phases
76 (add-after 'build 'build-doc
77 (lambda _
78 (invoke "doxygen")
79 #t))
80 (add-after 'install 'install-doc
81 (lambda* (#:key outputs #:allow-other-keys)
82 (copy-recursively "doxy/html-api"
83 (string-append (assoc-ref outputs "doc")
84 "/share/doc/libsigrokdecode"))
85 #t)))))
86 (native-inputs
87 `(("check" ,check)
88 ("doxygen" ,doxygen)
89 ("graphviz" ,graphviz)
90 ("pkg-config" ,pkg-config)))
91 ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
92 (propagated-inputs
93 `(("glib" ,glib)
94 ("python" ,python)))
95 (build-system gnu-build-system)
96 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
97 (synopsis "Library providing (streaming) protocol decoding functionality")
98 (description "Libsigrokdecode is a shared library written in C, which provides
99 (streaming) protocol decoding functionality.")
100 (license license:gpl3+)))
101
102 (define-public sigrok-firmware-fx2lafw
103 (package
104 (name "sigrok-firmware-fx2lafw")
105 (version "0.1.5")
106 (source (origin
107 (method url-fetch)
108 (uri (string-append
109 "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
110 "sigrok-firmware-fx2lafw-" version ".tar.gz"))
111 (sha256
112 (base32
113 "0bbdgy4rpc00jl0l0744m2ibjlqi26bhrkjr7vplivdsjdmhjx6a"))))
114 (native-inputs
115 `(("sdcc" ,sdcc)))
116 (build-system gnu-build-system)
117 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
118 (synopsis "Firmware for Cypress FX2 chips")
119 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
120 as simple logic analyzer and/or oscilloscope hardware.")
121 (license license:gpl2+)))
122
123 (define-public libsigrok
124 (package
125 (name "libsigrok")
126 (version "0.5.1")
127 (source (origin
128 (method url-fetch)
129 (uri (string-append
130 "http://sigrok.org/download/source/libsigrok/libsigrok-"
131 version ".tar.gz"))
132 (sha256
133 (base32
134 "171b553dir5gn6w4f7n37waqk62nq2kf1jykx4ifjacdz5xdw3z4"))))
135 (outputs '("out" "doc"))
136 (arguments
137 `(#:tests? #f ; tests need USB access
138 #:phases
139 (modify-phases %standard-phases
140 (add-before 'configure 'change-udev-group
141 (lambda _
142 (substitute* (find-files "contrib" "\\.rules$")
143 (("plugdev") "dialout"))
144 #t))
145 (add-after 'build 'build-doc
146 (lambda _
147 (invoke "doxygen")))
148 (add-after 'install 'install-doc
149 (lambda* (#:key outputs #:allow-other-keys)
150 (copy-recursively "doxy/html-api"
151 (string-append (assoc-ref outputs "doc")
152 "/share/doc/libsigrok"))
153 #t))
154 (add-after 'install-doc 'install-udev-rules
155 (lambda* (#:key outputs #:allow-other-keys)
156 (let* ((out (assoc-ref outputs "out"))
157 (rules (string-append out "/lib/udev/rules.d/")))
158 (for-each (lambda (file)
159 (install-file file rules))
160 (find-files "contrib" "\\.rules$"))
161 #t)))
162 (add-after 'install-udev-rules 'install-fw
163 (lambda* (#:key inputs outputs #:allow-other-keys)
164 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
165 (out (assoc-ref outputs "out"))
166 (dir-suffix "/share/sigrok-firmware/")
167 (input-dir (string-append fx2lafw dir-suffix))
168 (output-dir (string-append out dir-suffix)))
169 (for-each
170 (lambda (file)
171 (install-file file output-dir))
172 (find-files input-dir ".")))
173 #t)))))
174 (native-inputs
175 `(("check" ,check)
176 ("doxygen" ,doxygen)
177 ("graphviz" ,graphviz)
178 ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
179 ("pkg-config" ,pkg-config)))
180 (inputs
181 `(("python" ,python)
182 ("zlib" ,zlib)))
183 ;; libsigrokcxx.pc lists "glibmm" in Requires
184 ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
185 ;; Requires.private and "glib" in Requires
186 (propagated-inputs
187 `(("glib" ,glib)
188 ("glibmm" ,glibmm)
189 ("libserialport" ,libserialport)
190 ("libusb" ,libusb)
191 ("libftdi" ,libftdi)
192 ("libzip" ,libzip)))
193 (build-system gnu-build-system)
194 (home-page "https://www.sigrok.org/wiki/Libsigrok")
195 (synopsis "Library which provides the basic hardware access drivers for logic
196 analyzers")
197 (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
198 access drivers for logic analyzers and other supported devices, as well as input/output file
199 format support.")
200 (license license:gpl3+)))
201
202 (define-public sigrok-cli
203 (package
204 (name "sigrok-cli")
205 (version "0.7.1")
206 (source (origin
207 (method url-fetch)
208 (uri (string-append
209 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
210 version ".tar.gz"))
211 (sha256
212 (base32
213 "15vpn1psriadcbl6v9swwgws7dva85ld03yv6g1mgm27kx11697m"))))
214 (native-inputs
215 `(("pkg-config" ,pkg-config)))
216 (inputs
217 `(("glib" ,glib)
218 ("libsigrok" ,libsigrok)
219 ("libsigrokdecode" ,libsigrokdecode)))
220 (build-system gnu-build-system)
221 (home-page "https://sigrok.org/wiki/Sigrok-cli")
222 (synopsis "Command-line frontend for sigrok")
223 (description "Sigrok-cli is a command-line frontend for sigrok.")
224 (license license:gpl3+)))
225
226 (define-public pulseview
227 (package
228 (name "pulseview")
229 (version "0.4.1")
230 (source (origin
231 (method url-fetch)
232 (uri (string-append
233 "http://sigrok.org/download/source/pulseview/pulseview-"
234 version ".tar.gz"))
235 (sha256
236 (base32
237 "0bvgmkgz37n2bi9niskpl05hf7rsj1lj972fbrgnlz25s4ywxrwy"))))
238 (build-system cmake-build-system)
239 (arguments
240 `(#:configure-flags '("-DENABLE_TESTS=y")
241 #:phases
242 (modify-phases %standard-phases
243 (add-after 'install 'remove-empty-doc-directory
244 (lambda* (#:key outputs #:allow-other-keys)
245 (let ((out (assoc-ref outputs "out")))
246 (with-directory-excursion (string-append out "/share")
247 ;; Use RMDIR to never risk silently deleting files.
248 (rmdir "doc/pulseview")
249 (rmdir "doc"))
250 #t))))))
251 (native-inputs
252 `(("pkg-config" ,pkg-config)))
253 (inputs
254 `(("boost" ,boost)
255 ("glib" ,glib)
256 ("glibmm" ,glibmm)
257 ("libsigrok" ,libsigrok)
258 ("libsigrokdecode" ,libsigrokdecode)
259 ("qtbase" ,qtbase)
260 ("qtsvg" ,qtsvg)))
261 (home-page "https://www.sigrok.org/wiki/PulseView")
262 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
263 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
264 for sigrok.")
265 (license license:gpl3+)))