gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / lirc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
3 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
4 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages lirc)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system python)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages libusb)
32 #:use-module (gnu packages linux)
33 #:use-module (gnu packages xml)
34 #:use-module (gnu packages xorg)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages python-xyz))
37
38 (define-public lirc
39 (package
40 (name "lirc")
41 (version "0.10.1")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append "mirror://sourceforge/lirc/LIRC/" version
45 "/lirc-" version ".tar.bz2"))
46 (sha256
47 (base32
48 "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb"))
49 (patches (search-patches "lirc-localstatedir.patch"
50 "lirc-reproducible-build.patch"))))
51 (build-system gnu-build-system)
52 (arguments
53 '(#:configure-flags
54 '("--localstatedir=/var"
55 ;; "configure" script fails to enable "devinput" driver as it
56 ;; checks for "/dev/input" directory (which is not available),
57 ;; so enable it explicitly.
58 "--enable-devinput")
59 #:phases
60 (modify-phases %standard-phases
61 (add-after 'unpack 'disable-kernel-sniffing
62 (lambda _
63 ;; Correct the faulty assumption that systemd support should be
64 ;; hard-wired when a build host's /proc/version contains "Ubuntu".
65 (substitute* "configure"
66 (("kernelversion=.*") "kernelversion=irrelevant\n"))
67 #t))
68 (add-after 'unpack 'patch-lirc-make-devinput
69 (lambda* (#:key inputs #:allow-other-keys)
70 ;; 'lirc-make-devinput' script assumes that linux headers
71 ;; are placed in "/usr/...".
72 (let ((headers (assoc-ref inputs "linux-headers")))
73 (substitute* "tools/lirc-make-devinput"
74 (("/usr/include") (string-append headers "/include"))))
75 #t))
76 (add-after 'unpack 'patch-doc/Makefile.in
77 (lambda _
78 ;; Lirc wants to install several images and a useless html page
79 ;; to "$(localstatedir)/lib/lirc/". This makes 'install' phase
80 ;; fail as localstatedir is "/var", so do not install these
81 ;; files there (the same images are installed in
82 ;; "share/doc/lirc/images/" anyway).
83 (substitute* "doc/Makefile.in"
84 (("^vardocs_DATA =.*") "vardocs_DATA =\n")
85 (("^varimage_DATA =.*") "varimage_DATA =\n"))
86 #t)))))
87 (native-inputs
88 `(("pkg-config" ,pkg-config)
89 ("libxslt" ,libxslt)))
90 (inputs
91 `(("libx11" ,libx11)
92 ("libusb-compat" ,libusb-compat)
93 ("linux-headers" ,linux-libre-headers)
94 ("alsa-lib" ,alsa-lib)
95 ("python" ,python)))
96 (home-page "https://www.lirc.org/")
97 (synopsis "Linux Infrared Remote Control")
98 (description
99 "LIRC allows computers to send and receive IR signals of many commonly
100 used remote controls. The most important part of LIRC is the @code{lircd}
101 daemon that decodes IR signals received by the device drivers. The second
102 daemon program @code{lircmd} translates IR signals to mouse movements.
103 The user space applications allow you to control your computer with a remote
104 control: you can send X events to applications, start programs and much more
105 on just one button press.")
106 (license license:gpl2+)))
107
108 (define-public python-lirc
109 (let ((commit "c28708bbeb6e02d85f13dd7e0b24e8e86abc215b")
110 (revision "2"))
111 (package
112 (name "python-lirc")
113 (version (git-version "1.2.1" revision commit))
114 (source
115 (origin
116 (method git-fetch)
117 (uri (git-reference
118 (url "https://github.com/tompreston/python-lirc")
119 (commit commit)))
120 (file-name (git-file-name name version))
121 (sha256
122 (base32
123 "13s9zqyfh871ls1aha47rhmk13b4mcyfckcn2sw70bvc26832gk6"))))
124 (build-system python-build-system)
125 (inputs
126 `(("lirc" ,lirc)))
127 (native-inputs
128 `(("python-cython" ,python-cython)))
129 (arguments
130 `(#:tests? #f ; the only tests that exist are interactive
131 #:phases
132 (modify-phases %standard-phases
133 (add-before 'build 'build-from-cython-files
134 (lambda _ (invoke "make" "py3"))))))
135 (home-page "https://github.com/tompreston/python-lirc")
136 (synopsis "Python bindings for LIRC")
137 (description "@code{lirc} is a Python module which provides LIRC bindings.")
138 (license license:gpl3)
139 (properties `((python2-variant . ,(delay python2-lirc)))))))
140
141 (define-public python2-lirc
142 (let ((base (package-with-python2 (strip-python2-variant python-lirc))))
143 (package/inherit base
144 (arguments
145 `(#:tests? #f ; the only tests that exist are human-interactive
146 #:phases
147 (modify-phases %standard-phases
148 (add-before 'build 'build-from-cython-files
149 (lambda _ (invoke "make" "py2"))))))
150 (native-inputs
151 `(("python2-cython" ,python2-cython))))))