electronics.scm 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  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.
  14. ;;;
  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.
  19. ;;;
  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/>.
  22. (define-module (gnu packages electronics)
  23. #:use-module (guix utils)
  24. #:use-module (guix packages)
  25. #:use-module (guix download)
  26. #:use-module ((guix licenses) #:prefix license:)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (guix build-system cmake)
  29. #:use-module (gnu packages)
  30. #:use-module (gnu packages algebra)
  31. #:use-module (gnu packages base)
  32. #:use-module (gnu packages bash)
  33. #:use-module (gnu packages boost)
  34. #:use-module (gnu packages check)
  35. #:use-module (gnu packages compression)
  36. #:use-module (gnu packages documentation)
  37. #:use-module (gnu packages embedded)
  38. #:use-module (gnu packages gawk)
  39. #:use-module (gnu packages glib)
  40. #:use-module (gnu packages graphviz)
  41. #:use-module (gnu packages gtk)
  42. #:use-module (gnu packages libftdi)
  43. #:use-module (gnu packages libusb)
  44. #:use-module (gnu packages linux)
  45. #:use-module (gnu packages m4)
  46. #:use-module (gnu packages pkg-config)
  47. #:use-module (gnu packages python)
  48. #:use-module (gnu packages qt))
  49. (define-public libserialport
  50. (package
  51. (name "libserialport")
  52. (version "0.1.1")
  53. (source (origin
  54. (method url-fetch)
  55. (uri (string-append
  56. "http://sigrok.org/download/source/libserialport/libserialport-"
  57. version ".tar.gz"))
  58. (sha256
  59. (base32
  60. "17ajlwgvyyrap8z7f16zcs59pksvncwbmd3mzf98wj7zqgczjaja"))))
  61. (build-system gnu-build-system)
  62. (home-page "https://sigrok.org/wiki/Libserialport")
  63. (synopsis "Library for using serial ports")
  64. (description "Libserialport is a minimal shared library written in C that is intended
  65. to take care of the OS-specific details when writing software that uses serial ports.")
  66. (license license:lgpl3+)))
  67. (define-public libsigrokdecode
  68. (package
  69. (name "libsigrokdecode")
  70. (version "0.5.3")
  71. (source (origin
  72. (method url-fetch)
  73. (uri (string-append
  74. "http://sigrok.org/download/source/libsigrokdecode/libsigrokdecode-"
  75. version ".tar.gz"))
  76. (sha256
  77. (base32
  78. "1h1zi1kpsgf6j2z8j8hjpv1q7n49i3fhqjn8i178rka3cym18265"))))
  79. (outputs '("out" "doc"))
  80. (arguments
  81. `(#:phases
  82. (modify-phases %standard-phases
  83. (add-after 'build 'build-doc
  84. (lambda _
  85. (invoke "doxygen")
  86. #t))
  87. (add-after 'install 'install-doc
  88. (lambda* (#:key outputs #:allow-other-keys)
  89. (copy-recursively "doxy/html-api"
  90. (string-append (assoc-ref outputs "doc")
  91. "/share/doc/libsigrokdecode"))
  92. #t)))))
  93. (native-inputs
  94. `(("check" ,check-0.14)
  95. ("doxygen" ,doxygen)
  96. ("graphviz" ,graphviz)
  97. ("pkg-config" ,pkg-config)))
  98. ;; libsigrokdecode.pc lists "python" in Requires.private, and "glib" in Requires.
  99. (propagated-inputs
  100. `(("glib" ,glib)
  101. ("python" ,python)))
  102. (build-system gnu-build-system)
  103. (home-page "https://www.sigrok.org/wiki/Libsigrokdecode")
  104. (synopsis "Library providing (streaming) protocol decoding functionality")
  105. (description "Libsigrokdecode is a shared library written in C, which provides
  106. (streaming) protocol decoding functionality.")
  107. (license license:gpl3+)))
  108. (define-public sigrok-firmware-fx2lafw
  109. (package
  110. (name "sigrok-firmware-fx2lafw")
  111. (version "0.1.7")
  112. (source (origin
  113. (method url-fetch)
  114. (uri (string-append
  115. "http://sigrok.org/download/source/sigrok-firmware-fx2lafw/"
  116. "sigrok-firmware-fx2lafw-" version ".tar.gz"))
  117. (sha256
  118. (base32
  119. "0fyfd82mvrcf55v5a3afq1mh1kfswk4c37qrbln6x92jm3b41x53"))))
  120. (arguments
  121. `(#:implicit-inputs? #f))
  122. (native-inputs
  123. `(("awk" ,gawk)
  124. ("bash" ,bash)
  125. ("coreutils" ,coreutils)
  126. ("grep" ,grep)
  127. ("gzip" ,gzip)
  128. ("make" ,gnu-make)
  129. ("sdcc" ,sdcc)
  130. ("sed" ,sed)
  131. ("tar" ,tar)))
  132. (build-system gnu-build-system)
  133. (home-page "https://www.sigrok.org/wiki/Fx2lafw")
  134. (synopsis "Firmware for Cypress FX2 chips")
  135. (description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
  136. as simple logic analyzer and/or oscilloscope hardware.")
  137. (license license:gpl2+)))
  138. (define-public libsigrok
  139. (package
  140. (name "libsigrok")
  141. (version "0.5.2")
  142. (source (origin
  143. (method url-fetch)
  144. (uri (string-append
  145. "http://sigrok.org/download/source/libsigrok/libsigrok-"
  146. version ".tar.gz"))
  147. (sha256
  148. (base32
  149. "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d"))))
  150. (outputs '("out" "doc"))
  151. (arguments
  152. `(#:tests? #f ; tests need USB access
  153. #:phases
  154. (modify-phases %standard-phases
  155. (add-before 'configure 'change-udev-group
  156. (lambda _
  157. (substitute* (find-files "contrib" "\\.rules$")
  158. (("plugdev") "dialout"))
  159. #t))
  160. (add-after 'build 'build-doc
  161. (lambda _
  162. (invoke "doxygen")))
  163. (add-after 'install 'install-doc
  164. (lambda* (#:key outputs #:allow-other-keys)
  165. (copy-recursively "doxy/html-api"
  166. (string-append (assoc-ref outputs "doc")
  167. "/share/doc/libsigrok"))
  168. #t))
  169. (add-after 'install-doc 'install-udev-rules
  170. (lambda* (#:key outputs #:allow-other-keys)
  171. (let* ((out (assoc-ref outputs "out"))
  172. (rules (string-append out "/lib/udev/rules.d/")))
  173. (for-each (lambda (file)
  174. (install-file file rules))
  175. (find-files "contrib" "\\.rules$"))
  176. #t)))
  177. (add-after 'install-udev-rules 'install-fw
  178. (lambda* (#:key inputs outputs #:allow-other-keys)
  179. (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
  180. (out (assoc-ref outputs "out"))
  181. (dir-suffix "/share/sigrok-firmware/")
  182. (input-dir (string-append fx2lafw dir-suffix))
  183. (output-dir (string-append out dir-suffix)))
  184. (for-each
  185. (lambda (file)
  186. (install-file file output-dir))
  187. (find-files input-dir ".")))
  188. #t)))))
  189. (native-inputs
  190. `(("doxygen" ,doxygen)
  191. ("graphviz" ,graphviz)
  192. ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
  193. ("pkg-config" ,pkg-config)))
  194. (inputs
  195. `(("python" ,python)
  196. ("zlib" ,zlib)))
  197. ;; libsigrokcxx.pc lists "glibmm" in Requires
  198. ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
  199. ;; Requires.private and "glib" in Requires
  200. (propagated-inputs
  201. `(("glib" ,glib)
  202. ("glibmm" ,glibmm)
  203. ("libserialport" ,libserialport)
  204. ("libusb" ,libusb)
  205. ("libftdi" ,libftdi)
  206. ("libzip" ,libzip)))
  207. (build-system gnu-build-system)
  208. (home-page "https://www.sigrok.org/wiki/Libsigrok")
  209. (synopsis "Library which provides the basic hardware access drivers for logic
  210. analyzers")
  211. (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
  212. access drivers for logic analyzers and other supported devices, as well as input/output file
  213. format support.")
  214. (license license:gpl3+)))
  215. (define-public sigrok-cli
  216. (package
  217. (name "sigrok-cli")
  218. (version "0.7.2")
  219. (source (origin
  220. (method url-fetch)
  221. (uri (string-append
  222. "http://sigrok.org/download/source/sigrok-cli/sigrok-cli-"
  223. version ".tar.gz"))
  224. (sha256
  225. (base32
  226. "1f0a2k8qdcin0pqiqq5ni4khzsnv61l21v1dfdjzayw96qzl9l3i"))))
  227. (native-inputs
  228. `(("pkg-config" ,pkg-config)))
  229. (inputs
  230. `(("glib" ,glib)
  231. ("libsigrok" ,libsigrok)
  232. ("libsigrokdecode" ,libsigrokdecode)))
  233. (build-system gnu-build-system)
  234. (home-page "https://sigrok.org/wiki/Sigrok-cli")
  235. (synopsis "Command-line frontend for sigrok")
  236. (description "Sigrok-cli is a command-line frontend for sigrok.")
  237. (license license:gpl3+)))
  238. (define-public pulseview
  239. (package
  240. (name "pulseview")
  241. (version "0.4.2")
  242. (source (origin
  243. (method url-fetch)
  244. (uri (string-append
  245. "https://sigrok.org/download/source/pulseview/pulseview-"
  246. version ".tar.gz"))
  247. (sha256
  248. (base32
  249. "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph"))
  250. (patches (search-patches "pulseview-qt515-compat.patch"))))
  251. (build-system cmake-build-system)
  252. (arguments
  253. `(#:configure-flags '("-DENABLE_TESTS=y")
  254. #:phases
  255. (modify-phases %standard-phases
  256. (add-after 'install 'remove-empty-doc-directory
  257. (lambda* (#:key outputs #:allow-other-keys)
  258. (let ((out (assoc-ref outputs "out")))
  259. (with-directory-excursion (string-append out "/share")
  260. ;; Use RMDIR to never risk silently deleting files.
  261. (rmdir "doc/pulseview")
  262. (rmdir "doc"))
  263. #t))))))
  264. (native-inputs
  265. `(("pkg-config" ,pkg-config)
  266. ("qttools" ,qttools)))
  267. (inputs
  268. `(("boost" ,boost)
  269. ("glib" ,glib)
  270. ("glibmm" ,glibmm)
  271. ("libsigrok" ,libsigrok)
  272. ("libsigrokdecode" ,libsigrokdecode)
  273. ("qtbase" ,qtbase-5)
  274. ("qtsvg" ,qtsvg)))
  275. (home-page "https://www.sigrok.org/wiki/PulseView")
  276. (synopsis "Qt based logic analyzer, oscilloscope and MSO GUI for sigrok")
  277. (description "PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI
  278. for sigrok.")
  279. (license license:gpl3+)))
  280. (define-public comedilib
  281. (package
  282. (name "comedilib")
  283. (version "0.12.0")
  284. (source (origin
  285. (method url-fetch)
  286. (uri (string-append "https://www.comedi.org/download/comedilib-"
  287. version ".tar.gz"))
  288. (sha256
  289. (base32
  290. "0wzh23iyix4xj211fsd8hwrdcjhg2w5jswk9kywb1gpd3h8afajj"))))
  291. (build-system gnu-build-system)
  292. (synopsis "Library for Comedi")
  293. (description "Comedilib is a user-space library that provides a
  294. developer-friendly interface to Comedi devices. Comedi is a collection of
  295. drivers for a variety of common data acquisition plug-in boards. The drivers
  296. are implemented as a core Linux kernel module providing common functionality and
  297. individual low-level driver modules.")
  298. (home-page "https://www.comedi.org/")
  299. (license license:lgpl2.1)))
  300. (define-public xoscope
  301. (package
  302. (name "xoscope")
  303. (version "2.3")
  304. (source (origin
  305. (method url-fetch)
  306. (uri (string-append "mirror://sourceforge/xoscope/xoscope/"
  307. version "/xoscope-" version ".tar.gz"))
  308. (sha256
  309. (base32
  310. "0a5ycfc1qdmibvagc82r2mhv2i99m6pndy5i6ixas3j2297g6pgq"))))
  311. (build-system gnu-build-system)
  312. (native-inputs
  313. `(("m4" ,m4)
  314. ("pkg-config" ,pkg-config)))
  315. (inputs
  316. `(("alsa-lib" ,alsa-lib)
  317. ("comedilib" ,comedilib)
  318. ("fftw" ,fftw)
  319. ("gtk+" ,gtk+)
  320. ("gtkdatabox" ,gtkdatabox)))
  321. (synopsis "Digital oscilloscope")
  322. (description "Xoscope is a digital oscilloscope that can acquire signals
  323. from ALSA, ESD, and COMEDI sources. This package currently does not include
  324. support for ESD sources.")
  325. (home-page "http://xoscope.sourceforge.net/")
  326. (license license:gpl2+)))