gnu: Add libpepadapter.
[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))))
42 (sha256
43 (base32
44 "0was1va167rqshmpn382h36yyprpfi9cwillb6ylppmnfdrfrhrr"))))
45 (build-system cmake-build-system)
46 (arguments
47 '(#:tests? #f ; package has no tests
48 #:configure-flags
49 '("-DBUILD_FAKENECT=ON"
50 "-DBUILD_CPP=ON"
51 "-DBUILD_EXAMPLES=OFF" ; available in libfreenect-examples
52 "-DBUILD_CV=OFF" ; available in libfreenect-cv
53 "-DBUILD_PYTHON=OFF" ; available in python-libfreenect
54 "-DBUILD_C_SYNC=ON")
55 #:phases
56 (modify-phases %standard-phases
57 (add-after 'install 'install-udev-rules
58 (lambda* (#:key outputs #:allow-other-keys)
59 (let* ((out (assoc-ref outputs "out"))
60 (rules-out (string-append out "/lib/udev/rules.d")))
61 (install-file "../source/platform/linux/udev/51-kinect.rules"
62 (string-append rules-out "51-kinect.rules"))
63 #t))))))
64 (native-inputs
65 `(("pkg-config" ,pkg-config)))
66 (inputs
67 `(("libusb" ,libusb)))
68 (synopsis "Drivers and libraries for the Xbox Kinect device")
69 (description "libfreenect is a userspace driver for the Microsoft Kinect.
70It supports: RGB and Depth Images, Motors, Accelerometer, LED and Audio.")
71 (home-page "https://openkinect.org/")
72 (license license:gpl2+))))
73
74;; Library are already compiled in libfreenect, avoid build it again.
75(define libfreenect-derived-phases
76 '(modify-phases %standard-phases
77 (add-after 'unpack 'patch-CMakeLists.txt
78 (lambda* (#:key outputs #:allow-other-keys)
79 (substitute* "CMakeLists.txt"
80 ((".*libusb.*") "")
81 (("add_subdirectory \\(src\\)") "")
82 ((".*libfreenectConfig.cmake.*") ""))
83 #t))))
84
85(define-public libfreenect-examples
86 (package
87 (inherit libfreenect)
88 (name "libfreenect-examples")
89 (inputs
90 `(("libfreenect" ,libfreenect)
91 ("glut" ,freeglut)))
92 (arguments
93 `(#:tests? #f ; package has no tests
94 #:configure-flags '("-DBUILD_EXAMPLES=ON"
95 "-DBUILD_FAKENECT=OFF"
96 "-DBUILD_CPP=OFF"
97 "-DBUILD_C_SYNC=OFF"
98 "-DBUILD_CV=OFF")
99 #:phases ,libfreenect-derived-phases))
100 (synopsis "Examples for libfreenect, the Xbox Kinect device library")))
101
102(define-public libfreenect-opencv
103 (package
104 (inherit libfreenect)
105 (name "libfreenect-opencv")
106 (inputs
107 `(("libfreenect" ,libfreenect)
108 ("opencv" ,opencv)))
109 (arguments
110 `(#:tests? #f ; package has no tests
111 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
112 "-DBUILD_FAKENECT=OFF"
113 "-DBUILD_CPP=OFF"
114 "-DBUILD_C_SYNC=OFF"
115 "-DBUILD_CV=ON")
116 #:phases ,libfreenect-derived-phases))
117 (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device
118library")))
119
120(define-public python-libfreenect
121 (package
122 (inherit libfreenect)
123 (name "python-libfreenect")
124 (native-inputs
125 `(("python-cython" ,python-cython)))
126 (inputs
127 `(("libfreenect" ,libfreenect)))
128 (propagated-inputs
129 `(("python" ,python)
130 ("python-numpy" ,python-numpy)))
131 (arguments
132 `(#:tests? #f ; package has no tests
133 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
134 "-DBUILD_FAKENECT=OFF"
135 "-DBUILD_CPP=OFF"
136 "-DBUILD_C_SYNC=OFF"
137 "-DBUILD_CV=OFF"
138 "-DBUILD_PYTHON3=ON")
139 #:phases ,libfreenect-derived-phases))
140 (synopsis "Python wrapper for libfreenect, the Xbox Kinect device
141library")))