summaryrefslogtreecommitdiff
path: root/nongnu/packages/radio.scm
blob: d2e938e8a303bce4089caff0283ff3b9955c8d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;;
;;; This program 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.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

(define-module (nongnu packages radio)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages radio)
  #:use-module (guix build-system cmake)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix licenses)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (ice-9 match)
  #:use-module (nonguix build-system binary)
  #:use-module (nonguix licenses))

(define-public sdrplay
  (package
    (name "sdrplay")
    (version "3.07.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://www.sdrplay.com/software/"
                           "SDRplay_RSP_API-Linux-" version ".run"))
       (sha256
        (base32 "1a25c7rsdkcjxr7ffvx2lwj7fxdbslg9qhr8ghaq1r53rcrqgzmf"))))
    (build-system binary-build-system)
    (supported-systems '("i686-linux" "x86_64-linux"))
    (inputs
     `(("eudev" ,eudev)
       ("gcc:lib" ,gcc "lib")))
    (arguments
     `(#:patchelf-plan
       (let ((arch ,(match (or (%current-target-system) (%current-system))
                      ("i686-linux" "i686")
                      ("x86_64-linux" "x86_64")
                      (_ "UNSUPPORTED")))
             (major-minor ,(version-major+minor version)))
         `((,(string-append arch "/libsdrplay_api.so." major-minor)
            ("gcc:lib"))
           (,(string-append arch "/sdrplay_apiService")
            ("eudev" "gcc:lib"))))
       #:install-plan
       (let ((arch ,(match (or (%current-target-system) (%current-system))
                      ("i686-linux" "i686")
                      ("x86_64-linux" "x86_64")
                      (_ "UNSUPPORTED")))
             (major-minor ,(version-major+minor version)))
         `(("66-mirics.rules" "lib/udev/rules.d/66-mirics.rules")
           ("inc" "include")
           (,(string-append arch "/libsdrplay_api.so." major-minor)
            ,(string-append "lib/libsdrplay_api.so." major-minor))
           (,(string-append arch "/sdrplay_apiService")
            "bin/sdrplay_apiService")
           ("sdrplay_license.txt"
            ,(string-append "share/doc/sdrplay-" ,version  "/license.txt"))))
       #:phases
       (modify-phases %standard-phases
         (replace 'unpack
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((source-script (assoc-ref inputs "source")))
               (invoke "sh" source-script "--noexec" "--target" "source")
               (chdir "source"))))
         (add-after 'install 'create-library-links
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((major ,(version-major version))
                    (major-minor ,(version-major+minor version))
                    (lib (string-append (assoc-ref outputs "out")
                                        "/lib/libsdrplay_api.so"))
                    (lib-major (string-append lib "." major))
                    (lib-major-minor (string-append lib "." major-minor)))
               (symlink lib-major-minor lib-major)
               (symlink lib-major lib)))))))
    (home-page "https://www.sdrplay.com")
    (synopsis "API for SDRplay RSP devices")
    (description
     "This package provides the library and API service for using SDRplay RSP
devices.

To install the udev rules, you must extend @code{udev-service-type} with this
package.  E.g.: @code{(udev-rules-service 'sdrplay sdrplay)}")
    (license (nonfree (string-append "file:///share/doc/sdrplay-"
                                     version
                                     "/license.txt")))))

(define-public soapysdrplay3
  (package
    (name "soapysdrplay3")
    (version "0.4.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/pothosware/SoapySDRPlay3")
             (commit (string-append "soapy-sdrplay3-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0kp5gz03c29kxclaqijpyqknaijlbldrhy04mn98vnli9g1h1isq"))))
    (build-system cmake-build-system)
    (inputs
     (list sdrplay soapysdr))
    (arguments
     `(#:tests? #f))  ; No test suite
    (home-page "https://github.com/pothosware/SoapySDRPlay3/wiki")
    (synopsis "SoapySDR SDRplay module")
    (description "This package provides SDRplay devices support to the
SoapySDR library.")
    (license expat)))