gnu: r-fields: Update to 11.4.
[jackhill/guix/guix.git] / gnu / packages / openkinect.scm
CommitLineData
cf1518f5
EZ
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages openkinect)
20 #:use-module (guix packages)
21 #:use-module (guix git-download)
22 #:use-module (guix build-system cmake)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (gnu packages pkg-config)
25 #:use-module (gnu packages libusb)
26 #:use-module (gnu packages python)
27 #:use-module (gnu packages python-xyz)
28 #:use-module (gnu packages gl)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages image-processing))
31
32(define-public libfreenect
33 (let ((version "0.6.1"))
34 (package
35 (name "libfreenect")
36 (version version)
37 (source (origin
38 (method git-fetch)
39 (uri (git-reference
40 (url "https://github.com/OpenKinect/libfreenect")
41 (commit (string-append "v" version))))
09c2fb12 42 (file-name (git-file-name name version))
cf1518f5
EZ
43 (sha256
44 (base32
45 "0was1va167rqshmpn382h36yyprpfi9cwillb6ylppmnfdrfrhrr"))))
46 (build-system cmake-build-system)
47 (arguments
48 '(#:tests? #f ; package has no tests
49 #:configure-flags
50 '("-DBUILD_FAKENECT=ON"
51 "-DBUILD_CPP=ON"
52 "-DBUILD_EXAMPLES=OFF" ; available in libfreenect-examples
53 "-DBUILD_CV=OFF" ; available in libfreenect-cv
54 "-DBUILD_PYTHON=OFF" ; available in python-libfreenect
55 "-DBUILD_C_SYNC=ON")
56 #:phases
57 (modify-phases %standard-phases
58 (add-after 'install 'install-udev-rules
59 (lambda* (#:key outputs #:allow-other-keys)
60 (let* ((out (assoc-ref outputs "out"))
61 (rules-out (string-append out "/lib/udev/rules.d")))
62 (install-file "../source/platform/linux/udev/51-kinect.rules"
63 (string-append rules-out "51-kinect.rules"))
64 #t))))))
65 (native-inputs
66 `(("pkg-config" ,pkg-config)))
67 (inputs
68 `(("libusb" ,libusb)))
69 (synopsis "Drivers and libraries for the Xbox Kinect device")
70 (description "libfreenect is a userspace driver for the Microsoft Kinect.
71It supports: RGB and Depth Images, Motors, Accelerometer, LED and Audio.")
72 (home-page "https://openkinect.org/")
73 (license license:gpl2+))))
74
75;; Library are already compiled in libfreenect, avoid build it again.
76(define libfreenect-derived-phases
77 '(modify-phases %standard-phases
78 (add-after 'unpack 'patch-CMakeLists.txt
79 (lambda* (#:key outputs #:allow-other-keys)
80 (substitute* "CMakeLists.txt"
81 ((".*libusb.*") "")
82 (("add_subdirectory \\(src\\)") "")
83 ((".*libfreenectConfig.cmake.*") ""))
84 #t))))
85
86(define-public libfreenect-examples
87 (package
88 (inherit libfreenect)
89 (name "libfreenect-examples")
90 (inputs
91 `(("libfreenect" ,libfreenect)
92 ("glut" ,freeglut)))
93 (arguments
94 `(#:tests? #f ; package has no tests
95 #:configure-flags '("-DBUILD_EXAMPLES=ON"
96 "-DBUILD_FAKENECT=OFF"
97 "-DBUILD_CPP=OFF"
98 "-DBUILD_C_SYNC=OFF"
99 "-DBUILD_CV=OFF")
100 #:phases ,libfreenect-derived-phases))
101 (synopsis "Examples for libfreenect, the Xbox Kinect device library")))
102
103(define-public libfreenect-opencv
104 (package
105 (inherit libfreenect)
106 (name "libfreenect-opencv")
107 (inputs
108 `(("libfreenect" ,libfreenect)
109 ("opencv" ,opencv)))
110 (arguments
111 `(#:tests? #f ; package has no tests
112 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
113 "-DBUILD_FAKENECT=OFF"
114 "-DBUILD_CPP=OFF"
115 "-DBUILD_C_SYNC=OFF"
116 "-DBUILD_CV=ON")
117 #:phases ,libfreenect-derived-phases))
118 (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device
119library")))
120
121(define-public python-libfreenect
122 (package
123 (inherit libfreenect)
124 (name "python-libfreenect")
125 (native-inputs
126 `(("python-cython" ,python-cython)))
127 (inputs
128 `(("libfreenect" ,libfreenect)))
129 (propagated-inputs
130 `(("python" ,python)
131 ("python-numpy" ,python-numpy)))
132 (arguments
133 `(#:tests? #f ; package has no tests
134 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
135 "-DBUILD_FAKENECT=OFF"
136 "-DBUILD_CPP=OFF"
137 "-DBUILD_C_SYNC=OFF"
138 "-DBUILD_CV=OFF"
139 "-DBUILD_PYTHON3=ON")
140 #:phases ,libfreenect-derived-phases))
141 (synopsis "Python wrapper for libfreenect, the Xbox Kinect device
142library")))