WIP: HackRF Package Definition for Guix

I created this package definition, which I believe is in-and-of-itself complete:

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Christopher Howard <christopher@librehacker.com>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages hackrf)
  #:use-module (gnu packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system cmake)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages libusb))

(define-public hackrf
  (let ((commit "e9c6c2d2e6f9c2e903c1e69de9a48aa4b28a1e55")
        (revision "0"))
    (name "hackrf")
    (version (string-append "2018.01.1-" revision "." (string-take commit 7)))
    (home-page "https://greatscottgadgets.com/hackrf/")
    (synopsis "User-space library and utilities for HackRF SDR")
     "Command line utilities and a C library for controlling the HackRF
Software Defined Radio (SDR) over USB.")
    (license license:gpl2)
      (method git-fetch)
      (uri (git-reference
            (url "https://github.com/mossmann/hackrf.git")
            (commit commit)))
       (base32 "0vqlr0nph9r7wpqn81ghhdbb131803b8wi328iaz37304mrr6hkw"))
      (file-name (git-file-name name version))))
    (build-system cmake-build-system)
    (arguments '(#:configure-flags
                 (list "-DUDEV_RULES_GROUP=dialout"
                       (string-append "-DUDEV_RULES_PATH="
                                       %outputs "out") "/lib/udev/rules.d"))
                 #:phases (modify-phases %standard-phases
                            (add-before 'configure 'enter-source-directory
                              (lambda _ (chdir "host") #t))
                            (add-before 'install-license-files
                                'change-back (lambda _ (chdir "..") #t)))
                 #:tests? #f #| no test suite |# ))
     `(("pkg-config" ,pkg-config)))
    (inputs `(("libusb" ,libusb)
              ("fftw" ,fftw)
              ("fftwf" ,fftwf))))))

However, I have not submitted it as a patch yet, as I wanted to test it with my HackRF SDR first, and that let me down a rabbit trail on how to install udev rules in Guix. I’m about out of time for this project for today, so I’ll finish this up next week, God willing.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s