* [bug#41294] [PATCH] gnu: Add libfreenect. @ 2020-05-15 21:47 Ekaitz Zarraga 2020-05-15 23:09 ` [bug#41294] [PATCH] gnu: libfreenect: Correct native-inputs vs inputs Ekaitz Zarraga 2020-05-16 3:48 ` [bug#41294] [PATCH] gnu: Add libfreenect 宋文武 0 siblings, 2 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-15 21:47 UTC (permalink / raw) To: 41294 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 <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 + #: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 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: libfreenect: Correct native-inputs vs inputs 2020-05-15 21:47 [bug#41294] [PATCH] gnu: Add libfreenect Ekaitz Zarraga @ 2020-05-15 23:09 ` Ekaitz Zarraga 2020-05-16 3:48 ` [bug#41294] [PATCH] gnu: Add libfreenect 宋文武 1 sibling, 0 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-15 23:09 UTC (permalink / raw) To: 41294@debbugs.gnu.org From 22886e9048c88d607622a3e9dba60c179954b9fc Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga <ekaitz@elenq.tech> Date: Sat, 16 May 2020 01:06:24 +0200 Subject: [PATCH] gnu: libfreenect: Correct native-inputs vs inputs * gnu/packages/libusb.scm (libfreenect): Change inputs --- gnu/packages/libusb.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm index a27373c15a..51149dea1a 100644 --- a/gnu/packages/libusb.scm +++ b/gnu/packages/libusb.scm @@ -707,10 +707,10 @@ HID-Class devices.") (string-append rules-out "51-kinect.rules")) #t)))))) (native-inputs - `(("libusb" ,libusb) - ("pkg-config" ,pkg-config))) + `(("pkg-config" ,pkg-config))) (inputs - `(("glut" ,freeglut))) + `(("libusb" ,libusb) + ("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.") -- 2.26.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 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 ` 宋文武 2020-05-16 10:18 ` Ekaitz Zarraga 1 sibling, 1 reply; 17+ messages in thread From: 宋文武 @ 2020-05-16 3:48 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294 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! ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-16 3:48 ` [bug#41294] [PATCH] gnu: Add libfreenect 宋文武 @ 2020-05-16 10:18 ` Ekaitz Zarraga 2020-05-16 13:06 ` Ekaitz Zarraga 2020-05-17 1:56 ` 宋文武 0 siblings, 2 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-16 10:18 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294@debbugs.gnu.org Hi, On Saturday, May 16, 2020 5:48 AM, <iyzsong@member.fsf.org> wrote: > 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... > I don't really like the first because it forces you to add a python interpreter that is not needed otherwise. 2 and 3 sound good to me. It can handle both python2 and 3. What would you do with that? Maybe make option 3 and add two outputs to that with python2 and python3? Or two different packages? (or just forget the python2?) > > > - 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. Great! Thank you. That's more or less what I understood from some code examples I checked but they were complex and I tried to make the same thing and didn't work for me. I'll give it a new try with this example. 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? > > > - I'm not sure if the file where I added it is a good choice. > > Same here, we can always move it later… Yeah, sure. Thank you very much for your help. Best, Ekaitz ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-16 10:18 ` Ekaitz Zarraga @ 2020-05-16 13:06 ` Ekaitz Zarraga 2020-05-16 13:28 ` Ekaitz Zarraga 2020-05-17 2:15 ` 宋文武 2020-05-17 1:56 ` 宋文武 1 sibling, 2 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-16 13:06 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294@debbugs.gnu.org > 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"))) ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-16 13:06 ` Ekaitz Zarraga @ 2020-05-16 13:28 ` Ekaitz Zarraga 2020-05-17 2:15 ` 宋文武 1 sibling, 0 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-16 13:28 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294@debbugs.gnu.org > (outputs '("out" "opencv" "examples")) Ignore this line, I forgot to remove it :S ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 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 1 sibling, 1 reply; 17+ messages in thread From: 宋文武 @ 2020-05-17 2:15 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294@debbugs.gnu.org Ekaitz Zarraga <ekaitz@elenq.tech> writes: > [...] > > 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")) As note in your latest email, this line should be removed, as it's a single output package now. > (arguments > '(#:tests? #f ; Project has not tests > #:configure-flags '("-DBUILD_EXAMPLES=ON" Should be "-DBUILD_EXAMPLES=OFF"? > "-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 Maybe 'configure-examples? This phases doesn't remove sources, but avoid building them. > (lambda* (#:key outputs #:allow-other-keys) How about add a comment here: Reuse "libfreenect" from input, avoid building it again. > (substitute* "CMakeLists.txt" > (("add_subdirectory \(src\)") "") > ((".*libfreenectConfig.cmake.*") ""))))))) > (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) Also check the outputs of libfreenect and libfreenect-examples, they shouldn't have same files (maybe by guix install them). Otherwise, look goods to me. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-17 2:15 ` 宋文武 @ 2020-05-17 9:37 ` Ekaitz Zarraga 2020-05-17 12:15 ` Ekaitz Zarraga 0 siblings, 1 reply; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-17 9:37 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Sunday, May 17, 2020 4:15 AM, <iyzsong@member.fsf.org> wrote: > Ekaitz Zarraga ekaitz@elenq.tech writes: > > > [...] > > 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")) > > As note in your latest email, this line should be removed, as it's a single > output package now. > > > (arguments > > '(#:tests? #f ; Project has not tests > > #:configure-flags '("-DBUILD_EXAMPLES=ON" > > > > Should be "-DBUILD_EXAMPLES=OFF"? > > > "-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 > > Maybe 'configure-examples? This phases doesn't remove sources, but > avoid building them. > > > (lambda* (#:key outputs #:allow-other-keys) > > > > How about add a comment here: Reuse "libfreenect" from input, avoid building it again. > > > (substitute* "CMakeLists.txt" > > (("add_subdirectory \\(src\\)") "") > > ((".*libfreenectConfig.cmake.*") ""))))))) > > (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) > > > > Also check the outputs of libfreenect and libfreenect-examples, they > shouldn't have same files (maybe by guix install them). > > Otherwise, look goods to me. Hi! Thanks. I was worried about if this is a common practice. I already prepared something. I'll send the patch soon. Thanks for your explanations, they are very helpful. Best, Ekaitz ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-17 9:37 ` Ekaitz Zarraga @ 2020-05-17 12:15 ` Ekaitz Zarraga 2020-05-19 13:26 ` 宋文武 0 siblings, 1 reply; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-17 12:15 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org Hi, I came up with this. It's just a diff because I'd like to improve something. There's the same lambda sent to all the packages that need to disable sources compilation but I'm not able to create it in a function that I send later to all those. How can I do that? I'm getting `Unknown object` errors. I tried to create a new function with `define*` with the same body the lambda has. Quasiquote the `arguments` and unquote the function there. Nothing. There's some kind of weird magic I'm not getting. diff --git a/gnu/packages/openkinect.scm b/gnu/packages/openkinect.scm new file mode 100644 index 0000000000..1aebb34384 --- /dev/null +++ b/gnu/packages/openkinect.scm @@ -0,0 +1,137 @@ +(define-module (gnu packages openkinect) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system cmake) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages libusb) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages gl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages image-processing)) + +(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 + #:configure-flags + '("-DBUILD_FAKENECT=ON" + "-DBUILD_CPP=ON" + "-DBUILD_EXAMPLES=OFF" ; Available in libfreenect-examples + "-DBUILD_CV=OFF" ; Available in libfreenect-cv + "-DBUILD_PYTHON=OFF" ; Available in libfreenect-python + "-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 + `(("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" + "-DBUILD_CV=OFF") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".*libusb.*") "") + (("add_subdirectory \\(src\\)") "") + ((".*libfreenectConfig.cmake.*") ""))) + )))) + (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) + +(define-public libfreenect-cv + (package + (inherit libfreenect) + (name "libfreenect-cv") + (inputs + `(("libfreenect" ,libfreenect) + ("opencv" ,opencv))) + (arguments + '(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=ON") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".*libusb.*") "") + (("add_subdirectory \\(src\\)") "") + ((".*libfreenectConfig.cmake.*") ""))))))) + (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device +library"))) + +(define-public libfreenect-python + (package + (inherit libfreenect) + (name "libfreenect-python") + (native-inputs + `(("python-cython" ,python-cython))) + (inputs + `(("libfreenect" ,libfreenect))) + (propagated-inputs + `(("python" ,python) + ("python-numpy" ,python-numpy))) + (arguments + '(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=OFF" + "-DBUILD_PYTHON3=ON") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".*libusb.*") "") + (("add_subdirectory \\(src\\)") "") + ((".*libfreenectConfig.cmake.*") ""))))))) + (synopsis "Python wrapper for libfreenect, the Xbox Kinect device +library"))) ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-17 12:15 ` Ekaitz Zarraga @ 2020-05-19 13:26 ` 宋文武 2020-05-19 13:42 ` Ekaitz Zarraga 0 siblings, 1 reply; 17+ messages in thread From: 宋文武 @ 2020-05-19 13:26 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294@debbugs.gnu.org Ekaitz Zarraga <ekaitz@elenq.tech> writes: > Hi, > I came up with this. It's just a diff because I'd like to improve something. > > There's the same lambda sent to all the packages that need to disable > sources compilation but I'm not able to create it in a function that I > send later to all those. > > How can I do that? I'm getting `Unknown object` errors. > > I tried to create a new function with `define*` with the same body the > lambda has. Quasiquote the `arguments` and unquote the function there. > Nothing. There's some kind of weird magic I'm not getting. > Hello, I don't know the whole detail too, but to build a package, guix likely: - Load and eval the package module, to get the package object. The 'arguments' field is a list. - Convert this package object to a derivation, and write it in store as a file (/gnu/store/*.drv). Where 'arguments' being part of the builder, serialize as string to the file, it dosen't do complex things for procedure bindings, only write their string descriptions... So when the builder file is loaded, you get `Unknown object` errors. Here, to avoid duplicating the code, you can: 1. Unquote list value into `arguments`. (eg: 'asdf-substitutions' in lisp.scm) 2. Use `(package-arguments libfreenect-examples)` with `substitute-keyword-arguments` to reuse arguments, but modify `configure-flags` etc. (eg: qtx11extras) The build system can use 'imported-modules' to make a set of guile modules (which can contains useful procedures, etc.) available to the builder, but thas's overkill to be used here... > > diff --git a/gnu/packages/openkinect.scm b/gnu/packages/openkinect.scm > new file mode 100644 > index 0000000000..1aebb34384 > --- /dev/null > +++ b/gnu/packages/openkinect.scm > @@ -0,0 +1,137 @@ > +(define-module (gnu packages openkinect) > + #:use-module (guix packages) > + #:use-module (guix git-download) > + #:use-module (guix build-system cmake) > + #:use-module ((guix licenses) #:prefix license:) > + #:use-module (gnu packages pkg-config) > + #:use-module (gnu packages libusb) > + #:use-module (gnu packages python) > + #:use-module (gnu packages python-xyz) > + #:use-module (gnu packages gl) > + #:use-module (gnu packages pkg-config) > + #:use-module (gnu packages image-processing)) > + > +(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 "has not tests" sounds wrong be me, maybe: "package has no tests". Otherwise, look good to me! ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-19 13:26 ` 宋文武 @ 2020-05-19 13:42 ` Ekaitz Zarraga 2020-05-19 13:52 ` Ekaitz Zarraga 0 siblings, 1 reply; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-19 13:42 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org Hi, > > There's some kind of weird magic I'm not getting. > > Hello, I don't know the whole detail too, but to build a package, guix likely: > > - Load and eval the package module, to get the package object. The > 'arguments' field is a list. > - Convert this package object to a derivation, and write it in store as > a file (/gnu/store/*.drv). Where 'arguments' being part of the > builder, serialize as string to the file, it dosen't do complex things > for procedure bindings, only write their string descriptions... So > when the builder file is loaded, you get `Unknown object` errors. > > Here, to avoid duplicating the code, you can: > > > 1. Unquote list value into `arguments`. (eg: 'asdf-substitutions' in lisp.scm) This doesn't work for me. I don't know why. Just moved the lambda to a (define* deactivate-sources ...) and then when I try to put the name like (arguments `( #tests? .... ,deactivate-sources ...) Shoots an Unknown object error. I add a diff below to let you see the whole picture of what I did and doesn't work. > 2. Use `(package-arguments libfreenect-examples)` with > `substitute-keyword-arguments` to reuse arguments, but modify > `configure-flags` etc. (eg: qtx11extras) > > The build system can use 'imported-modules' to make a set of guile > modules (which can contains useful procedures, etc.) available to the > builder, but thas's overkill to be used here... I'll check that option too. Thank you for your help! diff --git a/gnu/local.mk b/gnu/local.mk index ab2bac9bc5..b9c09cc5e3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -394,6 +394,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/nvi.scm \ %D%/packages/ocaml.scm \ %D%/packages/ocr.scm \ + %D%/packages/openkinect.scm \ %D%/packages/onc-rpc.scm \ %D%/packages/opencl.scm \ %D%/packages/openbox.scm \ diff --git a/gnu/packages/openkinect.scm b/gnu/packages/openkinect.scm new file mode 100644 index 0000000000..5a17acef0e --- /dev/null +++ b/gnu/packages/openkinect.scm @@ -0,0 +1,127 @@ +(define-module (gnu packages openkinect) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system cmake) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages libusb) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages gl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages image-processing)) + +(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 + #:configure-flags + '("-DBUILD_FAKENECT=ON" + "-DBUILD_CPP=ON" + "-DBUILD_EXAMPLES=OFF" ; Available in libfreenect-examples + "-DBUILD_CV=OFF" ; Available in libfreenect-cv + "-DBUILD_PYTHON=OFF" ; Available in libfreenect-python + "-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 (disable-sources) + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".*libusb.*") "") + (("add_subdirectory \\(src\\)") "") + ((".*libfreenectConfig.cmake.*") "")))) + +(define-public libfreenect-examples + (package + (inherit libfreenect) + (name "libfreenect-examples") + (inputs + `(("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" + "-DBUILD_CV=OFF") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources ,disable-sources)))) ;; UNKNOW OBJECT! + (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) + +(define-public libfreenect-cv + (package + (inherit libfreenect) + (name "libfreenect-cv") + (inputs + `(("libfreenect" ,libfreenect) + ("opencv" ,opencv))) + (arguments + `(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=ON") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources ,disable-sources)))) + (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device +library"))) + +(define-public libfreenect-python + (package + (inherit libfreenect) + (name "libfreenect-python") + (native-inputs + `(("python-cython" ,python-cython))) + (inputs + `(("libfreenect" ,libfreenect))) + (propagated-inputs + `(("python" ,python) + ("python-numpy" ,python-numpy))) + (arguments + `(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=OFF" + "-DBUILD_PYTHON3=ON") + #:phases + (modify-phases %standard-phases + ;; Sources are already compiled in libfreenect input + (add-after 'unpack 'disable-sources ,disable-sources)))) + (synopsis "Python wrapper for libfreenect, the Xbox Kinect device +library"))) ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-19 13:42 ` Ekaitz Zarraga @ 2020-05-19 13:52 ` Ekaitz Zarraga 2020-05-20 13:33 ` 宋文武 0 siblings, 1 reply; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-19 13:52 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, May 19, 2020 3:42 PM, Ekaitz Zarraga <ekaitz@elenq.tech> wrote: > Hi, > > > > There's some kind of weird magic I'm not getting. > > > > Hello, I don't know the whole detail too, but to build a package, guix likely: > > > > - Load and eval the package module, to get the package object. The > > 'arguments' field is a list. > > > > - Convert this package object to a derivation, and write it in store as > > a file (/gnu/store/*.drv). Where 'arguments' being part of the > > builder, serialize as string to the file, it dosen't do complex things > > for procedure bindings, only write their string descriptions... So > > when the builder file is loaded, you get `Unknown object` errors. > > Here, to avoid duplicating the code, you can: > > > > > > 1. Unquote list value into `arguments`. (eg: 'asdf-substitutions' in lisp.scm) > > This doesn't work for me. I don't know why. > > Just moved the lambda to a (define* deactivate-sources ...) and then when I try to put the name like > > (arguments `( #tests? .... ,deactivate-sources ...) > > Shoots an Unknown object error. I add a diff below to let you see the whole picture of what I did and doesn't work. > > > 2. Use `(package-arguments libfreenect-examples)` with > > `substitute-keyword-arguments` to reuse arguments, but modify > > `configure-flags` etc. (eg: qtx11extras) > > The build system can use 'imported-modules' to make a set of guile > > modules (which can contains useful procedures, etc.) available to the > > builder, but thas's overkill to be used here... > > > > I'll check that option too. > > Thank you for your help! > > diff --git a/gnu/local.mk b/gnu/local.mk > index ab2bac9bc5..b9c09cc5e3 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -394,6 +394,7 @@ GNU_SYSTEM_MODULES = \ > %D%/packages/nvi.scm \ > %D%/packages/ocaml.scm \ > %D%/packages/ocr.scm \ > > - %D%/packages/openkinect.scm \ > %D%/packages/onc-rpc.scm \ > %D%/packages/opencl.scm \ > %D%/packages/openbox.scm \ > diff --git a/gnu/packages/openkinect.scm b/gnu/packages/openkinect.scm > new file mode 100644 > index 0000000000..5a17acef0e > --- /dev/null > +++ b/gnu/packages/openkinect.scm > @@ -0,0 +1,127 @@ > +(define-module (gnu packages openkinect) > > - #:use-module (guix packages) > - #:use-module (guix git-download) > - #:use-module (guix build-system cmake) > - #:use-module ((guix licenses) #:prefix license:) > - #:use-module (gnu packages pkg-config) > - #:use-module (gnu packages libusb) > - #:use-module (gnu packages python) > - #:use-module (gnu packages python-xyz) > - #:use-module (gnu packages gl) > - #:use-module (gnu packages pkg-config) > - #:use-module (gnu packages image-processing)) > - > > +(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 > > > - #:configure-flags > > > - '("-DBUILD_FAKENECT=ON" > > > - "-DBUILD_CPP=ON" > > > - "-DBUILD_EXAMPLES=OFF" ; Available in libfreenect-examples > > > - "-DBUILD_CV=OFF" ; Available in libfreenect-cv > > > - "-DBUILD_PYTHON=OFF" ; Available in libfreenect-python > > > - "-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 (disable-sources) > > - (lambda* (#:key outputs #:allow-other-keys) > - (substitute* "CMakeLists.txt" > > > - ((".*libusb.*") "") > > > - (("add_subdirectory \\\\(src\\\\)") "") > > > - ((".*libfreenectConfig.cmake.*") "")))) > > > - > > +(define-public libfreenect-examples > > - (package > - (inherit libfreenect) > - (name "libfreenect-examples") > - (inputs > - `(("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" > > > - "-DBUILD_CV=OFF") > > > - #:phases > > > - (modify-phases %standard-phases > > > - ;; Sources are already compiled in libfreenect input > > > - (add-after 'unpack 'disable-sources ,disable-sources)))) ;; UNKNOW OBJECT! > > > - (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) > - > > +(define-public libfreenect-cv > > - (package > - (inherit libfreenect) > - (name "libfreenect-cv") > - (inputs > - `(("libfreenect" ,libfreenect) > > > - ("opencv" ,opencv))) > > > - (arguments > - `(#:tests? #f ; Project has not tests > > > - #:configure-flags '("-DBUILD_EXAMPLES=OFF" > > > - "-DBUILD_FAKENECT=OFF" > > > - "-DBUILD_CPP=OFF" > > > - "-DBUILD_C_SYNC=OFF" > > > - "-DBUILD_CV=ON") > > > - #:phases > > > - (modify-phases %standard-phases > > > - ;; Sources are already compiled in libfreenect input > > > - (add-after 'unpack 'disable-sources ,disable-sources)))) > > > - (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device > +library"))) > > - > > +(define-public libfreenect-python > > - (package > - (inherit libfreenect) > - (name "libfreenect-python") > - (native-inputs > - `(("python-cython" ,python-cython))) > > > - (inputs > - `(("libfreenect" ,libfreenect))) > > > - (propagated-inputs > - `(("python" ,python) > > > - ("python-numpy" ,python-numpy))) > > > - (arguments > - `(#:tests? #f ; Project has not tests > > > - #:configure-flags '("-DBUILD_EXAMPLES=OFF" > > > - "-DBUILD_FAKENECT=OFF" > > > - "-DBUILD_CPP=OFF" > > > - "-DBUILD_C_SYNC=OFF" > > > - "-DBUILD_CV=OFF" > > > - "-DBUILD_PYTHON3=ON") > > > - #:phases > > > - (modify-phases %standard-phases > > > - ;; Sources are already compiled in libfreenect input > > > - (add-after 'unpack 'disable-sources ,disable-sources)))) > > > - (synopsis "Python wrapper for libfreenect, the Xbox Kinect device > +library"))) > oh, the code is wrong, there parenthesis on the define are making it a function but anyway: - Tested using ,(disable-sources) FAIL - Tested removing the parenthesis and leaving (define disable-sources (lambda*...)) There must be something I'm missing. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-19 13:52 ` Ekaitz Zarraga @ 2020-05-20 13:33 ` 宋文武 2020-05-20 16:37 ` Ekaitz Zarraga 0 siblings, 1 reply; 17+ messages in thread From: 宋文武 @ 2020-05-20 13:33 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294@debbugs.gnu.org Ekaitz Zarraga <ekaitz@elenq.tech> writes: > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On Tuesday, May 19, 2020 3:42 PM, Ekaitz Zarraga <ekaitz@elenq.tech> wrote: > >> Hi, >> >> > > There's some kind of weird magic I'm not getting. >> > >> > Hello, I don't know the whole detail too, but to build a package, guix likely: >> > >> > - Load and eval the package module, to get the package object. The >> > 'arguments' field is a list. >> > >> > - Convert this package object to a derivation, and write it in store as >> > a file (/gnu/store/*.drv). Where 'arguments' being part of the >> > builder, serialize as string to the file, it dosen't do complex things >> > for procedure bindings, only write their string descriptions... So >> > when the builder file is loaded, you get `Unknown object` errors. >> > Here, to avoid duplicating the code, you can: >> > >> > >> > 1. Unquote list value into `arguments`. (eg: 'asdf-substitutions' in lisp.scm) >> >> This doesn't work for me. I don't know why. >> >> Just moved the lambda to a (define* deactivate-sources ...) and then when I try to put the name like >> >> (arguments `( #tests? .... ,deactivate-sources ...) >> >> Shoots an Unknown object error. I add a diff below to let you see the whole picture of what I did and doesn't work. >> >> > 2. Use `(package-arguments libfreenect-examples)` with >> > `substitute-keyword-arguments` to reuse arguments, but modify >> > `configure-flags` etc. (eg: qtx11extras) >> > The build system can use 'imported-modules' to make a set of guile >> > modules (which can contains useful procedures, etc.) available to the >> > builder, but thas's overkill to be used here... >> > >> [...] > > oh, > > the code is wrong, there parenthesis on the define are making it a function but anyway: > - Tested using ,(disable-sources) FAIL > - Tested removing the parenthesis and leaving (define disable-sources (lambda*...)) > > There must be something I'm missing. 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-20 13:33 ` 宋文武 @ 2020-05-20 16:37 ` Ekaitz Zarraga 2020-05-21 11:38 ` bug#41294: " 宋文武 0 siblings, 1 reply; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-20 16:37 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday, May 20, 2020 3:33 PM, <iyzsong@member.fsf.org> 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. Thank you very much for your support. PS: I'm still wondering what kind of weird magic is involved in the example I shown. From efcf2b3fcb4b422939550e614d20abafaaed3d7f Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga <ekaitz@elenq.tech> Date: Wed, 20 May 2020 18:18:23 +0200 Subject: [PATCH] gnu: openkinect: New module * gnu/packages/openkinect.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/local.mk | 1 + gnu/packages/openkinect.scm | 140 ++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 gnu/packages/openkinect.scm diff --git a/gnu/local.mk b/gnu/local.mk index ab2bac9bc5..b9c09cc5e3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -394,6 +394,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/nvi.scm \ %D%/packages/ocaml.scm \ %D%/packages/ocr.scm \ + %D%/packages/openkinect.scm \ %D%/packages/onc-rpc.scm \ %D%/packages/opencl.scm \ %D%/packages/openbox.scm \ diff --git a/gnu/packages/openkinect.scm b/gnu/packages/openkinect.scm new file mode 100644 index 0000000000..96150801e6 --- /dev/null +++ b/gnu/packages/openkinect.scm @@ -0,0 +1,140 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (gnu packages openkinect) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system cmake) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages libusb) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages gl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages image-processing)) + +(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 + #:configure-flags + '("-DBUILD_FAKENECT=ON" + "-DBUILD_CPP=ON" + "-DBUILD_EXAMPLES=OFF" ; Available in libfreenect-examples + "-DBUILD_CV=OFF" ; Available in libfreenect-cv + "-DBUILD_PYTHON=OFF" ; Available in libfreenect-python + "-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+)))) + +;; Sources are already compiled in libfreenect input: remove them from the +;; compilation +(define libfreenect-derived-phases + '(modify-phases %standard-phases + (add-after 'unpack 'disable-sources + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".*libusb.*") "") + (("add_subdirectory \\(src\\)") "") + ((".*libfreenectConfig.cmake.*") "")))))) + +(define-public libfreenect-examples + (package + (inherit libfreenect) + (name "libfreenect-examples") + (inputs + `(("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" + "-DBUILD_CV=OFF") + #:phases ,libfreenect-derived-phases)) + (synopsis "Examples for libfreenect, the Xbox Kinect device library"))) + +(define-public libfreenect-cv + (package + (inherit libfreenect) + (name "libfreenect-cv") + (inputs + `(("libfreenect" ,libfreenect) + ("opencv" ,opencv))) + (arguments + `(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=ON") + #:phases ,libfreenect-derived-phases)) + (synopsis "OpenCV wrapper for libfreenect, the Xbox Kinect device +library"))) + +(define-public libfreenect-python + (package + (inherit libfreenect) + (name "libfreenect-python") + (native-inputs + `(("python-cython" ,python-cython))) + (inputs + `(("libfreenect" ,libfreenect))) + (propagated-inputs + `(("python" ,python) + ("python-numpy" ,python-numpy))) + (arguments + `(#:tests? #f ; Project has not tests + #:configure-flags '("-DBUILD_EXAMPLES=OFF" + "-DBUILD_FAKENECT=OFF" + "-DBUILD_CPP=OFF" + "-DBUILD_C_SYNC=OFF" + "-DBUILD_CV=OFF" + "-DBUILD_PYTHON3=ON") + #:phases ,libfreenect-derived-phases)) + (synopsis "Python wrapper for libfreenect, the Xbox Kinect device +library"))) -- 2.26.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* bug#41294: [PATCH] gnu: Add libfreenect. 2020-05-20 16:37 ` Ekaitz Zarraga @ 2020-05-21 11:38 ` 宋文武 2020-05-21 11:40 ` [bug#41294] " Ekaitz Zarraga 0 siblings, 1 reply; 17+ messages in thread From: 宋文武 @ 2020-05-21 11:38 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294@debbugs.gnu.org Ekaitz Zarraga <ekaitz@elenq.tech> writes: > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On Wednesday, May 20, 2020 3:33 PM, <iyzsong@member.fsf.org> 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-21 11:38 ` bug#41294: " 宋文武 @ 2020-05-21 11:40 ` Ekaitz Zarraga 0 siblings, 0 replies; 17+ messages in thread From: Ekaitz Zarraga @ 2020-05-21 11:40 UTC (permalink / raw) To: iyzsong@member.fsf.org; +Cc: 41294\@debbugs.gnu.org Hi, > > 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. Great. Understood. Thank you very much. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#41294] [PATCH] gnu: Add libfreenect. 2020-05-16 10:18 ` Ekaitz Zarraga 2020-05-16 13:06 ` Ekaitz Zarraga @ 2020-05-17 1:56 ` 宋文武 1 sibling, 0 replies; 17+ messages in thread From: 宋文武 @ 2020-05-17 1:56 UTC (permalink / raw) To: Ekaitz Zarraga; +Cc: 41294@debbugs.gnu.org Ekaitz Zarraga <ekaitz@elenq.tech> writes: > Hi, > > On Saturday, May 16, 2020 5:48 AM, <iyzsong@member.fsf.org> wrote: > >> 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... >> > > I don't really like the first because it forces you to add a python interpreter that is not needed otherwise. > 2 and 3 sound good to me. Sure, to me both are acceptable. > It can handle both python2 and 3. What would you do with that? > Maybe make option 3 and add two outputs to that with python2 and python3? Or two different packages? > (or just forget the python2?) Unless there is a need for the python2 bindings, we should forget it, as Python 2 is end-of-life. > >> >> > - 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. > > Great! Thank you. That's more or less what I understood from some code > examples I checked but they were complex and I tried to make the same > thing and didn't work for me. I'll give it a new try with this > example. > > 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? Inputs are used (not defined) here, the code you wrote: - Need a freeglut package, which should contain a "examples" output. - In the build environment of this package, a "freeglut" input is available, and its path is store path of the "examples" output of that freeglut package. freeglut's "out" output is not available here. > 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. Yes, the dependencies of outputs are scanned after the build results, not before. This works by searching '/gnu/store' paths in all files from the output's store path. > 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. If in the same package (multiple outputs), all inputs are needed when build a package, but not all dependencies are needed when install a output by binary substitutes. > I made this with the examples (see below), how does it look? > [...] Will reply to in that email... ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2020-05-21 11:42 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [bug#41294] [PATCH] gnu: Add libfreenect 宋文武 2020-05-16 10:18 ` 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 ` 宋文武
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.