* gnu/packages/linux.scm (xpadneo): New variable. --- gnu/packages/linux.scm | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7b92be4b9c..385cdd558b 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1505,6 +1505,58 @@ allows some more serious things like adding streaming capabilities to an application by hooking GStreamer into the loopback device.") (license license:gpl2+))) +(define-public xpadneo + (package + (name "xpadneo") + (version "0.9.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/atar-axis/xpadneo") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14ism")))) + (build-system linux-module-build-system) + (arguments + `(#:tests? #f ; no `check' target + #:modules (((guix build copy-build-system) #:prefix copy:) + (guix build linux-module-build-system) + (guix build utils)) + #:imported-modules + ((guix build copy-build-system) + ,@%linux-module-build-system-modules) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda args + (with-directory-excursion "hid-xpadneo/src" + (apply (assoc-ref %standard-phases 'configure) args)))) + (replace 'build + (lambda args + (with-directory-excursion "hid-xpadneo/src" + (apply (assoc-ref %standard-phases 'build) args)))) + (replace 'install + (lambda args + (with-directory-excursion "hid-xpadneo/src" + (apply (assoc-ref %standard-phases 'install) args)))) + (add-after 'install 'post-install + (lambda* (#:key outputs #:allow-other-keys #:rest args) + (apply (assoc-ref copy:%standard-phases 'install) + #:install-plan + '(("hid-xpadneo/etc-modprobe.d" "etc/modprobe.d") + ("hid-xpadneo/etc-udev-rules.d" "etc/udev/rules.d")) + args)))))) + (home-page "https://atar-axis.github.io/xpadneo/") + (synopsis "Xbox One Wireless Controller driver") + (description + "This package provides a driver for the XBox One S Wireless controller +and some newer models when connected via bluetooth. In addition to the kernel +module provided itself, it also contains a modprobe configuration and udev +rules, which need to be installed separately.") + (license license:gpl3+))) + \f ;;; ;;; Pluggable authentication modules (PAM). -- 2.33.0
[-- Attachment #1: Type: text/plain, Size: 2377 bytes --] Leo Prikler schreef op zo 22-08-2021 om 00:00 [+0200]: > * gnu/packages/linux.scm (xpadneo): New variable. > --- > gnu/packages/linux.scm | 52 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) > > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm > index 7b92be4b9c..385cdd558b 100644 > --- a/gnu/packages/linux.scm > +++ b/gnu/packages/linux.scm > @@ -1505,6 +1505,58 @@ allows some more serious things like adding streaming capabilities to an > application by hooking GStreamer into the loopback device.") > (license license:gpl2+))) > > +(define-public xpadneo > + (package > + (name "xpadneo") > + (version "0.9.1") > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/atar-axis/xpadneo") > + (commit (string-append "v" version)))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14ism")))) > + (build-system linux-module-build-system) > + (arguments > + `(#:tests? #f ; no `check' target > + #:modules (((guix build copy-build-system) #:prefix copy:) > + (guix build linux-module-build-system) > + (guix build utils)) > + #:imported-modules > + ((guix build copy-build-system) > + ,@%linux-module-build-system-modules) > + #:phases > + (modify-phases %standard-phases > + (replace 'configure > + (lambda args > + (with-directory-excursion "hid-xpadneo/src" > + (apply (assoc-ref %standard-phases 'configure) args)))) > + (replace 'build > + (lambda args > + (with-directory-excursion "hid-xpadneo/src" > + (apply (assoc-ref %standard-phases 'build) args)))) > + (replace 'install > + (lambda args > + (with-directory-excursion "hid-xpadneo/src" > + (apply (assoc-ref %standard-phases 'install) args)))) It might be a bit simpler to add a 'chdir' phase: (add-after 'unpack 'chdir (lambda _ (chdir "hid-xpadneo/src"))) instead of these 'with-directory-excursion'. Greetings, Maxime. [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 260 bytes --]
Am Sonntag, den 22.08.2021, 11:58 +0200 schrieb Maxime Devos:
> Leo Prikler schreef op zo 22-08-2021 om 00:00 [+0200]:
> > * gnu/packages/linux.scm (xpadneo): New variable.
> > ---
> > gnu/packages/linux.scm | 52
> > ++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 52 insertions(+)
> >
> > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
> > index 7b92be4b9c..385cdd558b 100644
> > --- a/gnu/packages/linux.scm
> > +++ b/gnu/packages/linux.scm
> > @@ -1505,6 +1505,58 @@ allows some more serious things like adding
> > streaming capabilities to an
> > application by hooking GStreamer into the loopback device.")
> > (license license:gpl2+)))
> >
> > +(define-public xpadneo
> > + (package
> > + (name "xpadneo")
> > + (version "0.9.1")
> > + (source (origin
> > + (method git-fetch)
> > + (uri (git-reference
> > + (url "https://github.com/atar-axis/xpadneo")
> > + (commit (string-append "v" version))))
> > + (file-name (git-file-name name version))
> > + (sha256
> > + (base32
> > + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14
> > ism"))))
> > + (build-system linux-module-build-system)
> > + (arguments
> > + `(#:tests? #f ; no `check' target
> > + #:modules (((guix build copy-build-system) #:prefix copy:)
> > + (guix build linux-module-build-system)
> > + (guix build utils))
> > + #:imported-modules
> > + ((guix build copy-build-system)
> > + ,@%linux-module-build-system-modules)
> > + #:phases
> > + (modify-phases %standard-phases
> > + (replace 'configure
> > + (lambda args
> > + (with-directory-excursion "hid-xpadneo/src"
> > + (apply (assoc-ref %standard-phases 'configure)
> > args))))
> > + (replace 'build
> > + (lambda args
> > + (with-directory-excursion "hid-xpadneo/src"
> > + (apply (assoc-ref %standard-phases 'build) args))))
> > + (replace 'install
> > + (lambda args
> > + (with-directory-excursion "hid-xpadneo/src"
> > + (apply (assoc-ref %standard-phases 'install)
> > args))))
>
> It might be a bit simpler to add a 'chdir' phase:
>
> (add-after 'unpack 'chdir
> (lambda _
> (chdir "hid-xpadneo/src")))
>
> instead of these 'with-directory-excursion'.
That may be true, but in that case there's no "clean" way of exiting.
I could do (chdir "..") in post-install, but that feels weird.
WDYT?
[-- Attachment #1: Type: text/plain, Size: 3328 bytes --] On Sun, Aug 22, 2021 at 12:08:57PM +0200, Leo Prikler wrote: > Am Sonntag, den 22.08.2021, 11:58 +0200 schrieb Maxime Devos: > > Leo Prikler schreef op zo 22-08-2021 om 00:00 [+0200]: > > > * gnu/packages/linux.scm (xpadneo): New variable. > > > --- > > > gnu/packages/linux.scm | 52 > > > ++++++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 52 insertions(+) > > > > > > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm > > > index 7b92be4b9c..385cdd558b 100644 > > > --- a/gnu/packages/linux.scm > > > +++ b/gnu/packages/linux.scm > > > @@ -1505,6 +1505,58 @@ allows some more serious things like adding > > > streaming capabilities to an > > > application by hooking GStreamer into the loopback device.") > > > (license license:gpl2+))) > > > > > > +(define-public xpadneo > > > + (package > > > + (name "xpadneo") > > > + (version "0.9.1") > > > + (source (origin > > > + (method git-fetch) > > > + (uri (git-reference > > > + (url "https://github.com/atar-axis/xpadneo") > > > + (commit (string-append "v" version)))) > > > + (file-name (git-file-name name version)) > > > + (sha256 > > > + (base32 > > > + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14 > > > ism")))) > > > + (build-system linux-module-build-system) > > > + (arguments > > > + `(#:tests? #f ; no `check' target > > > + #:modules (((guix build copy-build-system) #:prefix copy:) > > > + (guix build linux-module-build-system) > > > + (guix build utils)) > > > + #:imported-modules > > > + ((guix build copy-build-system) > > > + ,@%linux-module-build-system-modules) > > > + #:phases > > > + (modify-phases %standard-phases > > > + (replace 'configure > > > + (lambda args > > > + (with-directory-excursion "hid-xpadneo/src" > > > + (apply (assoc-ref %standard-phases 'configure) > > > args)))) > > > + (replace 'build > > > + (lambda args > > > + (with-directory-excursion "hid-xpadneo/src" > > > + (apply (assoc-ref %standard-phases 'build) args)))) > > > + (replace 'install > > > + (lambda args > > > + (with-directory-excursion "hid-xpadneo/src" > > > + (apply (assoc-ref %standard-phases 'install) > > > args)))) > > > > It might be a bit simpler to add a 'chdir' phase: > > > > (add-after 'unpack 'chdir > > (lambda _ > > (chdir "hid-xpadneo/src"))) > > > > instead of these 'with-directory-excursion'. > That may be true, but in that case there's no "clean" way of exiting. > I could do (chdir "..") in post-install, but that feels weird. > > WDYT? > Where is the license file located? You could add a phaes after 'install to chdir back ".." and then just use install-file for the files for etc. Then the 'install-license phase would also work correctly. -- Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
Am Sonntag, den 22.08.2021, 14:32 +0300 schrieb Efraim Flashner: > On Sun, Aug 22, 2021 at 12:08:57PM +0200, Leo Prikler wrote: > > Am Sonntag, den 22.08.2021, 11:58 +0200 schrieb Maxime Devos: > > > Leo Prikler schreef op zo 22-08-2021 om 00:00 [+0200]: > > > > * gnu/packages/linux.scm (xpadneo): New variable. > > > > --- > > > > gnu/packages/linux.scm | 52 > > > > ++++++++++++++++++++++++++++++++++++++++++ > > > > 1 file changed, 52 insertions(+) > > > > > > > > diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm > > > > index 7b92be4b9c..385cdd558b 100644 > > > > --- a/gnu/packages/linux.scm > > > > +++ b/gnu/packages/linux.scm > > > > @@ -1505,6 +1505,58 @@ allows some more serious things like > > > > adding > > > > streaming capabilities to an > > > > application by hooking GStreamer into the loopback device.") > > > > (license license:gpl2+))) > > > > > > > > +(define-public xpadneo > > > > + (package > > > > + (name "xpadneo") > > > > + (version "0.9.1") > > > > + (source (origin > > > > + (method git-fetch) > > > > + (uri (git-reference > > > > + (url "https://github.com/atar-axis/xpadneo > > > > ") > > > > + (commit (string-append "v" version)))) > > > > + (file-name (git-file-name name version)) > > > > + (sha256 > > > > + (base32 > > > > + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgx > > > > kh14 > > > > ism")))) > > > > + (build-system linux-module-build-system) > > > > + (arguments > > > > + `(#:tests? #f ; no `check' target > > > > + #:modules (((guix build copy-build-system) #:prefix > > > > copy:) > > > > + (guix build linux-module-build-system) > > > > + (guix build utils)) > > > > + #:imported-modules > > > > + ((guix build copy-build-system) > > > > + ,@%linux-module-build-system-modules) > > > > + #:phases > > > > + (modify-phases %standard-phases > > > > + (replace 'configure > > > > + (lambda args > > > > + (with-directory-excursion "hid-xpadneo/src" > > > > + (apply (assoc-ref %standard-phases 'configure) > > > > args)))) > > > > + (replace 'build > > > > + (lambda args > > > > + (with-directory-excursion "hid-xpadneo/src" > > > > + (apply (assoc-ref %standard-phases 'build) > > > > args)))) > > > > + (replace 'install > > > > + (lambda args > > > > + (with-directory-excursion "hid-xpadneo/src" > > > > + (apply (assoc-ref %standard-phases 'install) > > > > args)))) > > > > > > It might be a bit simpler to add a 'chdir' phase: > > > > > > (add-after 'unpack 'chdir > > > (lambda _ > > > (chdir "hid-xpadneo/src"))) > > > > > > instead of these 'with-directory-excursion'. > > That may be true, but in that case there's no "clean" way of > > exiting. > > I could do (chdir "..") in post-install, but that feels weird. > > > > WDYT? > > > > Where is the license file located? You could add a phaes after > 'install > to chdir back ".." and then just use install-file for the files for > etc. > Then the 'install-license phase would also work correctly. The license file is at the root of the tree. FWIW, there is an ongoing issue on whether to interpret the license as GPL3 or GPL3+ [1], which I interpreted as the latter for a lack of file headers. So in the chdir case, I would have to chdir two to three times, depending on how much I want to type, leaving the CWD dirty between phase changes. The directory-excursion hack is a little more verbose, but mostly captures my intent and needs to be applied exactly thrice. One could probably make it even smarter by writing a lambda for the phase rewriting or instead provide build-system support for linux modules in subdirectories. (Perhaps we could even add modify-phases support to add "advice" to phases Emacs-style.) Regards, Leo [1] https://github.com/atar-axis/xpadneo/issues/289
As with guile-build-system, the module to be build need not necessarily live at the root of the build tree. * guix/build/linux-module-build-system.scm (build, install): Add source-directory argument and append it to "M" variable when invoking make. * guix/build-system/linux-module.scm (linux-module-build): Add source-directory argument. --- guix/build-system/linux-module.scm | 4 +++- guix/build/linux-module-build-system.scm | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index fc3d959ce7..33bc8c95df 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -158,6 +158,7 @@ (outputs '("out")) (make-flags ''()) (system (%current-system)) + (source-directory ".") (guile #f) (substitutable? #t) (imported-modules @@ -175,7 +176,8 @@ ((source) source) (source - source)) + source)) + #:source-directory ,source-directory #:search-paths ',(map search-path-specification->sexp search-paths) #:phases ,phases diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm index d51d76f94b..729ab6154f 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -49,16 +49,17 @@ ; TODO: kernel ".config". #t) -(define* (build #:key inputs make-flags #:allow-other-keys) +(define* (build #:key inputs make-flags (source-directory ".") #:allow-other-keys) (apply invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") - (string-append "M=" (getcwd)) + (string-append "M=" (getcwd) "/" source-directory) (or make-flags '()))) ;; This block was copied from make-linux-libre--only took the "modules_install" ;; part. -(define* (install #:key make-flags inputs native-inputs outputs +(define* (install #:key make-flags (source-directory ".") + inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (moddir (string-append out "/lib/modules"))) @@ -67,7 +68,7 @@ (apply invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") - (string-append "M=" (getcwd)) + (string-append "M=" (getcwd) "/" source-directory) ;; Disable depmod because the Guix system's module directory ;; is an union of potentially multiple packages. It is not ;; possible to use depmod to usefully calculate a dependency -- 2.33.0
* gnu/packages/linux.scm (xpadneo): New variable. --- gnu/packages/linux.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7b92be4b9c..4383048403 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1505,6 +1505,41 @@ allows some more serious things like adding streaming capabilities to an application by hooking GStreamer into the loopback device.") (license license:gpl2+))) +(define-public xpadneo + (package + (name "xpadneo") + (version "0.9.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/atar-axis/xpadneo") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14ism")))) + (build-system linux-module-build-system) + (arguments + `(#:tests? #f ; no `check' target + #:source-directory "hid-xpadneo/src" + #:phases + (modify-phases %standard-phases + (add-after 'install 'post-install + (lambda* (#:key outputs #:allow-other-keys #:rest args) + (let ((out (assoc-ref outputs "out"))) + (copy-recursively "hid-xpadneo/etc-modprobe.d" + (string-append out "/etc/modprobe.d")) + (copy-recursively "hid-xpadneo/etc-udev-rules.d" + (string-append out "/etc/udev/rules.d")))))))) + (home-page "https://atar-axis.github.io/xpadneo/") + (synopsis "Xbox One Wireless Controller driver") + (description + "This package provides a driver for the XBox One S Wireless controller +and some newer models when connected via bluetooth. In addition to the kernel +module provided itself, it also contains a modprobe configuration and udev +rules, which need to be installed separately.") + (license license:gpl3+))) + \f ;;; ;;; Pluggable authentication modules (PAM). -- 2.33.0
Going by the lack of replies, I'll assume that v2 addressed all concerns of v1 and therefore pushed this. Regards