From: Federico Beffa <beffa@ieee.org>
To: Guix-devel <guix-devel@gnu.org>
Subject: [PATCH 1/4] guix: build/glib-or-gtk-build-system: Add support for GIO and XDG theming.
Date: Thu, 18 Dec 2014 22:10:00 +0100 [thread overview]
Message-ID: <CAKrPhPM04Nno35wEVoL1MnrujTpJ2nHBrG9J0RVfgGRBdRvNvA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
I added support for GIO and theming data according to the XDG specifications.
https://developer.gnome.org/gio/stable/running-gio-apps.html
http://www.freedesktop.org/wiki/Specifications/
Regards,
Fede
[-- Attachment #2: 0001-guix-build-glib-or-gtk-build-system-Add-support-for-.patch --]
[-- Type: text/x-patch, Size: 9411 bytes --]
From c726b525111ff2f8055f7f2be98b7a5e61a8a96e Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Thu, 18 Dec 2014 20:58:18 +0100
Subject: [PATCH 1/4] guix: build/glib-or-gtk-build-system: Add support for GIO
and XDG theming.
* guix/build/glib-or-gtk-build-system.scm (data-directories): Rename
'schemas-directories' to 'data-directories' and add support for XDG theming
data.
* guix/build/glib-or-gtk-build-system.scm (gio-module-directories): New
function.
* guix/build/glib-or-gtk-build-system.scm (wrap-all-programs): Update names to
reflect that we are dealing with more types of data and not only with
schemas. Add handling of GIO modules.
* guix/build-system/glib-or-gtk.scm (lower): Import the 'bin' output of GLib
instead of 'out'. This was an error since we need the program
'glib-compile-schemas'. Update the description.
---
guix/build-system/glib-or-gtk.scm | 11 ++--
guix/build/glib-or-gtk-build-system.scm | 99 ++++++++++++++++++++++++++-------
2 files changed, 84 insertions(+), 26 deletions(-)
diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm
index 8091311..ff95ca5 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -38,11 +38,10 @@
;;
;; 'glib-or-gtk-wrap' phase:
;;
-;; a) This phase looks for GSettings schemas by verifying the existence of
-;; path "datadir/glib-2.0/schemas" in all input packages. If the path is
-;; found in any package, then all programs in "out/bin" are wrapped in scripts
-;; where the environment variable "XDG_DATA_DIRS" is set and points to the
-;; list of found schemas directories.
+;; a) This phase looks for GSettings schemas, GIO modules and theming data.
+;; If any of these is found in any input package, then all programs in
+;; "out/bin" are wrapped in scripts defining the nedessary environment
+;; variables.
;;
;; b) Looks for the existence of "libdir/gtk-3.0" directories in all input
;; packages. If any is found, then the environment variable "GTK_PATH" is
@@ -95,7 +94,7 @@
`(("source" ,source))
'())
,@inputs))
- (build-inputs `(("glib:bin" ,glib)
+ (build-inputs `(("glib:bin" ,glib "bin")
,@(if implicit-inputs?
(standard-packages)
'())
diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm
index 9351a70..712087e 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -41,6 +41,9 @@
(fold (lambda (s p) (or (string-ci=? s directory) p))
#f directories-list))
+;; We do not include $HOME/.guix-profile/gtk-v.0 (v=2 or 3) because we do not
+;; want to mix gtk+-2 and gtk+-3 modules. See
+;; https://developer.gnome.org/gtk3/stable/gtk-running.html
(define (gtk-module-directories inputs)
"Check for the existence of \"libdir/gtk-v.0\" in INPUTS. Return a list
with all found directories."
@@ -64,20 +67,68 @@ with all found directories."
prev)))))
(fold gtk-module '() inputs)))
-(define (schemas-directories inputs)
- "Check for the existence of \"datadir/glib-2.0/schemas\" in INPUTS. Return
-a list with all found directories."
- (define (glib-schemas input previous)
+;; We include $HOME/.guix-profile/share so that if the user installs a
+;; desktop, a sound or an icon theme, the application should be able to see
+;; it, without having to add the theme to the application inputs. See
+;; http://www.freedesktop.org/wiki/DesktopThemeSpec
+;; http://freedesktop.org/wiki/Specifications/sound-theme-spec
+;; http://freedesktop.org/wiki/Specifications/icon-theme-spec
+;;
+;; Currently desktop themes are not well supported and do not honor
+;; XDG_DATA_DIRS. One example is evince which only looks for desktop themes
+;; in $HOME/.themes (for backward compatibility) and in XDG_DATA_HOME (which
+;; defaults to $HOME/.local/share). One way to handle these applications
+;; appears to be by making $HOME/.themes a symlink to
+;; $HOME/.guix-profile/share/themes.
+;;
+;; Note however that GLib's schemas added in $HOME/.guix-profile/share by the
+;; installation of a library or application will not necessarily work. This
+;; is because GLib only looks for compiled schemas (in a file called
+;; gschemas.compiled) and currently $HOME/.guix-profile/share does not include
+;; such a file comprising all XML schemas visible in that directory.
+(define (data-directories inputs)
+ "Check for the existence of \"$datadir/glib-2.0/schemas\" or XDG themes data
+in INPUTS. Return a list with all found directories."
+ (define (data-directory input previous)
(let* ((in (match input
((_ . dir) dir)
(_ "")))
(datadir (string-append in "/share")))
- (if (and (subdirectory-exists? datadir "/glib-2.0/schemas")
+ (if (and (or (subdirectory-exists? datadir "/glib-2.0/schemas")
+ (subdirectory-exists? datadir "/sounds")
+ (subdirectory-exists? datadir "/themes")
+ (subdirectory-exists? datadir "/cursors")
+ (subdirectory-exists? datadir "/wallpapers")
+ (subdirectory-exists? datadir "/icons"))
(not (directory-included? datadir previous)))
(cons datadir previous)
previous)))
- (fold glib-schemas '() inputs))
+ (fold data-directory '("$HOME/.guix-profile/share") inputs))
+
+;; All GIO modules are expected to be installed in GLib's $libdir/gio/modules
+;; directory. That directory has to include a file called giomodule.cache
+;; listing all available modules. GIO can be made aware of modules in other
+;; directories with the help of the environment variable GIO_EXTRA_MODULES.
+;; The official GIO documentation states that this environment variable should
+;; only be used for testing and not in a production environment. However, it
+;; appears that there is no other way of specifying multiple modules
+;; directories (NIXOS also does use this variable). See
+;; https://developer.gnome.org/gio/stable/running-gio-apps.html
+(define (gio-module-directories inputs)
+ "Check for the existence of \"$libdir/gio/modules\" in the INPUTS and
+returns a list with all found directories."
+ (define (gio-module-directory input previous)
+ (let* ((in (match input
+ ((_ . dir) dir)
+ (_ "")))
+ (gio-mod-dir (string-append in "/lib/gio/modules")))
+ (if (and (directory-exists? gio-mod-dir)
+ (not (directory-included? gio-mod-dir previous)))
+ (cons gio-mod-dir previous)
+ previous)))
+
+ (fold gio-module-directory '("$HOME/.guix-profile/gio/modules") inputs))
(define* (wrap-all-programs #:key inputs outputs
(glib-or-gtk-wrap-excluded-outputs '())
@@ -96,28 +147,36 @@ add a dependency of that output on GLib and GTK+."
(unless (member output glib-or-gtk-wrap-excluded-outputs)
(let* ((bindir (string-append directory "/bin"))
(bin-list (find-files bindir ".*"))
- (schemas (schemas-directories
+ (datadirs (data-directories
(alist-cons output directory inputs)))
(gtk-mod-dirs (gtk-module-directories
(alist-cons output directory inputs)))
- (schemas-env-var
- (if (not (null? schemas))
- `("XDG_DATA_DIRS" ":" prefix ,schemas)
+ (gio-mod-dirs (gio-module-directories
+ (alist-cons output directory inputs)))
+ (data-env-var
+ (if (not (null? datadirs))
+ `("XDG_DATA_DIRS" ":" prefix ,datadirs)
#f))
(gtk-mod-env-var
(if (not (null? gtk-mod-dirs))
`("GTK_PATH" ":" prefix ,gtk-mod-dirs)
+ #f))
+ (gio-mod-env-var
+ (if (not (null? gio-mod-dirs))
+ `("GIO_EXTRA_MODULES" ":" prefix ,gio-mod-dirs)
#f)))
- (cond
- ((and schemas-env-var gtk-mod-env-var)
- (for-each (cut wrap-program <> schemas-env-var gtk-mod-env-var)
- bin-list))
- (schemas-env-var
- (for-each (cut wrap-program <> schemas-env-var)
- bin-list))
- (gtk-mod-env-var
- (for-each (cut wrap-program <> gtk-mod-env-var)
- bin-list))))))))
+ ;; Since datadirs and gio-mod-dirs are the result of fold with an
+ ;; initial value, data-env-var and gio-mod-env-var can't be #f
+ (if gtk-mod-env-var
+ (for-each (cut wrap-program <>
+ data-env-var
+ gtk-mod-env-var
+ gio-mod-env-var)
+ bin-list)
+ (for-each (cut wrap-program <>
+ data-env-var
+ gio-mod-env-var)
+ bin-list)))))))
(for-each handle-output outputs)
#t)
--
1.8.4
next reply other threads:[~2014-12-18 21:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 21:10 Federico Beffa [this message]
2014-12-19 12:56 ` [PATCH 1/4] guix: build/glib-or-gtk-build-system: Add support for GIO and XDG theming 宋文武
2014-12-21 9:41 ` Federico Beffa
2014-12-21 10:54 ` Ludovic Courtès
2015-01-07 17:27 ` Federico Beffa
2015-01-08 12:39 ` 宋文武
2015-01-08 17:43 ` Federico Beffa
2015-01-08 20:26 ` Ludovic Courtès
2015-01-08 21:46 ` Federico Beffa
2015-01-10 21:08 ` Ludovic Courtès
2015-01-11 8:25 ` Federico Beffa
2015-01-11 10:55 ` Ludovic Courtès
2015-01-12 21:33 ` Mark H Weaver
2015-01-13 8:18 ` Federico Beffa
2015-01-09 1:57 ` 宋文武
2015-01-08 20:27 ` Ludovic Courtès
2015-01-09 2:00 ` 宋文武
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKrPhPM04Nno35wEVoL1MnrujTpJ2nHBrG9J0RVfgGRBdRvNvA@mail.gmail.com \
--to=beffa@ieee.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.