1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
3 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
20 (define-module (gnu packages openkinect)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system cmake)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (gnu packages pkg-config)
26 #:use-module (gnu packages libusb)
27 #:use-module (gnu packages python)
28 #:use-module (gnu packages python-xyz)
29 #:use-module (gnu packages gl)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages image-processing))
33 (define-public libfreenect
34 (let ((version "0.6.2"))
41 (url "https://github.com/OpenKinect/libfreenect")
42 (commit (string-append "v" version))))
43 (file-name (git-file-name name version))
46 "02pb8mcl62kzdcgbnv3rw4nl0f08iw8pjiqqhfy3ycpkvyppw97w"))))
47 (build-system cmake-build-system)
49 '(#:tests? #f ; package has no tests
51 '("-DBUILD_FAKENECT=ON"
53 "-DBUILD_EXAMPLES=OFF" ; available in libfreenect-examples
54 "-DBUILD_CV=OFF" ; available in libfreenect-cv
55 "-DBUILD_PYTHON=OFF" ; available in python-libfreenect
58 (modify-phases %standard-phases
59 (add-after 'install 'install-udev-rules
60 (lambda* (#:key outputs #:allow-other-keys)
61 (let* ((out (assoc-ref outputs "out"))
62 (rules-out (string-append out "/lib/udev/rules.d")))
63 (install-file "../source/platform/linux/udev/51-kinect.rules"
64 (string-append rules-out "51-kinect.rules"))
67 `(("pkg-config" ,pkg-config)))
69 `(("libusb" ,libusb)))
70 (synopsis "Drivers and libraries for the Xbox Kinect device")
71 (description "libfreenect is a userspace driver for the Microsoft Kinect.
72 It supports: RGB and Depth Images, Motors, Accelerometer, LED and Audio.")
73 (home-page "https://openkinect.org/")
74 (license license:gpl2+))))
76 ;; Library are already compiled in libfreenect, avoid build it again.
77 (define libfreenect-derived-phases
78 '(modify-phases %standard-phases
79 (add-after 'unpack 'patch-CMakeLists.txt
80 (lambda* (#:key outputs #:allow-other-keys)
81 (substitute* "CMakeLists.txt"
83 (("add_subdirectory \\(src\\)") "")
84 ((".*libfreenectConfig.cmake.*") ""))
87 (define-public libfreenect-examples
90 (name "libfreenect-examples")
92 `(("libfreenect" ,libfreenect)
95 `(#:tests? #f ; package has no tests
96 #:configure-flags '("-DBUILD_EXAMPLES=ON"
97 "-DBUILD_FAKENECT=OFF"
101 #:phases ,libfreenect-derived-phases))
102 (synopsis "Examples for libfreenect, the Xbox Kinect device library")))
104 (define-public libfreenect-opencv
106 (inherit libfreenect)
107 (name "libfreenect-opencv")
109 `(("libfreenect" ,libfreenect)
112 `(#:tests? #f ; package has no tests
113 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
114 "-DBUILD_FAKENECT=OFF"
118 #:phases ,libfreenect-derived-phases))
119 (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device
122 (define-public python-libfreenect
124 (inherit libfreenect)
125 (name "python-libfreenect")
127 `(("python-cython" ,python-cython)))
129 `(("libfreenect" ,libfreenect)))
132 ("python-numpy" ,python-numpy)))
134 `(#:tests? #f ; package has no tests
135 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
136 "-DBUILD_FAKENECT=OFF"
140 "-DBUILD_PYTHON3=ON")
141 #:phases ,libfreenect-derived-phases))
142 (synopsis "Python wrapper for libfreenect, the Xbox Kinect device