lirc.scm 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. (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. (define-public lirc
  37. (package
  38. (name "lirc")
  39. (version "0.10.1")
  40. (source (origin
  41. (method url-fetch)
  42. (uri (string-append "mirror://sourceforge/lirc/LIRC/" version
  43. "/lirc-" version ".tar.bz2"))
  44. (sha256
  45. (base32
  46. "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb"))
  47. (patches (search-patches "lirc-localstatedir.patch"
  48. "lirc-reproducible-build.patch"))))
  49. (build-system gnu-build-system)
  50. (arguments
  51. '(#:configure-flags
  52. '("--localstatedir=/var"
  53. ;; "configure" script fails to enable "devinput" driver as it
  54. ;; checks for "/dev/input" directory (which is not available),
  55. ;; so enable it explicitly.
  56. "--enable-devinput")
  57. #:phases
  58. (modify-phases %standard-phases
  59. (add-after 'unpack 'disable-kernel-sniffing
  60. (lambda _
  61. ;; Correct the faulty assumption that systemd support should be
  62. ;; hard-wired when a build host's /proc/version contains "Ubuntu".
  63. (substitute* "configure"
  64. (("kernelversion=.*") "kernelversion=irrelevant\n"))
  65. #t))
  66. (add-after 'unpack 'patch-lirc-make-devinput
  67. (lambda* (#:key inputs #:allow-other-keys)
  68. ;; 'lirc-make-devinput' script assumes that linux headers
  69. ;; are placed in "/usr/...".
  70. (let ((headers (assoc-ref inputs "linux-headers")))
  71. (substitute* "tools/lirc-make-devinput"
  72. (("/usr/include") (string-append headers "/include"))))
  73. #t))
  74. (add-after 'unpack 'patch-doc/Makefile.in
  75. (lambda _
  76. ;; Lirc wants to install several images and a useless html page
  77. ;; to "$(localstatedir)/lib/lirc/". This makes 'install' phase
  78. ;; fail as localstatedir is "/var", so do not install these
  79. ;; files there (the same images are installed in
  80. ;; "share/doc/lirc/images/" anyway).
  81. (substitute* "doc/Makefile.in"
  82. (("^vardocs_DATA =.*") "vardocs_DATA =\n")
  83. (("^varimage_DATA =.*") "varimage_DATA =\n"))
  84. #t)))))
  85. (native-inputs
  86. `(("pkg-config" ,pkg-config)
  87. ("libxslt" ,libxslt)))
  88. (inputs
  89. `(("libx11" ,libx11)
  90. ("libusb-compat" ,libusb-compat)
  91. ("linux-headers" ,linux-libre-headers)
  92. ("alsa-lib" ,alsa-lib)
  93. ("python" ,python)))
  94. (home-page "https://www.lirc.org/")
  95. (synopsis "Linux Infrared Remote Control")
  96. (description
  97. "LIRC allows computers to send and receive IR signals of many commonly
  98. used remote controls. The most important part of LIRC is the @code{lircd}
  99. daemon that decodes IR signals received by the device drivers. The second
  100. daemon program @code{lircmd} translates IR signals to mouse movements.
  101. The user space applications allow you to control your computer with a remote
  102. control: you can send X events to applications, start programs and much more
  103. on just one button press.")
  104. (license license:gpl2+)))
  105. (define-public python-lirc
  106. (let ((commit "c28708bbeb6e02d85f13dd7e0b24e8e86abc215b")
  107. (revision "2"))
  108. (package
  109. (name "python-lirc")
  110. (version (git-version "1.2.1" revision commit))
  111. (source
  112. (origin
  113. (method git-fetch)
  114. (uri (git-reference
  115. (url "https://github.com/tompreston/python-lirc")
  116. (commit commit)))
  117. (file-name (git-file-name name version))
  118. (sha256
  119. (base32
  120. "13s9zqyfh871ls1aha47rhmk13b4mcyfckcn2sw70bvc26832gk6"))))
  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 interactive
  128. #:phases
  129. (modify-phases %standard-phases
  130. (add-before 'build 'build-from-cython-files
  131. (lambda _ (invoke "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. (define-public python2-lirc
  138. (let ((base (package-with-python2 (strip-python2-variant python-lirc))))
  139. (package/inherit base
  140. (arguments
  141. `(#:tests? #f ; the only tests that exist are human-interactive
  142. #:phases
  143. (modify-phases %standard-phases
  144. (add-before 'build 'build-from-cython-files
  145. (lambda _ (invoke "make" "py2"))))))
  146. (native-inputs
  147. `(("python2-cython" ,python2-cython))))))