projects/guix·blob ruby-team · refs

145 lines · 5.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2020 Ekaitz Zarraga <[email protected]>
3;;; Copyright © 2021 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2026 Adrian Bradd <[email protected]>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages openkinect)
22 #:use-module (guix gexp)
23 #:use-module (guix packages)
24 #:use-module (guix git-download)
25 #:use-module (guix build-system cmake)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (gnu packages pkg-config)
28 #:use-module (gnu packages libusb)
29 #:use-module (gnu packages python)
30 #:use-module (gnu packages python-build)
31 #:use-module (gnu packages python-xyz)
32 #:use-module (gnu packages gl)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages image-processing))
35
36(define-public libfreenect
37 (package
38 (name "libfreenect")
39 (version "0.7.5")
40 (source
41 (origin
42 (method git-fetch)
43 (uri (git-reference
44 (url "https://github.com/OpenKinect/libfreenect")
45 (commit (string-append "v" version))))
46 (file-name (git-file-name name version))
47 (sha256
48 (base32 "0a4rgrqsl3jwdrpri3li2lrkag5s1zd40w9jxl59nhz5d8ald4iy"))))
49 (build-system cmake-build-system)
50 (arguments
51 (list
52 #:tests? #f ;package has no tests
53 #:configure-flags
54 #~(list "-DBUILD_FAKENECT=ON"
55 "-DBUILD_CPP=ON"
56 "-DBUILD_EXAMPLES=OFF" ;available in libfreenect-examples
57 "-DBUILD_CV=OFF" ;available in libfreenect-cv
58 "-DBUILD_PYTHON=OFF" ;available in python-libfreenect
59 "-DBUILD_C_SYNC=ON")
60 #:phases
61 #~(modify-phases %standard-phases
62 (add-after 'install 'install-udev-rules
63 (lambda _
64 (install-file "../source/platform/linux/udev/51-kinect.rules"
65 (string-append #$output "/lib/udev/rules.d")))))))
66 (native-inputs (list pkg-config))
67 (inputs (list libusb))
68 (synopsis "Drivers and libraries for the Xbox Kinect device")
69 (description
70 "libfreenect is a userspace driver for the Microsoft Kinect.
71It supports: RGB and Depth Images, Motors, Accelerometer, LED and Audio.")
72 (home-page "https://github.com/OpenKinect/libfreenect")
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 _
80 (substitute* "CMakeLists.txt"
81 ((".*libusb.*") "")
82 (("add_subdirectory \\(src\\)") "")
83 ((".*libfreenectConfig.cmake.*") ""))))))
84
85(define-public libfreenect-examples
86 (package
87 (inherit libfreenect)
88 (name "libfreenect-examples")
89 (arguments
90 (list
91 #:tests? #f ; package has no tests
92 #:configure-flags
93 #~(list "-DBUILD_EXAMPLES=ON"
94 "-DBUILD_FAKENECT=OFF"
95 "-DBUILD_CPP=OFF"
96 "-DBUILD_C_SYNC=OFF"
97 "-DBUILD_CV=OFF")
98 #:phases libfreenect-derived-phases))
99 (inputs (list libfreenect freeglut))
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 (list libfreenect opencv))
108 (arguments
109 (list
110 #:tests? #f ; package has no tests
111 #:configure-flags
112 #~(list "-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 (list python-cython python-setuptools))
127 (inputs
128 (list libfreenect))
129 (propagated-inputs
130 (list python python-numpy))
131 (arguments
132 (list
133 #:tests? #f ; package has no tests
134 #:configure-flags
135 #~(list "-DBUILD_EXAMPLES=OFF"
136 "-DBUILD_CPP=OFF"
137 "-DBUILD_CV=OFF"
138 "-DBUILD_C_SYNC=OFF"
139 "-DBUILD_FAKENECT=OFF"
140 "-DBUILD_PYTHON3=ON"
141 ;; Relax gcc-14's strictness.
142 "-DCMAKE_C_FLAGS=-Wno-error=int-conversion")
143 #:phases libfreenect-derived-phases))
144 (synopsis "Python wrapper for libfreenect, the Xbox Kinect device
145library")))