[PATCH] gnu: Add acpilight.

OpenSubmitted by Brice Waegeneire.
Details
4 participants
  • Antero Mejr
  • Brice Waegeneire
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Severity
normal
B
B
Brice Waegeneire wrote on 12 Feb 11:44 +0100
(address . guix-patches@gnu.org)
20220212104432.22611-1-brice@waegenei.re
* gnu/packages/linux.scm (acpilight): New variable.
---
gnu/packages/linux.scm | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)

Toggle diff (61 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bcbaa2166d..2d6c024906 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -35,7 +35,7 @@
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
 ;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
-;;; Copyright © 2019, 2020, 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2019-2022 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2020, 2021 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
@@ -8806,3 +8806,43 @@ (define-public libgpiod
     (license (list license:lgpl2.1+   ;; libgpiod
                    license:gpl2+      ;; gpio-tools
                    license:lgpl3+)))) ;; C++ bindings
+
+(define-public acpilight
+  (package
+    (name "acpilight")
+    (version "1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.com/wavexx/acpilight.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f  ;no tests
+       #:make-flags (list "prefix="
+                          (string-append "DESTDIR="
+                                         (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'patch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "Makefile"
+               (("udevadm") "true"))
+             (substitute* "90-backlight.rules"
+               (("/bin")
+                (string-append (assoc-ref inputs "coreutils") "/bin")))
+             #t)))))
+    (inputs
+     (list python))
+    (home-page "https://gitlab.com/wavexx/acpilight")
+    (synopsis "Backward-compatibile xbacklight replacement")
+    (description "acpilight is a backward-compatibile replacement for
+xbacklight that uses the ACPI interface to set the display
+brightness.  On modern laptops acpilight can control both display and
+keyboard backlight uniformly on either X11, the console or Wayland.")
+    (license license:gpl3+)))

base-commit: 068d99978a0c9c6fb66f95455060c8d08ba55ac5
-- 
2.34.0
M
M
Maxime Devos wrote on 12 Feb 14:34 +0100
08cb022c244b31849d6802097533790d9b41b294.camel@telenet.be
Brice Waegeneire schreef op za 12-02-2022 om 11:44 [+0100]:
Toggle quote (7 lines)
> +             (substitute* "90-backlight.rules"
> +               (("/bin")
> +                (string-append (assoc-ref inputs "coreutils") "/bin")))
> +             #t)))))
> +    (inputs
> +     (list python))

coreutils-minimal needs to be added to inputs, otherwise the
substitute* above won't work when cross-compiling. Also, phases do not
have to return #t anymore.

Greetings,
Maxime
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYge3ShccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gzKAP9Z2vImF3N5q23DVq6fxv3Bxgt2
jgSDyL8wmgQMyG+3NgD+Oj9CrBwn2qUV/JpXX5MhABXE9Z6UfgrcjVZhREYRugg=
=xdKk
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 12 Feb 14:38 +0100
df07d4e4b97b3d76a38a639634c794ba89f2d3c4.camel@telenet.be
Brice Waegeneire schreef op za 12-02-2022 om 11:44 [+0100]:
Toggle quote (4 lines)
> +       #:make-flags (list "prefix="
> +                          (string-append "DESTDIR="
> +                                         (assoc-ref %outputs "out")))

%outputs, %build-inputs and friends are being deprecated (not 100%
sure, you might want to confirm with ludo) in favour of G-exps. More
concretely: (list #:make-flags #~(list "prefix=" (string-append
"DESTDIR=" #$output))).

Also, about prefix= and DESTDIR=, it's normally the other way around.

#~(list ; (probably) no need to set DESTDIR=, it's normally "" by default:
(string-append "prefix=" #$output)).

(Search for "Staged installation" for details)

Also, are you sure about the case of 'prefix'? Usually, Makefiles use
uppercase 'PREFIX' and not 'prefix' (for ./configure, it's other way
around).

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYge4XxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jkuAP9/yZkZ96dc0nxDRvutFkcgzePC
x6TdfnvGoBtvAUaT4QD8C3O8dHAWi2Zbbgi5BxrZD+MNpA84cmivbhfwLDgpWwg=
=KOzY
-----END PGP SIGNATURE-----


B
B
Brice Waegeneire wrote on 12 Feb 18:21 +0100
[PATCH v2] gnu: Add acpilight.
(address . maximedevos@telenet.be)(address . 53953@debbugs.gnu.org)
20220212172125.3648-1-brice@waegenei.re
* gnu/packages/linux.scm (acpilight): New variable.
---
Maxime,

Thanks for the review. I should have re-read this old package more throughly,
I have fixed what you pointed out:
- using gexp in arguments field
- don't returning #t in phases
- adding coreutils-minimal to inputs

As for the odd make-flags, this is because of the uncanonical Makefile¹ of
acpilight, It don't build with an empty DESTDIR.


Cheers,
- Brice

gnu/packages/linux.scm | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)

Toggle diff (59 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bcbaa2166d..fe88d9ad26 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -35,7 +35,7 @@
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
 ;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
-;;; Copyright © 2019, 2020, 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2019-2022 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2020, 2021 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
@@ -8806,3 +8806,41 @@ (define-public libgpiod
     (license (list license:lgpl2.1+   ;; libgpiod
                    license:gpl2+      ;; gpio-tools
                    license:lgpl3+)))) ;; C++ bindings
+
+(define-public acpilight
+  (package
+    (name "acpilight")
+    (version "1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.com/wavexx/acpilight.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f  ;no tests
+           #:make-flags #~(list "prefix="
+                                (string-append "DESTDIR=" #$output))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (add-after 'unpack 'patch
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "Makefile"
+                     (("udevadm") "true"))
+                   (substitute* "90-backlight.rules"
+                     (("/bin")
+                      (string-append (assoc-ref inputs "coreutils-minimal") "/bin"))))))))
+    (inputs
+     (list python coreutils-minimal))
+    (home-page "https://gitlab.com/wavexx/acpilight")
+    (synopsis "Backward-compatibile xbacklight replacement")
+    (description "acpilight is a backward-compatibile replacement for
+xbacklight that uses the ACPI interface to set the display
+brightness.  On modern laptops acpilight can control both display and
+keyboard backlight uniformly on either X11, the console or Wayland.")
+    (license license:gpl3+)))

