summaryrefslogtreecommitdiff
path: root/README (plain)
blob: 5d2246f8bdef230500ffe33cab2b5904b7308742
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
gconf-defaults-hack
===================

This is a small LD_PRELOAD library designed to fix problems with GConf
defaults when running with a partial install of some GNOME components
into a non-system directory.

Namely:

 - At make install time, schemas are installed in $sysconfdir/gconf/schemas
 - Schema installation into the system defaults database in /etc fails
 - When we run apps, they talk to the system copy of gconfd which is looking
   in /etc/ for defaults.

What the LD_PRELOAD library does is override libgconf functions so that
if a lookup from gconfd totally fails - no entry for the user, no entry
from the installed schemas - then it looks in $sysconfdir/gconf/schemas
(or the directory given by GCONF_DEFAULTS_SCHEMAS_DIR) and sees if it
can extract a default from there.

To avoid parsing a lot of XML files every time the application is executed,
the extracted values are cached in a SQLite database. If the schemas
dir is writable by the user, the database is stored in

 $schemadir/.gconfdefaults.sqlite

Otherwise the database is stored in:

 $home/.gconfdefaults.<mangled version $schemadir>.sqlite

Notes:

 * Performance was not the primary consideration here; for each
   application, the first time a default lookup is triggered, it needs to look
   at the modification times for all schema files in $schemadir to see
   if the database needs to be rebuilt. If the set of locally built modules
   is large, this could take a measurable amount of time.

 * One issue of setting a LD_PRELOAD in a .jhbuildrc is that the library
   and dependencies will get loaded into *every* process, including /bin/sh,
   gcc, etc, slowing down the build.

 * Because the defaults lookup is last-resort measure, if the same schemas
   are installed on the system with *different* default values, the system
   default values will be preferred. In general, default values shouldn't change
   very often.

 * This doesn't help for cases where schemas are actually needed; in particular,
   gconf-editor won't have any access to the documentation for the schemas.
   You could imagine a more sophisticated version of this library that provided
   the schemas as well, but that's would be considerably more code.

Usage
=====

Using gconf-defaults-hack with JHBuild:

 A) Add gconf-defaults-hack to your moduleset
 B) Add to your ~/.jhbuildrc

    os.environ['GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL'] = '1'
    addpath('LD_PRELOAD', os.path.join(prefix, "lib", "libgconf-defaults-hack.so"))

Legal
=====

gconf-defaults-hack is Copyright 1999-2009 Red Hat, Inc, and licensed
under the terms of the GNU Library General License, version 2 or
later. See the file COPYING for details.

Owen Taylor
7 June 2009