diff options
Diffstat (limited to 'gnu/packages/polkit.scm')
-rw-r--r-- | gnu/packages/polkit.scm | 126 |
1 files changed, 90 insertions, 36 deletions
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index f495d51c83..4cbe1feaba 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 <[email protected]> ;;; Copyright © 2015 Andy Wingo <[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. ;;; @@ -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,36 +71,27 @@ (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) + ("mozjs" ,mozjs-78) ("nspr" ,nspr))) (propagated-inputs `(("glib" ,glib))) ; required by polkit-gobject-1.pc @@ -98,10 +99,17 @@ `(("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 +120,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 +140,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 +150,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 |