[PATCH] gnu: Add xpadneo.

  • Done
  • quality assurance status badge
Details
3 participants
  • Efraim Flashner
  • Leo Prikler
  • Maxime Devos
Owner
unassigned
Submitted by
Leo Prikler
Severity
normal

Debbugs page

Leo Prikler wrote 4 years ago
(address . guix-patches@gnu.org)
20210821220053.31441-1-leo.prikler@student.tugraz.at
* gnu/packages/linux.scm (xpadneo): New variable.
---
gnu/packages/linux.scm | 52 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

Toggle diff (65 lines)
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+)))
+
;;;
;;; Pluggable authentication modules (PAM).
--
2.33.0
Maxime Devos wrote 4 years ago
38410a183350db8ffcf597b9fd1866a269333a05.camel@telenet.be
Leo Prikler schreef op zo 22-08-2021 om 00:00 [+0200]:
Toggle quote (50 lines)
> * 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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYSIfzRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uuPAP0Y80JTYryJ285S0+QzqeT62okX
luM8pHlBd9IAPcodYAEA5KsiWt0dx5p4jLLcjq1xFn362svr5NCLGQYtxey3sww=
=0i6E
-----END PGP SIGNATURE-----


Leo Prikler wrote 4 years ago
5a98ec927846aeebf5c567e94154003fca07b78f.camel@student.tugraz.at
Am Sonntag, den 22.08.2021, 11:58 +0200 schrieb Maxime Devos:
Toggle quote (63 lines)
> 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?
Efraim Flashner wrote 4 years ago
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)
YSI1wbaunREc3av6@3900XT
On Sun, Aug 22, 2021 at 12:08:57PM +0200, Leo Prikler wrote:
Toggle quote (70 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmEiNb8ACgkQQarn3Mo9
g1EsSRAAwLqPQDjJ1mB968h80/QoMa69M/6Uh1AoI12o5GMmsMzK67yWqdEnL+IU
qLFf7fU4Oc6yGuGf8txFMBLiPcLryr4zXiYGVAqKwadknbYI/AhqhXUuxcwBqmWB
SgmqDONinRhsbQEmDXPf7f5LTHBB7BI76pe1HaDEbisAS3cJ8vSnYKPG/TdTDdhX
rTwpS3dK0cthyrmeYSV71uCC2rIr0qOa+aN9XP5VMnK9O1n8SXV+o08zRyZTpphZ
DgKGGR5+ezogKfEpUNeOB50OUcn8yUJBqLj3jAsmlLBbX+GtGlNII23hQ6jip4Xq
+zyFAUqWoCGiZY9HTQ+CbI/rYyCaewhxCA5ZJmlFM8GV395dhum1QQJCKQzJTu6m
wbYVjpiemC/Ghebx8Az+6kl27fEUJNePXd74wfPdZ8C6hXPFl77KBAelPaePR6Km
GPD8cGQBxHV5ZwN7gm9fF6QVJUwydEG6uKFX90PsGpK0RydNtaxzNWPuaHP/Ghkd
ImTFisepOmXHFtlI27uGsPJZC572REibFYHr4g6kotUqqwLThIkp8GRwv6jhF8u4
NHCHC6iEE/Mo0G/qg3LPe0jakygfnS+a8UakNOEtds0iSyDUdey+Wb9tSopl9zX2
vttr2tPtkPTbIUvLTECKaTb5WJBAeinOsGgsv2VMFqK4oTCBp5k=
=yQ0x
-----END PGP SIGNATURE-----


Leo Prikler wrote 4 years ago
(name . Efraim Flashner)(address . efraim@flashner.co.il)
f3fb623900c615d89f2e0caa952b8a79d442cbe5.camel@student.tugraz.at
Am Sonntag, den 22.08.2021, 14:32 +0300 schrieb Efraim Flashner:
Toggle quote (82 lines)
> 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

Leo Prikler wrote 4 years ago
[PATCH v2 1/2] build-system: linux-module: Support source-directory.
(address . 50157@debbugs.gnu.org)
20210826111035.20464-1-leo.prikler@student.tugraz.at
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(-)

Toggle diff (58 lines)
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
Leo Prikler wrote 4 years ago
[PATCH v2 2/2] gnu: Add xpadneo.
(address . 50157@debbugs.gnu.org)
20210826111035.20464-2-leo.prikler@student.tugraz.at
* gnu/packages/linux.scm (xpadneo): New variable.
---
gnu/packages/linux.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Toggle diff (48 lines)
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+)))
+
;;;
;;; Pluggable authentication modules (PAM).
--
2.33.0
Liliana Marie Prikler wrote 3 years ago
(address . 50157-done@debbugs.gnu.org)
9659c8cdb87da22a26d552753133c5952a36bb7b.camel@student.tugraz.at
Going by the lack of replies, I'll assume that v2 addressed all
concerns of v1 and therefore pushed this.

Regards
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 50157@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 50157
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help