all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Replacing polkit by polkit-duktape on core-updates-frozen ?
Date: Sun, 21 Nov 2021 22:35:10 -0500	[thread overview]
Message-ID: <87mtlwc175.fsf@gmail.com> (raw)
In-Reply-To: <87v90rxcnr.fsf@gnu.org> ("Ludovic Courtès"'s message of "Wed, 17 Nov 2021 12:08:24 +0100")

Hello,

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

> Hi,
>
> Thiago Jung Bauermann <bauermann@kolabnow.com> skribis:
>
>> Em quinta-feira, 11 de novembro de 2021, às 15:23:37 -03, Maxim Cournoyer 
>> escreveu:
>>> Hello Guix!
>>> 
>>> I've finally merged the core-updates-frozen-batched-changes to
>>> core-updates-frozen. 
>>
>> Hooray!
>>
>>> One thing we could do in the meantime is to replace our polkit package
>>> with polkit-duktape, which uses an (unmerged) patch to build polkit
>>> against duktape rather than mozjs [1].  The patch seems to have garnered
>>> some attention recently.  This would enable to build GTK and parts of
>>> GNOME without rust, I believe.
>>
>> I’d suggest replacing polkit with polkit-duktape only for non-x86_64 
>> architectures. What do you think?¨
>
> Yes, that seems like the most reasonable option.

How do we do this, though?

I tried to make it so that referring to the 'polkit' *variable* would
always expand to something supported (switching between vanilla polkit
and polkit-duktape variant based on the system):

--8<---------------cut here---------------start------------->8---
1 file changed, 38 insertions(+), 27 deletions(-)
gnu/packages/polkit.scm | 65 ++++++++++++++++++++++++++++++++++++++---------------------------

modified   gnu/packages/polkit.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages polkit)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages xml))
 
-(define-public polkit
+(define-public polkit*
   (package
     (name "polkit")
     (version "0.120")
@@ -151,32 +151,43 @@ (define-public polkit
 ;;; Variant of polkit built with Duktape, a lighter JavaScript engine compared
 ;;; to mozjs.
 (define-public polkit-duktape
-  (package/inherit polkit
-    (name "polkit-duktape")
-    (source
-     (origin
-       (inherit (package-source polkit))
-       (patches
-        (append
-            (search-patches "polkit-use-duktape.patch")
-            (origin-patches (package-source polkit))))))
-    (arguments
-     (substitute-keyword-arguments (package-arguments polkit)
-       ((#:configure-flags flags)
-        `(cons "--with-duktape" ,flags))
-       ((#:phases phases)
-        `(modify-phases ,phases
-           (add-after 'unpack 'force-gnu-build-system-bootstrap
-             (lambda _
-               (delete-file "configure")))))))
-    (native-inputs
-     (append `(("autoconf" ,autoconf)
-               ("automake" ,automake)
-               ("libtool" ,libtool)
-               ("pkg-config" ,pkg-config))
-         (package-native-inputs polkit)))
-    (inputs (alist-replace "mozjs" `(,duktape)
-                           (package-inputs polkit)))))
+  (let ((base polkit*))
+    (package/inherit base
+      (name "polkit-duktape")
+      (source
+       (origin
+         (inherit (package-source base))
+         (patches
+          (append
+              (search-patches "polkit-use-duktape.patch")
+              (origin-patches (package-source base))))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:configure-flags flags)
+          `(cons "--with-duktape" ,flags))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'force-gnu-build-system-bootstrap
+               (lambda _
+                 (delete-file "configure")))))))
+      (native-inputs
+       (append `(("autoconf" ,autoconf)
+                 ("automake" ,automake)
+                 ("libtool" ,libtool)
+                 ("pkg-config" ,pkg-config))
+           (package-native-inputs base)))
+      (inputs (alist-replace "mozjs" `(,duktape)
+                             (package-inputs base))))))
+
+;;; Define a top level polkit variable that can be built on any of the
+;;; supported platforms.  This is to work around the fact that our
+;;; mrustc-bootstrapped rust toolchain currently only supports the x86_64
+;;; architecture...
+(define-public polkit
+  (if (string-prefix? "x86_64"
+                      (or (%current-system) (%current-target-system)))
+      polkit*
+      polkit-duktape))
 
 (define-public polkit-qt
   (package
--8<---------------cut here---------------end--------------->8---

it builds, and doesn't seem to break things, but:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --system=aarch64-linux \
    -e '(@ (gnu packages polkit) polkit)' -n \
    |& grep polkit
/gnu/store/dw11y85xfsb8hcg7w2cw57f1xfs4i74m-polkit-0.120.drv
/gnu/store/ric7yf4ra2p14p29fwsh18m1nakciakv-polkit-0.120.tar.xz
--8<---------------cut here---------------end--------------->8---

suggests it isn't working.

Ideas?

Thanks!

Maxim


  reply	other threads:[~2021-11-22  3:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 18:23 Replacing polkit by polkit-duktape on core-updates-frozen ? Maxim Cournoyer
2021-11-11 23:30 ` Thiago Jung Bauermann
2021-11-17 11:08   ` Ludovic Courtès
2021-11-22  3:35     ` Maxim Cournoyer [this message]
2021-11-22 13:30       ` Ludovic Courtès
2021-11-22 20:26         ` Maxim Cournoyer
2021-11-22 20:41         ` Maxim Cournoyer
2021-11-23 17:18           ` Ludovic Courtès
2021-11-23 20:34             ` Thiago Jung Bauermann
2021-11-24  4:11               ` Maxim Cournoyer
2021-11-24  4:02             ` Maxim Cournoyer
2021-11-24  8:42               ` Josselin Poiret via Development of GNU Guix and the GNU System distribution.
2021-11-24 14:42                 ` Maxim Cournoyer

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=87mtlwc175.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

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

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