diff options
Diffstat (limited to 'gnu/packages/polkit.scm')
-rw-r--r-- | gnu/packages/polkit.scm | 98 |
1 files changed, 79 insertions, 19 deletions
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index 0f89bd051c..e4f4b1276f 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -1,13 +1,14 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Andreas Enge <[email protected]> ;;; Copyright © 2015 Andy Wingo <[email protected]> -;;; Copyright © 2015 Ludovic Courtès <[email protected]> +;;; Copyright © 2015, 2021 Ludovic Courtès <[email protected]> ;;; Copyright © 2015 Mark H Weaver <[email protected]> ;;; Copyright © 2016 Efraim Flashner <[email protected]> ;;; Copyright © 2017 Huang Ying <[email protected]> ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]> ;;; Copyright © 2018 Ricardo Wurmus <[email protected]> ;;; Copyright © 2021 Morgan Smith <[email protected]> +;;; Copyright © 2021 Maxim Cournoyer <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,22 +29,28 @@ #:use-module ((guix licenses) #:select (lgpl2.0+)) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix memoization) + #:use-module (guix utils) + #:use-module (guix build utils) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (gnu packages) + #:use-module (gnu packages autotools) #:use-module (gnu packages freedesktop) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) #:use-module (gnu packages docbook) #:use-module (gnu packages gnuzilla) + #:use-module (gnu packages javascript) #:use-module (gnu packages linux) #:use-module (gnu packages nss) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages qt) - #:use-module (gnu packages xml)) + #:use-module (gnu packages xml) + #:export (polkit)) -(define-public polkit +(define-public polkit-mozjs (package (name "polkit") (version "0.120") @@ -55,6 +62,7 @@ (sha256 (base32 "00zfg9b9ivkcj2jcf5b92cpvvyljz8cmfwj86lkvy5rihnd5jypf")) + (patches (search-patches "polkit-configure-elogind.patch")) (modules '((guix build utils))) (snippet '(begin @@ -63,8 +71,14 @@ (substitute* "test/Makefile.in" (("SUBDIRS = mocklibc . polkit polkitbackend") "SUBDIRS = mocklibc . polkit")) - ;; Guix System's polkit service stores actions under - ;; /etc/polkit-1/actions. + ;; Disable a test that requires Python, D-Bus and a few + ;; libraries and fails with "ERROR: timed out waiting for bus + ;; process to terminate". + (substitute* "test/polkitbackend/Makefile.am" + (("TEST_PROGS \\+= polkitbackendjsauthoritytest-wrapper.py") + "")) + ;; Guix System's polkit + ;; service stores actions under /etc/polkit-1/actions. (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c" (("PACKAGE_DATA_DIR \"/polkit-1/actions\"") "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\"")) @@ -74,13 +88,9 @@ "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) (build-system gnu-build-system) (inputs - `(("expat" ,expat) - ("linux-pam" ,linux-pam) - ("elogind" ,elogind) - ("mozjs" ,mozjs-78) - ("nspr" ,nspr))) + (list expat linux-pam elogind mozjs-78 nspr)) (propagated-inputs - `(("glib" ,glib))) ; required by polkit-gobject-1.pc + (list glib)) ; required by polkit-gobject-1.pc (native-inputs `(("pkg-config" ,pkg-config) ("glib:bin" ,glib "bin") ; for glib-mkenums @@ -90,7 +100,12 @@ ("docbook-xsl" ,docbook-xsl))) ; for man page generation (arguments `(#:configure-flags '("--sysconfdir=/etc" - "--enable-man-pages") + "--enable-man-pages" + ;; Prevent ‘configure: error: cannot check for + ;; file existence when cross compiling’. + ,@(if (%current-target-system) + '("--with-os-type=unknown") + '())) #:phases (modify-phases %standard-phases (add-after @@ -131,6 +146,53 @@ making process with respect to granting access to privileged operations for unprivileged applications.") (license lgpl2.0+))) +;;; Variant of polkit built with Duktape, a lighter JavaScript engine compared +;;; to mozjs. +(define-public polkit-duktape + (let ((base polkit-mozjs)) + (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 polkit-for-system + (mlambda (system) + "Return a polkit package that can be built for SYSTEM; that is, either the +regular polkit that requires mozjs or its duktape variant." + (if (string-prefix? "x86_64" system) + polkit-mozjs + polkit-duktape))) + +;;; 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-syntax polkit + (identifier-syntax (polkit-for-system + (or (%current-target-system) (%current-system))))) + (define-public polkit-qt (package (name "polkit-qt") @@ -145,11 +207,11 @@ for unprivileged applications.") "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7")))) (build-system cmake-build-system) (inputs - `(("polkit" ,polkit))) + (list polkit)) (propagated-inputs - `(("qtbase" ,qtbase-5))) + (list qtbase-5)) (native-inputs - `(("pkg-config" ,pkg-config))) + (list pkg-config)) (arguments `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "out") @@ -178,10 +240,8 @@ easily with PolicyKit.") (base32 "0sckmcbxyj6sbrnfc5p5lnw27ccghsid6v6wxq09mgxqcd4lk10p")))) (build-system gnu-build-system) - (inputs `(("gtk+" ,gtk+) - ("polkit" ,polkit))) - (native-inputs `(("intltool" ,intltool) - ("pkg-config" ,pkg-config))) + (inputs (list gtk+ polkit)) + (native-inputs (list intltool pkg-config)) (synopsis "Legacy polkit authentication agent for GNOME") (description "PolicyKit-gnome provides a D-Bus session bus service that is used to bring up authentication dialogs used for obtaining |