gnu: libsigrok: Return #t from all phases.
[jackhill/guix/guix.git] / gnu / packages / electronics.scm
CommitLineData
03d0cc11 1;;; GNU Guix --- Functional package management for GNU
d109b1e8 2;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
bf660f72 3;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
03d0cc11
TF
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)
6df20b5a 26 #:use-module (guix build-system cmake)
c0735802 27 #:use-module (gnu packages)
6df20b5a 28 #:use-module (gnu packages boost)
c0735802 29 #:use-module (gnu packages check)
1c12be96 30 #:use-module (gnu packages compression)
c0735802
TF
31 #:use-module (gnu packages documentation)
32 #:use-module (gnu packages glib)
33 #:use-module (gnu packages graphviz)
1c12be96
TF
34 #:use-module (gnu packages libftdi)
35 #:use-module (gnu packages libusb)
c0735802 36 #:use-module (gnu packages pkg-config)
7a19de9c 37 #:use-module (gnu packages python)
6df20b5a 38 #:use-module (gnu packages qt)
7a19de9c 39 #:use-module (gnu packages sdcc))
03d0cc11
TF
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)
01005901 54 (home-page "https://sigrok.org/wiki/Libserialport")
03d0cc11
TF
55 (synopsis "Library for using serial ports")
56 (description "Libserialport is a minimal shared library written in C that is intended
57to take care of the OS-specific details when writing software that uses serial ports.")
58 (license license:lgpl3+)))
c0735802
TF
59
60(define-public libsigrokdecode
61 (package
62 (name "libsigrokdecode")
bf660f72 63 (version "0.5.1")
c0735802
TF
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
bf660f72 71 "07mmb6s62ncqqgsc6szilj2yxixf6gg99ggbzsjlbhp4b9aqnga9"))))
c0735802
TF
72 (outputs '("out" "doc"))
73 (arguments
74 `(#:phases
75 (modify-phases %standard-phases
76 (add-after 'build 'build-doc
77 (lambda _
7aa6e29d
TGR
78 (invoke "doxygen")
79 #t))
c0735802
TF
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)
47800898 96 (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
c0735802
TF
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+)))
7a19de9c
TF
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)
47800898 117 (home-page "https://www.sigrok.org/wiki/Fx2lafw")
7a19de9c
TF
118 (synopsis "Firmware for Cypress FX2 chips")
119 (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
120as simple logic analyzer and/or oscilloscope hardware.")
121 (license license:gpl2+)))
1c12be96
TF
122
123(define-public libsigrok
124 (package
125 (name "libsigrok")
126 (version "0.5.0")
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 "197kr5ip98lxn7rv10zs35d1w0j7265s0xvckx0mq2l8kdvqd32c"))))
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 (let ((file "contrib/z60_libsigrok.rules"))
143 (substitute* file
144 (("plugdev") "dialout"))
145 (rename-file file "contrib/60-libsigrok.rules")
146 #t)))
147 (add-after 'build 'build-doc
148 (lambda _
fbe4a5a2 149 (invoke "doxygen")))
1c12be96
TF
150 (add-after 'install 'install-doc
151 (lambda* (#:key outputs #:allow-other-keys)
152 (copy-recursively "doxy/html-api"
153 (string-append (assoc-ref outputs "doc")
154 "/share/doc/libsigrok"))
155 #t))
156 (add-after 'install-doc 'install-udev-rules
157 (lambda* (#:key outputs #:allow-other-keys)
158 (install-file "contrib/60-libsigrok.rules"
159 (string-append
160 (assoc-ref outputs "out")
fbe4a5a2
TGR
161 "/lib/udev/rules.d/"))
162 #t))
1c12be96
TF
163 (add-after 'install-udev-rules 'install-fw
164 (lambda* (#:key inputs outputs #:allow-other-keys)
165 (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
166 (out (assoc-ref outputs "out"))
167 (dir-suffix "/share/sigrok-firmware/")
168 (input-dir (string-append fx2lafw dir-suffix))
169 (output-dir (string-append out dir-suffix)))
170 (mkdir-p output-dir)
171 (for-each
172 (lambda (file)
173 (install-file file output-dir))
174 (find-files input-dir ".")))
175 #t)))))
176 (native-inputs
177 `(("check" ,check)
178 ("doxygen" ,doxygen)
179 ("graphviz" ,graphviz)
180 ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
181 ("pkg-config" ,pkg-config)))
182 (inputs
183 `(("python" ,python)
184 ("zlib" ,zlib)))
185 ;; libsigrokcxx.pc lists "glibmm" in Requires
186 ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
187 ;; Requires.private and "glib" in Requires
188 (propagated-inputs
189 `(("glib" ,glib)
190 ("glibmm" ,glibmm)
191 ("libserialport" ,libserialport)
192 ("libusb" ,libusb)
193 ("libftdi" ,libftdi)
194 ("libzip" ,libzip)))
195 (build-system gnu-build-system)
47800898 196 (home-page "https://www.sigrok.org/wiki/Libsigrok")
1c12be96
TF
197 (synopsis "Library which provides the basic hardware access drivers for logic
198analyzers")
199 (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
200access drivers for logic analyzers and other supported devices, as well as input/output file
201format support.")
202 (license license:gpl3+)))
2dbad1dd
TF
203
204(define-public sigrok-cli
205 (package
206 (name "sigrok-cli")
207 (version "0.7.0")
208 (source (origin
209 (method url-fetch)
210 (uri (string-append
211 "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
212 version ".tar.gz"))
213 (sha256
214 (base32
215 "072ylscp0ppgii1k5j07hhv7dfmni4vyhxnsvxmgqgfyq9ldjsan"))))
216 (native-inputs
217 `(("pkg-config" ,pkg-config)))
218 (inputs
219 `(("glib" ,glib)
220 ("libsigrok" ,libsigrok)
221 ("libsigrokdecode" ,libsigrokdecode)))
222 (build-system gnu-build-system)
47800898 223 (home-page "https://sigrok.org/wiki/Sigrok-cli")
2dbad1dd
TF
224 (synopsis "Command-line frontend for sigrok")
225 (description "Sigrok-cli is a command-line frontend for sigrok.")
226 (license license:gpl3+)))
6df20b5a
TF
227
228(define-public pulseview
229 (package
230 (name "pulseview")
231 (version "0.4.0")
232 (source (origin
233 (method url-fetch)
234 (uri (string-append
235 "http://sigrok.org/download/source/pulseview/pulseview-"
236 version ".tar.gz"))
237 (sha256
238 (base32
239 "1f8f2342d5yam98mmcb8f9g2vslcwv486bmi4x45pxn68l82ky3q"))))
240 (arguments
241 `(#:configure-flags '("-DCMAKE_CXX_FLAGS=-fext-numeric-literals")))
242 (native-inputs
243 `(("pkg-config" ,pkg-config)))
244 (inputs
245 `(("boost" ,boost)
246 ("glib" ,glib)
247 ("glibmm" ,glibmm)
6df20b5a 248 ("libsigrok" ,libsigrok)
b1e4c0fa
MB
249 ("libsigrokdecode" ,libsigrokdecode)
250 ("qtbase" ,qtbase)
251 ("qtsvg" ,qtsvg)))
6df20b5a 252 (build-system cmake-build-system)
01005901 253 (home-page "https://www.sigrok.org/wiki/PulseView")
6df20b5a
TF
254 (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
255 (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
256for sigrok.")
257 (license license:gpl3+)))