guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#41294] [PATCH] gnu: Add libfreenect.


From: Ekaitz Zarraga
Subject: [bug#41294] [PATCH] gnu: Add libfreenect.
Date: Sat, 16 May 2020 13:06:23 +0000

> Inputs can also be defined with an extra argument for different outputs, 
> right? It should be something like:
>
> `(inputs`("freeglut" ,freeglut "examples"))
>
> Am I right?

Nope!

I've been digging and I got this wrong. The third part in the tuple is the 
output of the dependency.
So there's no way to indicate which dependencies are needed for each output.

I also found a flag to compile OpenCV wrappers, which depends on OpenCV. OpenCV 
is huge and it's going to be downloaded regardless if its output is used or 
not. Best choice here seems to be to separate the package in multiple 
sub-packages.

I made this with the examples (see below), how does it look?
I used libfreenect as a dependency for examples too, so I needed to patch the 
CMakeLists.txt to avoid it compile the `src` folder again.
Is it cool if I do the same thing with OpenCV and Python?

(now we can move it to its own module because it's going to be long :) )

---

(define-public libfreenect
  (let ((version "0.6.1"))
    (package
      (name "libfreenect")
      (version version)
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/OpenKinect/libfreenect";)
                      (commit (string-append "v" version))))
                (sha256
                 (base32 
"0was1va167rqshmpn382h36yyprpfi9cwillb6ylppmnfdrfrhrr"))))
      (build-system cmake-build-system)
      (outputs '("out" "opencv" "examples"))
      (arguments
       '(#:tests? #f ; Project has not tests
         #:configure-flags '("-DBUILD_EXAMPLES=ON"
                             "-DBUILD_FAKENECT=ON"
                             "-DBUILD_CPP=ON"
                             "-DBUILD_CV=OFF"
                             "-DBUILD_C_SYNC=ON")
         #:phases
         (modify-phases %standard-phases
           (add-after 'install 'install-udev-rules
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (rules-out (string-append out "/lib/udev/rules.d")))
                 (install-file "../source/platform/linux/udev/51-kinect.rules"
                               (string-append rules-out "51-kinect.rules"))
                 #t))))))
      (native-inputs
       `(("pkg-config" ,pkg-config)))
      (inputs
       `(("libusb" ,libusb)))
      (synopsis "Drivers and libraries for the Xbox Kinect device")
      (description "libfreenect is a userspace driver for the Microsoft Kinect.
It supports: RGB and Depth Images, Motors, Accelerometer, LED and Audio.")
      (home-page "https://openkinect.org/";)
      (license license:gpl2+))))

(define-public libfreenect-examples
  (package
    (inherit libfreenect)
    (name "libfreenect-examples")
    (inputs
     `(("libusb" ,libusb)
       ("libfreenect" ,libfreenect)
       ("glut" ,freeglut)))
    (arguments
     '(#:tests? #f ; Project has not tests
       #:configure-flags '("-DBUILD_EXAMPLES=ON"
                           "-DBUILD_FAKENECT=OFF"
                           "-DBUILD_CPP=OFF"
                           "-DBUILD_C_SYNC=OFF")
       #:phases
       (modify-phases
         %standard-phases
         (add-after
           'unpack 'remove-sources
           (lambda* (#:key outputs #:allow-other-keys)
                    (substitute* "CMakeLists.txt"
                                 (("add_subdirectory \\(src\\)") "")
                                 ((".*libfreenectConfig.cmake.*") "")))))))
    (synopsis "Examples for libfreenect, the Xbox Kinect device library")))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]