--- Begin Message ---
Subject: |
[PATCH] gnu: Add libfreenect. |
Date: |
Fri, 15 May 2020 21:47:15 +0000 |
Hi,
Adding libfreenect as discussed here:
https://issues.guix.gnu.org/40492
I have some doubts with this package:
- It has some extra flags that can be set in the configure step to build some
python bindings. I didn't set them because they also require a python
interpreter. How is the best way to handle that? Make another package with the
flags set? Activate them by default? Leave them as I did?
- The package is 300 megs checking `guix size` that's because it has some
testing binaries that have extra dependencies. If only the library is compiled
it doesn't depend on GLUT and that reduces the size a lot. I tried to separate
the package's outputs but I don't know how to do it correctly (I checked the
docs but it doesn't go in detail). I'd like to do it but I need some help.
- I'm not sure if the file where I added it is a good choice.
Best,
Ekaitz
---
>From aa74e0b4872f6a2748ed919ebe3c265472d04664 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <address@hidden>
Date: Fri, 15 May 2020 23:22:04 +0200
Subject: [PATCH] gnu: Add libfreenect.
* gnu/packages/libusb (libfreenect): New variable.
---
gnu/packages/libusb.scm | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 3842f3fead..a27373c15a 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2018 Vagrant Cascadian <address@hidden>
;;; Copyright © 2020 Marius Bakke <address@hidden>
;;; Copyright © 2020 Christopher Howard <address@hidden>
+;;; Copyright © 2020 Ekaitz Zarraga <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -48,7 +49,8 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages tls)
- #:use-module (gnu packages xiph))
+ #:use-module (gnu packages xiph)
+ #:use-module (gnu packages gl))
(define-public libusb
(package
@@ -679,3 +681,38 @@ HID-Class devices.")
(define-public python2-hidapi
(package-with-python2 python-hidapi))
+
+(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)
+ (arguments
+ `(#:tests? #f ;; Project has not tests
+ #: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
+ `(("libusb" ,libusb)
+ ("pkg-config" ,pkg-config)))
+ (inputs
+ `(("glut" ,freeglut)))
+ (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+))))
--
2.26.1
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#41294] [PATCH] gnu: Add libfreenect. |
Date: |
Thu, 21 May 2020 19:38:15 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Ekaitz Zarraga <address@hidden> writes:
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, May 20, 2020 3:33 PM, <address@hidden> wrote:
>>
>> Um, I mean something like this:
>>
>> (define libfreenect-derived-phases
>> '(modify-phases %standard-phases
>> (lambda* (#:key outputs #:allow-other-keys)
>> ...)))
>>
>> ...
>> (arguments
>> `(#:phases ,libfreenect-derived-phases))
>> ...
>>
>> Here 'libfreenect-derived-phases' is a list of symbols, the arguments
>> field we want is a list of symbols too.
>
> Hi,
>
> That makes way more sense than what I was trying to do.
> I applied that and separated libfreenect to a different module. Patch below.
Pushed, with:
- Change libfreenect-python to 'python-libfreenect'.
- Change libfreenect-cv to 'libfreenect-opencv'.
- Change some comments..
Thank you!
>
> Thank you very much for your support.
>
> PS: I'm still wondering what kind of weird magic is involved in the example I
> shown.
>
Basically we can't use procedure (defined outside of the builder
environment) values in the package's arguments field, it have to be self
contained, as the package builder is a guile script file serialized from
the package object (procedures serilazied into #<procedure ...>, and
can't be loaded again), and will be executed in an isolated environment.
--- End Message ---