1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 libusb1,
7 pkg-config,
8 libglut,
9 libGLU,
10 libGL,
11 libXi,
12 libXmu,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "freenect";
17 version = "0.7.5";
18
19 src = fetchFromGitHub {
20 owner = "OpenKinect";
21 repo = "libfreenect";
22 rev = "v${version}";
23 sha256 = "sha256-PpJGFWrlQ5sK7TJxQNoPujw1MxWRjphvblwOqnF+mSg=";
24 };
25
26 buildInputs = [
27 libusb1
28 libglut
29 libGLU
30 libGL
31 libXi
32 libXmu
33 ];
34
35 nativeBuildInputs = [
36 cmake
37 pkg-config
38 ];
39
40 # see https://aur.archlinux.org/cgit/aur.git/commit/PKGBUILD?h=libfreenect&id=0d17db49ba64bcb9e3a4eed61cf55c9a5ceb97f1
41 patchPhase =
42 lib.concatMapStrings
43 (x: ''
44 substituteInPlace ${x} --replace "{GLUT_LIBRARY}" "{GLUT_LIBRARIES}"
45 '')
46 [
47 "examples/CMakeLists.txt"
48 "wrappers/cpp/CMakeLists.txt"
49 ];
50
51 meta = {
52 description = "Drivers and libraries for the Xbox Kinect device on Windows, Linux, and macOS";
53 homepage = "http://openkinect.org";
54 license = with lib.licenses; [
55 gpl2
56 asl20
57 ];
58 maintainers = with lib.maintainers; [ bennofs ];
59 platforms = with lib.platforms; linux ++ darwin;
60 };
61}