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