summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristopher Howard <christopher@librehacker.com>2020-04-28 10:06:34 +0200
committerGuillaume Le Vaillant <glv@posteo.net>2020-04-28 10:17:08 +0200
commit79c4fb4f366cff3ad75982b4a09c6bd82e604674 (patch)
tree60fe491fcdf0cf3c4ce38ccc7d55a1edf2cd200c
parent0ae85052889d47c4ede88bb34c4b00b3e557e1d9 (diff)
downloadguix-79c4fb4f366cff3ad75982b4a09c6bd82e604674.tar.gz
gnu: Add hackrf.
* gnu/packages/radio.scm (hackrf): New variable.

Co-authored-by: Guillaume Le Vaillant <glv@posteo.net>
-rw-r--r--gnu/packages/radio.scm69
1 files changed, 68 insertions, 1 deletions
diff --git a/gnu/packages/radio.scm b/gnu/packages/radio.scm
index b748aa4183..24ee67017a 100644
--- a/gnu/packages/radio.scm
+++ b/gnu/packages/radio.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
-;;; Copyright © 2019 Christopher Howard <christopher@librehacker.com>
+;;; Copyright © 2019, 2020 Christopher Howard <christopher@librehacker.com>
 ;;; Copyright © 2019, 2020 Evan Straw <evan.straw99@gmail.com>
 ;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
@@ -654,6 +654,73 @@ for correctness.")
     (home-page "http://www.w1hkj.com/")
     (license license:gpl3+)))
 
+(define-public hackrf
+  ;; Using a git commit because there have been many many commits
+  ;; since the relase two years ago, but no sign of a promised
+  ;; release for many months now.
+  (let ((commit "43e6f99fe8543094d18ff3a6550ed2066c398862")
+        (revision "0"))
+    (package
+     (name "hackrf")
+     (version (git-version "2018.01.1" revision commit))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mossmann/hackrf.git")
+             (commit commit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0avnv693xi0zsnrvkbfn0ln1r3s1iyj0bz7sc3gxay909av0pvbc"))))
+     (build-system cmake-build-system)
+     (arguments
+      '(#:configure-flags
+        (list "-DUDEV_RULES_GROUP=dialout"
+              (string-append "-DUDEV_RULES_PATH="
+                             (assoc-ref %outputs "out")
+                             "/lib/udev/rules.d"))
+        #:phases
+        (modify-phases %standard-phases
+          (add-before 'configure 'enter-source-directory
+            (lambda _
+              (chdir "host")
+              #t))
+          (add-after 'install 'delete-static-library
+            (lambda* (#:key outputs #:allow-other-keys)
+              (delete-file (string-append (assoc-ref outputs "out")
+                                          "/lib/libhackrf.a"))
+              #t))
+          (add-before 'install-license-files 'leave-source-directory
+            (lambda _
+              (chdir "..")
+              #t)))
+        #:tests? #f)) ; no test suite
+     (native-inputs
+      `(("pkg-config" ,pkg-config)))
+     (inputs
+      `(("fftw" ,fftw)
+        ("fftwf" ,fftwf)
+        ("libusb" ,libusb)))
+     (home-page "https://greatscottgadgets.com/hackrf/")
+     (synopsis "User-space library and utilities for HackRF SDR")
+     (description
+      "Command line utilities and a C library for controlling the HackRF
+Software Defined Radio (SDR) over USB.  Installing this package installs
+the userspace hackrf utilities and C library.  To install the hackrf
+udev rules, you must add this package as a system service via
+modify-services.  E.g.:
+
+@lisp
+(services
+ (modify-services
+  %desktop-services
+  (udev-service-type config =>
+   (udev-configuration (inherit config)
+    (rules (cons hackrf
+            (udev-configuration-rules config)))))))
+@end lisp")
+     (license license:gpl2))))
+
 (define-public hamlib
   (package
     (name "hamlib")