gnu: libretro-lowresnx: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / openkinect.scm
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>
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 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))
32
33 (define-public libfreenect
34 (let ((version "0.6.2"))
35 (package
36 (name "libfreenect")
37 (version version)
38 (source (origin
39 (method git-fetch)
40 (uri (git-reference
41 (url "https://github.com/OpenKinect/libfreenect")
42 (commit (string-append "v" version))))
43 (file-name (git-file-name name version))
44 (sha256
45 (base32
46 "02pb8mcl62kzdcgbnv3rw4nl0f08iw8pjiqqhfy3ycpkvyppw97w"))))
47 (build-system cmake-build-system)
48 (arguments
49 '(#:tests? #f ; package has no tests
50 #:configure-flags
51 '("-DBUILD_FAKENECT=ON"
52 "-DBUILD_CPP=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
56 "-DBUILD_C_SYNC=ON")
57 #:phases
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"))
65 #t))))))
66 (native-inputs
67 `(("pkg-config" ,pkg-config)))
68 (inputs
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+))))
75
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"
82 ((".*libusb.*") "")
83 (("add_subdirectory \\(src\\)") "")
84 ((".*libfreenectConfig.cmake.*") ""))
85 #t))))
86
87 (define-public libfreenect-examples
88 (package
89 (inherit libfreenect)
90 (name "libfreenect-examples")
91 (inputs
92 `(("libfreenect" ,libfreenect)
93 ("glut" ,freeglut)))
94 (arguments
95 `(#:tests? #f ; package has no tests
96 #:configure-flags '("-DBUILD_EXAMPLES=ON"
97 "-DBUILD_FAKENECT=OFF"
98 "-DBUILD_CPP=OFF"
99 "-DBUILD_C_SYNC=OFF"
100 "-DBUILD_CV=OFF")
101 #:phases ,libfreenect-derived-phases))
102 (synopsis "Examples for libfreenect, the Xbox Kinect device library")))
103
104 (define-public libfreenect-opencv
105 (package
106 (inherit libfreenect)
107 (name "libfreenect-opencv")
108 (inputs
109 `(("libfreenect" ,libfreenect)
110 ("opencv" ,opencv)))
111 (arguments
112 `(#:tests? #f ; package has no tests
113 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
114 "-DBUILD_FAKENECT=OFF"
115 "-DBUILD_CPP=OFF"
116 "-DBUILD_C_SYNC=OFF"
117 "-DBUILD_CV=ON")
118 #:phases ,libfreenect-derived-phases))
119 (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device
120 library")))
121
122 (define-public python-libfreenect
123 (package
124 (inherit libfreenect)
125 (name "python-libfreenect")
126 (native-inputs
127 `(("python-cython" ,python-cython)))
128 (inputs
129 `(("libfreenect" ,libfreenect)))
130 (propagated-inputs
131 `(("python" ,python)
132 ("python-numpy" ,python-numpy)))
133 (arguments
134 `(#:tests? #f ; package has no tests
135 #:configure-flags '("-DBUILD_EXAMPLES=OFF"
136 "-DBUILD_FAKENECT=OFF"
137 "-DBUILD_CPP=OFF"
138 "-DBUILD_C_SYNC=OFF"
139 "-DBUILD_CV=OFF"
140 "-DBUILD_PYTHON3=ON")
141 #:phases ,libfreenect-derived-phases))
142 (synopsis "Python wrapper for libfreenect, the Xbox Kinect device
143 library")))