polkit.scm 7.9 KB

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