Hello, Ludovic Courtès <l...@gnu.org> writes:
> Hi, > > Thiago Jung Bauermann <bauerm...@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