aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodoros Foradis <theodoros.for@openmailbox.org>2017-06-24 00:05:15 +0300
committerDanny Milosavljevic <dannym@scratchpost.org>2017-06-24 07:57:53 +0200
commit1c12be968251f301f061e2101796a2d8223ad4ec (patch)
tree30703d07378d0b1db19f89ae57ea917da42e2ccd
parent7a19de9c48670684df1c78cc2d43e7d59374c596 (diff)
downloadguix-1c12be968251f301f061e2101796a2d8223ad4ec.tar.gz
guix-1c12be968251f301f061e2101796a2d8223ad4ec.zip
gnu: Add libsigrok.
* gnu/packages/electronics.scm (libsigrok): New variable. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
-rw-r--r--gnu/packages/electronics.scm83
1 files changed, 83 insertions, 0 deletions
diff --git a/gnu/packages/electronics.scm b/gnu/packages/electronics.scm
index 3248649467..5d05f10da9 100644
--- a/gnu/packages/electronics.scm
+++ b/gnu/packages/electronics.scm
@@ -24,9 +24,12 @@
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages documentation)
#:use-module (gnu packages glib)
#:use-module (gnu packages graphviz)
+ #:use-module (gnu packages libftdi)
+ #:use-module (gnu packages libusb)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages sdcc))
@@ -111,3 +114,83 @@ to take care of the OS-specific details when writing software that uses serial p
(description "Fx2lafw is free firmware for Cypress FX2 chips which makes them usable
as simple logic analyzer and/or oscilloscope hardware.")
(license license:gpl2+)))
+
+(define-public libsigrok
+ (package
+ (name "libsigrok")
+ (version "0.5.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "http://sigrok.org/download/source/libsigrok/libsigrok-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "197kr5ip98lxn7rv10zs35d1w0j7265s0xvckx0mq2l8kdvqd32c"))))
+ (outputs '("out" "doc"))
+ (arguments
+ `(#:tests? #f ; tests need usb access
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'change-udev-group
+ (lambda _
+ (let ((file "contrib/z60_libsigrok.rules"))
+ (substitute* file
+ (("plugdev") "dialout"))
+ (rename-file file "contrib/60-libsigrok.rules")
+ #t)))
+ (add-after 'build 'build-doc
+ (lambda _
+ (zero? (system* "doxygen"))))
+ (add-after 'install 'install-doc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (copy-recursively "doxy/html-api"
+ (string-append (assoc-ref outputs "doc")
+ "/share/doc/libsigrok"))
+ #t))
+ (add-after 'install-doc 'install-udev-rules
+ (lambda* (#:key outputs #:allow-other-keys)
+ (install-file "contrib/60-libsigrok.rules"
+ (string-append
+ (assoc-ref outputs "out")
+ "/lib/udev/rules.d/"))))
+ (add-after 'install-udev-rules 'install-fw
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((fx2lafw (assoc-ref inputs "sigrok-firmware-fx2lafw"))
+ (out (assoc-ref outputs "out"))
+ (dir-suffix "/share/sigrok-firmware/")
+ (input-dir (string-append fx2lafw dir-suffix))
+ (output-dir (string-append out dir-suffix)))
+ (mkdir-p output-dir)
+ (for-each
+ (lambda (file)
+ (install-file file output-dir))
+ (find-files input-dir ".")))
+ #t)))))
+ (native-inputs
+ `(("check" ,check)
+ ("doxygen" ,doxygen)
+ ("graphviz" ,graphviz)
+ ("sigrok-firmware-fx2lafw" ,sigrok-firmware-fx2lafw)
+ ("pkg-config" ,pkg-config)))
+ (inputs
+ `(("python" ,python)
+ ("zlib" ,zlib)))
+ ;; libsigrokcxx.pc lists "glibmm" in Requires
+ ;; libsigrok.pc lists "libserialport", "libusb", "libftdi" and "libzip" in
+ ;; Requires.private and "glib" in Requires
+ (propagated-inputs
+ `(("glib" ,glib)
+ ("glibmm" ,glibmm)
+ ("libserialport" ,libserialport)
+ ("libusb" ,libusb)
+ ("libftdi" ,libftdi)
+ ("libzip" ,libzip)))
+ (build-system gnu-build-system)
+ (home-page "http://www.sigrok.org/wiki/Libsigrok")
+ (synopsis "Library which provides the basic hardware access drivers for logic
+analyzers")
+ (description "@code{libsigrok} is a shared library written in C which provides the basic hardware
+access drivers for logic analyzers and other supported devices, as well as input/output file
+format support.")
+ (license license:gpl3+)))