gnu: rust: Shorten patch file name.
[jackhill/guix/guix.git] / gnu / packages / lirc.scm
CommitLineData
e7682771 1;;; GNU Guix --- Functional package management for GNU
41342e89
AK
2;;; Copyright © 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
3;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
e7682771
AK
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)
231313f7 23 #:use-module (guix git-download)
e7682771 24 #:use-module (guix build-system gnu)
231313f7 25 #:use-module (guix build-system python)
e7682771
AK
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages pkg-config)
a88825d9 29 #:use-module (gnu packages libusb)
e7682771 30 #:use-module (gnu packages linux)
678932aa 31 #:use-module (gnu packages xml)
e7682771
AK
32 #:use-module (gnu packages xorg)
33 #:use-module (gnu packages python))
34
35(define-public lirc
36 (package
37 (name "lirc")
41342e89 38 (version "0.10.1")
e7682771
AK
39 (source (origin
40 (method url-fetch)
de67e922
LF
41 (uri (string-append "mirror://sourceforge/lirc/LIRC/" version
42 "/lirc-" version ".tar.bz2"))
e7682771
AK
43 (sha256
44 (base32
41342e89 45 "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb"))
fc1adab1 46 (patches (search-patches "lirc-localstatedir.patch"))))
e7682771
AK
47 (build-system gnu-build-system)
48 (arguments
41342e89
AK
49 '(#:configure-flags
50 '("--localstatedir=/var"
51 ;; "configure" script fails to enable "devinput" driver as it
52 ;; checks for "/dev/input" directory (which is not available),
53 ;; so enable it explicitly.
54 "--enable-devinput")
a88825d9
AK
55 #:phases
56 (modify-phases %standard-phases
794cced6
TGR
57 (add-after 'unpack 'disable-kernel-sniffing
58 (lambda _
59 ;; Correct the faulty assumption that systemd support should be
60 ;; hard-wired when a build host's /proc/version contains "Ubuntu".
61 (substitute* "configure"
62 (("kernelversion=.*") "kernelversion=irrelevant\n"))
63 #t))
a88825d9
AK
64 (add-after 'unpack 'patch-lirc-make-devinput
65 (lambda* (#:key inputs #:allow-other-keys)
66 ;; 'lirc-make-devinput' script assumes that linux headers
67 ;; are placed in "/usr/...".
68 (let ((headers (assoc-ref inputs "linux-headers")))
69 (substitute* "tools/lirc-make-devinput"
70 (("/usr/include") (string-append headers "/include"))))
71 #t))
72 (add-after 'unpack 'patch-doc/Makefile.in
73 (lambda _
74 ;; Lirc wants to install several images and a useless html page
75 ;; to "$(localstatedir)/lib/lirc/". This makes 'install' phase
76 ;; fail as localstatedir is "/var", so do not install these
77 ;; files there (the same images are installed in
78 ;; "share/doc/lirc/images/" anyway).
79 (substitute* "doc/Makefile.in"
80 (("^vardocs_DATA =.*") "vardocs_DATA =\n")
81 (("^varimage_DATA =.*") "varimage_DATA =\n"))
82 #t)))))
e7682771 83 (native-inputs
678932aa
AK
84 `(("pkg-config" ,pkg-config)
85 ("libxslt" ,libxslt)))
e7682771
AK
86 (inputs
87 `(("libx11" ,libx11)
a88825d9
AK
88 ("libusb-compat" ,libusb-compat)
89 ("linux-headers" ,linux-libre-headers)
e7682771
AK
90 ("alsa-lib" ,alsa-lib)
91 ("python" ,python)))
92 (home-page "http://www.lirc.org/")
93 (synopsis "Linux Infrared Remote Control")
94 (description
95 "LIRC allows computers to send and receive IR signals of many commonly
96used remote controls. The most important part of LIRC is the 'lircd' daemon
97that decodes IR signals received by the device drivers. The second daemon
98program 'lircmd' allows to translate IR signals to mouse movements. The
99user space applications allow you to control your computer with a remote
100control: you can send X events to applications, start programs and much more
101on just one button press.")
102 (license license:gpl2+)))
231313f7
DM
103
104(define-public python-lirc
5dee9186
LF
105 (let ((commit "4091fe918f3eed2513dad008828565cace408d2f")
106 (revision "1"))
231313f7 107 (package
5dee9186
LF
108 (name "python-lirc")
109 (version (string-append "1.2.1-" revision "." (string-take commit 7)))
110 (source
111 (origin
112 (method git-fetch)
113 (uri (git-reference
114 (url "https://github.com/tompreston/python-lirc.git")
115 (commit commit)))
116 (sha256
117 (base32
118 "0cm47s5pvijfs3v2k7hmpxv3mvp4n5la0ihnsczk5ym3iq166jil"))
119 (file-name (string-append name "-" version))))
120 (build-system python-build-system)
121 (inputs
122 `(("lirc" ,lirc)))
123 (native-inputs
124 `(("python-cython" ,python-cython)))
231313f7 125 (arguments
5dee9186 126 `(#:tests? #f ; the only tests that exist are human-interactive
231313f7 127 #:phases
5dee9186
LF
128 (modify-phases %standard-phases
129 (add-before 'build 'build-from-cython-files
130 (lambda _
131 (zero? (system* "make" "py3")))))))
132 (home-page "https://github.com/tompreston/python-lirc")
133 (synopsis "Python bindings for LIRC")
134 (description "@code{lirc} is a Python module which provides LIRC bindings.")
135 (license license:gpl3)
136 (properties `((python2-variant . ,(delay python2-lirc)))))))
137
138 (define-public python2-lirc
139 (let ((base (package-with-python2 (strip-python2-variant python-lirc))))
140 (package
141 (inherit base)
142 (arguments
143 `(#:tests? #f ; the only tests that exist are human-interactive
144 #:phases
145 (modify-phases %standard-phases
146 (add-before 'build 'build-from-cython-files
147 (lambda _
148 (zero? (system* "make" "py2")))))))
149 (native-inputs
f3b98f4f 150 `(("python2-cython" ,python2-cython))))))