[dconf] un-hardcode install paths



commit 50cfddf43de1625b2ac79bd1f93f8cc84ca878b5
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Aug 13 23:05:05 2009 -0400

    un-hardcode install paths

 config/.gitignore                    |    1 +
 config/Makefile.am                   |    9 +++++----
 config/{dconf.conf => dconf.conf.in} |    4 ++--
 configure.ac                         |    6 ++++++
 dconf/Makefile.am                    |    2 ++
 dconf/dconf-config.c                 |    2 +-
 writer/Makefile.am                   |    2 ++
 writer/dconf-writer-config.c         |    2 +-
 8 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/config/.gitignore b/config/.gitignore
index ea8baa5..399a0fe 100644
--- a/config/.gitignore
+++ b/config/.gitignore
@@ -1,2 +1,3 @@
+dconf.conf
 *.db
 *.service
diff --git a/config/Makefile.am b/config/Makefile.am
index 8a4512f..44e7906 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,5 +1,5 @@
-dconf_etcdir = /etc/xdg/dconf
-dconf_etc_DATA = \
+dconfetcdir = $(sysconfdir)/dconf
+dconfetc_DATA = \
 	system.db	\
 	default.db	\
 	dconf.conf
@@ -10,14 +10,15 @@ system.db: empty-db
 default.db: empty-db
 	cp empty-db default.db
 
-dbusservicedir = /usr/share/dbus-1/services
 dbusservice_DATA = \
 	ca.desrt.dconf.writer.user.service
 
+%.conf: %.conf.in
+	sed -e "s|\ sysconfdir\@|$(sysconfdir)|" $< > $@
+
 %.service: %.service.in
 	sed -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
 
-dbussystemservicedir = /usr/share/dbus-1/services
 dbussystemservice_DATA = \
 	ca.desrt.dconf.writer.default.service	\
 	ca.desrt.dconf.writer.system.service
diff --git a/config/dconf.conf b/config/dconf.conf.in
similarity index 51%
rename from config/dconf.conf
rename to config/dconf.conf.in
index e0a46b0..979d29a 100644
--- a/config/dconf.conf
+++ b/config/dconf.conf.in
@@ -1,5 +1,5 @@
-system          /etc/xdg/dconf/system.db      system/system
-default         /etc/xdg/dconf/default.db     system/default
+system          @sysconfdir@/dconf/system.db      system/system
+default         @sysconfdir@/dconf/default.db     system/default
 user            ~/.config/dconf/user.db       session/user
 
 /user/          user:default
diff --git a/configure.ac b/configure.ac
index 3cd3e59..b7b1bbd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,12 @@ fi
 AM_CONDITIONAL(ENABLE_GIO, test "$enable_gio" = "yes")
 AC_DEFINE(ENABLE_GIO)
 
+AC_ARG_WITH(dbus_service_dir, [  --with-dbus-service-dir=PATH choose directory for dbus service files, [default=PREFIX/share/dbus-1/services]], dbusservicedir="$withval", dbusservicedir=${datadir}/dbus-1/services)
+AC_SUBST(dbusservicedir)
+
+AC_ARG_WITH(dbus_system_service_dir, [  --with-dbus-system-service-dir=PATH choose directory for dbus system service files, [default=PREFIX/share/dbus-1/system-services]], dbussystemservicedir="$withval", dbussystemservicedir=${datadir}/dbus-1/system-services)
+AC_SUBST(dbussystemservicedir)
+
 AC_OUTPUT([
   common/Makefile
   editor/Makefile
diff --git a/dconf/Makefile.am b/dconf/Makefile.am
index ac221bd..d1c6b39 100644
--- a/dconf/Makefile.am
+++ b/dconf/Makefile.am
@@ -1,6 +1,8 @@
 AM_CFLAGS = -I$(top_srcdir)/common $(glib_CFLAGS) $(dbus_CFLAGS) \
 		-Wall -Wmissing-prototypes -Wwrite-strings -g
 
+DEFS = -DDCONF_CONF=\"$(sysconfdir)/dconf/dconf.conf\"
+
 lib_LTLIBRARIES = libdconf.la
 
 libdconf_la_LIBADD = $(glib_LIBS) $(dbus_LIBS)
diff --git a/dconf/dconf-config.c b/dconf/dconf-config.c
index 8db34a5..9d4fe29 100644
--- a/dconf/dconf-config.c
+++ b/dconf/dconf-config.c
@@ -138,7 +138,7 @@ dconf_config_parse_file (GError **error)
   gchar *tmp;
   gint line;
 
-  tmp = g_strdup ("/etc/xdg/dconf/dconf.conf");
+  tmp = g_strdup (DCONF_CONF);
   file = fopen (tmp, "r");
 
   if (file == NULL)
diff --git a/writer/Makefile.am b/writer/Makefile.am
index a86f485..44f64bc 100644
--- a/writer/Makefile.am
+++ b/writer/Makefile.am
@@ -1,6 +1,8 @@
 AM_CFLAGS = -I$(top_srcdir)/common $(glib_CFLAGS) $(dbus_CFLAGS) \
 		-Wall -Wmissing-prototypes -Wwrite-strings -g
 
+DEFS = -DDCONF_CONF=\"$(sysconfdir)/dconf/dconf.conf\"
+
 noinst_LIBRARIES = libdconf-writer.a
 
 libdconf_writer_a_SOURCES = \
diff --git a/writer/dconf-writer-config.c b/writer/dconf-writer-config.c
index f9d8550..1a0995d 100644
--- a/writer/dconf-writer-config.c
+++ b/writer/dconf-writer-config.c
@@ -38,7 +38,7 @@ dconf_writer_config_read (const gchar         *name,
   gchar *tmp;
   gint line;
 
-  tmp = g_strdup ("/etc/xdg/dconf/dconf.conf");
+  tmp = g_strdup (DCONF_CONF);
   file = fopen (tmp, "r");
 
   if (file == NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]