diff options
Diffstat (limited to 'gnu/packages/polkit.scm')
-rw-r--r-- | gnu/packages/polkit.scm | 144 |
1 files changed, 96 insertions, 48 deletions
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index f495d51c83..e4f4b1276f 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -1,11 +1,14 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com> +;;; Copyright © 2015, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com> +;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,25 +29,31 @@ #: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.116") - (replacement polkit/fixed) + (version "0.120") (source (origin (method url-fetch) (uri (string-append @@ -52,7 +61,8 @@ name "-" version ".tar.gz")) (sha256 (base32 - "1c9lbpndh5zis22f154vjrhnqw65z8s85nrgl42v738yf6g0q5w8")) + "00zfg9b9ivkcj2jcf5b92cpvvyljz8cmfwj86lkvy5rihnd5jypf")) + (patches (search-patches "polkit-configure-elogind.patch")) (modules '((guix build utils))) (snippet '(begin @@ -61,47 +71,41 @@ (substitute* "test/Makefile.in" (("SUBDIRS = mocklibc . polkit polkitbackend") "SUBDIRS = mocklibc . polkit")) - (substitute* "configure" - ;; Replace libsystemd-login with libelogind. - (("libsystemd-login") "libelogind") - ;; Skip the sanity check that the current system runs - ;; systemd. - (("test ! -d /sys/fs/cgroup/systemd/") "false")) - (substitute* "src/polkit/polkitunixsession-systemd.c" - (("systemd") "elogind")) - (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c" - (("systemd") "elogind")) - (substitute* "src/polkitbackend/polkitbackendjsauthority.cpp" - (("systemd") "elogind")) - - ;; 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\"")) - ;; Set the setuid helper's real location. (substitute* "src/polkitagent/polkitagentsession.c" (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"") - "\"/run/setuid-programs/polkit-agent-helper-1\"")) - #t)))) + "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) (build-system gnu-build-system) (inputs - `(("expat" ,expat) - ("linux-pam" ,linux-pam) - ("elogind" ,elogind) - ("mozjs" ,mozjs-60) - ("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 ("intltool" ,intltool) - ("gobject-introspection" ,gobject-introspection))) + ("gobject-introspection" ,gobject-introspection) + ("libxslt" ,libxslt) ; for man page generation + ("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 @@ -112,8 +116,15 @@ (("@INTROSPECTION_GIRDIR@") (string-append out "/share/gir-1.0/")) (("@INTROSPECTION_TYPELIBDIR@") - (string-append out "/lib/girepository-1.0/"))) - #t))) + (string-append out "/lib/girepository-1.0/")))))) + (add-after 'unpack 'fix-manpage-generation + (lambda* (#:key inputs #:allow-other-keys) + (let ((xsldoc (string-append (assoc-ref inputs "docbook-xsl") + "/xml/xsl/docbook-xsl-" + ,(package-version docbook-xsl)))) + (substitute* '("docs/man/Makefile.am" "docs/man/Makefile.in") + (("http://docbook.sourceforge.net/release/xsl/current") + xsldoc))))) (replace 'install (lambda* (#:key outputs (make-flags '()) #:allow-other-keys) @@ -125,8 +136,7 @@ (string-append "sysconfdir=" out "/etc") (string-append "polkit_actiondir=" out "/share/polkit-1/actions") - make-flags) - #t)))))) + make-flags))))))) (home-page "https://www.freedesktop.org/wiki/Software/polkit/") (synopsis "Authorization API for privilege management") (description "Polkit is an application-level toolkit for defining and @@ -136,12 +146,52 @@ making process with respect to granting access to privileged operations for unprivileged applications.") (license lgpl2.0+))) -(define polkit/fixed - (package - (inherit polkit) - (source (origin - (inherit (package-source polkit)) - (patches (search-patches "polkit-CVE-2021-3560.patch")))))) +;;; 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 @@ -157,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") @@ -190,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 |