unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: iyzsong@member.fsf.org (宋文武)
To: Ekaitz Zarraga <ekaitz@elenq.tech>
Cc: 41294@debbugs.gnu.org
Subject: [bug#41294] [PATCH] gnu: Add libfreenect.
Date: Sat, 16 May 2020 11:48:01 +0800	[thread overview]
Message-ID: <87k11c5ymm.fsf@member.fsf.org> (raw)
In-Reply-To: <5kf9uJF2SDo9zwlTUoFI13o7P7q68o-AuSp72MvOp5PUaF2SlAPxzQJvFws5aaTOB5EHY4T3-En0Mhba7hADMIeJkgCeWUOY_Ciy0fv24Ck=@elenq.tech> (Ekaitz Zarraga's message of "Fri, 15 May 2020 21:47:15 +0000")

Ekaitz Zarraga <ekaitz@elenq.tech> writes:

> Hi,

Hello,
>
> 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?

We generally try to enable all optional features when adding a package,
I'd go with:

  1. Build the python bindings by default.

  2. Try seperate the python bindings into another output.  (eg: newt)

  3. If 1 and 2 seems difficult, try add a seperate package for the
  python bindings, and it better only contains the bindings, reuse the
  original package as input.  (eg: python-libxml2)

  4. If not feel lucky, just leave a TODO comment for it...


>
> - 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.

To define a packages with multiple outputs:

- Decide what ‘outputs’ can be made, eg: ‘doc’, ‘bin’, ‘examples’,
  etc.  In this case, I’d add an ‘examples’ output, to put those
  ‘freenect-*’ binaries, built from the “examples” directory.
  
- Add an ‘outputs’ field, it default to ‘(list "out")’, We’d use
  ‘(outputs '("out" "examples")’.

- Modify the install flags or phases to get files into their output
  directory.  Sometimes we can configure the target directory by flags,
  but usually we have to move the files around after the install phase…
  
You can see ‘newt’ in ‘gnu/packages/slang.scm’ for a example.  

>
> - I'm not sure if the file where I added it is a good choice.

Same here, we can always move it later…

>
> Best,
>
> Ekaitz
>
> ---
>
>>From aa74e0b4872f6a2748ed919ebe3c265472d04664 Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <ekaitz@elenq.tech>
> 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 <vagrant@debian.org>
>  ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
>  ;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com>
> +;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
>  ;;;
>  ;;; 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
This ` quasiquote is unnecessary here, a ' quote is enough, because we
refer nothing outside in the arguments list.

By convention, a single semicolon is for comment after expression in the
same line. a double semicolon is for comment the next lines.

> +         #: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

Otherwise, look goods to me, hope it helps!




  parent reply	other threads:[~2020-05-16  3:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 21:47 [bug#41294] [PATCH] gnu: Add libfreenect Ekaitz Zarraga
2020-05-15 23:09 ` [bug#41294] [PATCH] gnu: libfreenect: Correct native-inputs vs inputs Ekaitz Zarraga
2020-05-16  3:48 ` 宋文武 [this message]
2020-05-16 10:18   ` [bug#41294] [PATCH] gnu: Add libfreenect Ekaitz Zarraga
2020-05-16 13:06     ` Ekaitz Zarraga
2020-05-16 13:28       ` Ekaitz Zarraga
2020-05-17  2:15       ` 宋文武
2020-05-17  9:37         ` Ekaitz Zarraga
2020-05-17 12:15           ` Ekaitz Zarraga
2020-05-19 13:26             ` 宋文武
2020-05-19 13:42               ` Ekaitz Zarraga
2020-05-19 13:52                 ` Ekaitz Zarraga
2020-05-20 13:33                   ` 宋文武
2020-05-20 16:37                     ` Ekaitz Zarraga
2020-05-21 11:38                       ` bug#41294: " 宋文武
2020-05-21 11:40                         ` [bug#41294] " Ekaitz Zarraga
2020-05-17  1:56     ` 宋文武

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k11c5ymm.fsf@member.fsf.org \
    --to=iyzsong@member.fsf.org \
    --cc=41294@debbugs.gnu.org \
    --cc=ekaitz@elenq.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).