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