base-commit: e641d707e1ec8de2bfc658dcd1757360300aa509
-- 
2.34.0
M
M
Maxime Devos wrote on 12 Feb 19:05 +0100
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 53953@debbugs.gnu.org)
75d1cbd06f8a3a555090de6f698a138631cc04e0.camel@telenet.be
Brice Waegeneire schreef op za 12-02-2022 om 18:21 [+0100]:
Toggle quote (5 lines)
> As for the odd make-flags, this is because of the uncanonical Makefile¹ of
> acpilight, It don't build with an empty DESTDIR.
>
> ¹ https://gitlab.com/wavexx/acpilight/-/blob/master/Makefile

Looks like the problem is caused by 'sysconfdir' not being based
on 'prefix', but that can be resolved by

#~(list (string-append "prefix=" #$output)
(string-append "sysconfdir=" (string-append #$output "/etc")))

which is not 100% canonical, but it does seems closer to me?

Also, apparently there's a 'python-minimal' package, so you could use
that instead of 'python' to reduce the closure? Might be counter-
productive though, since most packages seem to use plain 'python'
instead ...

whose closure
would be smaller than
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgf25BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7g3XAQDburGZKiGIqfcmxCQ4WMlm5R8c
TnTcBPqE1+BlFHClnAD/fuLdtlIGd9dsy1OjzhdjH/P9K1Gc6bu9l4eOvXBD5gU=
=tbCv
-----END PGP SIGNATURE-----


B
B
Brice Waegeneire wrote on 16 Feb 08:22 +0100
[PATCH v3] gnu: Add acpilight.
(address . maximedevos@telenet.be)(address . 53953@debbugs.gnu.org)
20220216072232.23819-1-brice@waegenei.re
* gnu/packages/linux.scm (acpilight): New variable.
---
Hello Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (14 lines)
> Brice Waegeneire schreef op za 12-02-2022 om 18:21 [+0100]:
>> As for the odd make-flags, this is because of the uncanonical Makefile¹ of
>> acpilight, It don't build with an empty DESTDIR.
>>
>> ¹ https://gitlab.com/wavexx/acpilight/-/blob/master/Makefile
>
> Looks like the problem is caused by 'sysconfdir' not being based
> on 'prefix', but that can be resolved by
>
> #~(list (string-append "prefix=" #$output)
> (string-append "sysconfdir=" (string-append #$output "/etc")))
>
> which is not 100% canonical, but it does seems closer to me?

I remember trying someting like that unsuccesfully before sending the previous
patch version but I probablly missend something because it actually work!

Toggle quote (5 lines)
> Also, apparently there's a 'python-minimal' package, so you could use
> that instead of 'python' to reduce the closure? Might be counter-
> productive though, since most packages seem to use plain 'python'
> instead ...

Done.

Cheers,
- Brice

gnu/packages/linux.scm | 44 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)

Toggle diff (63 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 4edb5bf858..fd68901391 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -35,7 +35,7 @@
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
 ;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
-;;; Copyright © 2019, 2020, 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2019-2022 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2020, 2021 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
@@ -8806,3 +8806,45 @@ (define-public libgpiod
     (license (list license:lgpl2.1+   ;; libgpiod
                    license:gpl2+      ;; gpio-tools
                    license:lgpl3+)))) ;; C++ bindings
+
+(define-public acpilight
+  (package
+    (name "acpilight")
+    (version "1.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.com/wavexx/acpilight.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f                  ; no tests
+           #:make-flags
+           #~(list (string-append "prefix=" #$output)
+                   (string-append "sysconfdir=" #$output "/etc"))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (add-after 'unpack 'patch
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Prevent reloading udev at build time
+                   (substitute* "Makefile"
+                     (("udevadm") "true"))
+                   (substitute* "90-backlight.rules"
+                     (("/bin")
+                      (string-append (assoc-ref inputs "coreutils-minimal")
+                                     "/bin"))))))))
+    (inputs
+     (list coreutils-minimal
+           python-minimal))
+    (home-page "https://gitlab.com/wavexx/acpilight")
+    (synopsis "Backward-compatibile xbacklight replacement")
+    (description "acpilight is a backward-compatibile replacement for
+xbacklight that uses the ACPI interface to set the display
+brightness.  On modern laptops acpilight can control both display and
+keyboard backlight uniformly on either X11, the console or Wayland.")
+    (license license:gpl3+)))

base-commit: 52269e27c628d34af896e95347870b1755cb3e5f
-- 
2.34.0
L
L
Ludovic Courtès wrote on 6 Mar 22:17 +0100
Re: bug#53953: [PATCH] gnu: Add acpilight.
(name . Brice Waegeneire)(address . brice@waegenei.re)
87mti2kcfu.fsf_-_@gnu.org
Hi Brice,

Brice Waegeneire <brice@waegenei.re> skribis:

Toggle quote (2 lines)
> * gnu/packages/linux.scm (acpilight): New variable.

LGTM, please push!

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 5 Apr 18:06 +0200
(name . Brice Waegeneire)(address . brice@waegenei.re)
87bkxfms4k.fsf_-_@gnu.org
Ping! :-)

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (10 lines)
> Hi Brice,
>
> Brice Waegeneire <brice@waegenei.re> skribis:
>
>> * gnu/packages/linux.scm (acpilight): New variable.
>
> LGTM, please push!
>
> Thanks,
> Ludo’.
A
A
Antero Mejr wrote on 1 Jun 16:14 +0200
(name . 53953@debbugs.gnu.org)(address . 53953@debbugs.gnu.org)
849166083.790675.1654092851433@office.mailbox.org
Any update on this merge? I was hoping to install acpilight but it doesn't appear to be in the latest master (commit 16a0aea02d). Thanks.
?