gnu: Use invoke and return #t from all builders.
[jackhill/guix/guix.git] / gnu / packages / polkit.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
7 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages polkit)
25 #:use-module ((guix licenses) #:select (lgpl2.0+))
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system cmake)
29 #:use-module (guix build-system gnu)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages freedesktop)
32 #:use-module (gnu packages glib)
33 #:use-module (gnu packages gtk)
34 #:use-module (gnu packages gnuzilla)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages qt)
40 #:use-module (gnu packages xml))
41
42 (define-public polkit
43 (package
44 (name "polkit")
45 (version "0.113")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append
49 "https://www.freedesktop.org/software/polkit/releases/"
50 name "-" version ".tar.gz"))
51 (sha256
52 (base32
53 "109w86kfqrgz83g9ivggplmgc77rz8kx8646izvm2jb57h4rbh71"))
54 (patches (search-patches "polkit-drop-test.patch"))
55 (modules '((guix build utils)))
56 (snippet
57 '(begin
58 (use-modules (guix build utils))
59 (substitute* "configure"
60 ;; Replace libsystemd-login with libelogind.
61 (("libsystemd-login") "libelogind")
62 ;; Skip the sanity check that the current system runs
63 ;; systemd.
64 (("test ! -d /sys/fs/cgroup/systemd/") "false"))
65 (substitute* "src/polkit/polkitunixsession-systemd.c"
66 (("systemd") "elogind"))
67 (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c"
68 (("systemd") "elogind"))
69 (substitute* "src/polkitbackend/polkitbackendjsauthority.c"
70 (("systemd") "elogind"))
71
72 ;; GuixSD's polkit service stores actions under
73 ;; /etc/polkit-1/actions.
74 (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
75 (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
76 "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
77
78 ;; Set the setuid helper's real location.
79 (substitute* "src/polkitagent/polkitagentsession.c"
80 (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
81 "\"/run/setuid-programs/polkit-agent-helper-1\""))
82 #t))))
83 (build-system gnu-build-system)
84 (inputs
85 `(("expat" ,expat)
86 ("linux-pam" ,linux-pam)
87 ("elogind" ,elogind)
88 ("mozjs" ,mozjs)
89 ("nspr" ,nspr)))
90 (propagated-inputs
91 `(("glib" ,glib))) ; required by polkit-gobject-1.pc
92 (native-inputs
93 `(("pkg-config" ,pkg-config)
94 ("glib:bin" ,glib "bin") ; for glib-mkenums
95 ("intltool" ,intltool)
96 ("gobject-introspection" ,gobject-introspection)))
97 (arguments
98 `(#:configure-flags '("--sysconfdir=/etc"
99 "--enable-man-pages")
100 #:phases
101 (modify-phases %standard-phases
102 (add-after
103 'unpack 'fix-introspection-install-dir
104 (lambda* (#:key outputs #:allow-other-keys)
105 (let ((out (assoc-ref outputs "out")))
106 (substitute* (find-files "." "Makefile.in")
107 (("@INTROSPECTION_GIRDIR@")
108 (string-append out "/share/gir-1.0/"))
109 (("@INTROSPECTION_TYPELIBDIR@")
110 (string-append out "/lib/girepository-1.0/")))
111 #t)))
112 (replace
113 'install
114 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
115 ;; Override sysconfdir during "make install", to avoid attempting
116 ;; to install in /etc, and to instead install the skeletons in the
117 ;; output directory.
118 (let ((out (assoc-ref outputs "out")))
119 (apply invoke "make" "install"
120 (string-append "sysconfdir=" out "/etc")
121 (string-append "polkit_actiondir="
122 out "/share/polkit-1/actions")
123 make-flags)
124 #t))))))
125 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
126 (synopsis "Authorization API for privilege management")
127 (description "Polkit is an application-level toolkit for defining and
128 handling the policy that allows unprivileged processes to speak to
129 privileged processes. It is a framework for centralizing the decision
130 making process with respect to granting access to privileged operations
131 for unprivileged applications.")
132 (license lgpl2.0+)))
133
134 (define-public polkit-qt
135 (package
136 (name "polkit-qt")
137 (version "1-0.112.0")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
141 "http://download.kde.org/stable/apps/KDE4.x/admin/"
142 name "-" version ".tar.bz2"))
143 (sha256
144 (base32
145 "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7"))))
146 (build-system cmake-build-system)
147 (inputs
148 `(("polkit" ,polkit)))
149 (propagated-inputs
150 `(("qtbase" ,qtbase)))
151 (native-inputs
152 `(("pkg-config" ,pkg-config)))
153 (arguments
154 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_RPATH="
155 (assoc-ref %outputs "out")
156 "/lib:"
157 (assoc-ref %outputs "out")
158 "/lib64"))
159 #:tests? #f)) ; there is a test subdirectory, but no test target
160 (home-page "http://api.kde.org/kdesupport-api/polkit-qt-1-apidocs/")
161 (synopsis "Qt frontend to the polkit library")
162 (description "Polkit-qt is a library that lets developers use the
163 PolicyKit API through a Qt-styled API. It is mainly a wrapper around
164 QAction and QAbstractButton that lets you integrate those two component
165 easily with PolicyKit.")
166 (license lgpl2.0+)))
167
168 (define-public polkit-gnome
169 (package
170 (name "polkit-gnome")
171 (version "0.105")
172 (source (origin
173 (method url-fetch)
174 (uri (string-append "mirror://gnome/sources/"
175 name "/" version "/"
176 name "-" version ".tar.xz"))
177 (sha256
178 (base32
179 "0sckmcbxyj6sbrnfc5p5lnw27ccghsid6v6wxq09mgxqcd4lk10p"))))
180 (build-system gnu-build-system)
181 (inputs `(("gtk+" ,gtk+)
182 ("polkit" ,polkit)))
183 (native-inputs `(("intltool" ,intltool)
184 ("pkg-config" ,pkg-config)))
185 (synopsis "Legacy polkit authentication agent for GNOME")
186 (description "PolicyKit-gnome provides a D-Bus session bus service
187 that is used to bring up authentication dialogs used for obtaining
188 privileges.")
189 (home-page "https://www.freedesktop.org/wiki/Software/polkit/")
190 (license lgpl2.0+)))