r14835 - gnucash/trunk/src - Fix and clarify path names that were mixed up.

Christian Stimming cstim at cvs.gnucash.org
Tue Sep 12 09:41:29 EDT 2006


Author: cstim
Date: 2006-09-12 09:41:28 -0400 (Tue, 12 Sep 2006)
New Revision: 14835
Trac: http://svn.gnucash.org/trac/changeset/14835

Modified:
   gnucash/trunk/src/bin/Makefile.am
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/engine/Makefile.am
   gnucash/trunk/src/engine/gnc-engine.c
   gnucash/trunk/src/engine/gnc-path.c
   gnucash/trunk/src/engine/gnc-path.h
   gnucash/trunk/src/engine/gncla-dir.h.in
   gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c
Log:
Fix and clarify path names that were mixed up.

In particular, two different GNC_LIBDIR macros were defined:
One in gncla-dir.h as libdir, and another one from configure.in as pkglibdir
in the CFLAGS. This was a big mess. Now the pathnames should all follow automake conventions.

Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/bin/Makefile.am	2006-09-12 13:41:28 UTC (rev 14835)
@@ -4,10 +4,8 @@
 AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS} ${GNOME_CFLAGS} ${GTK_CFLAGS} \
   ${GUILE_INCS} \
   ${QOF_CFLAGS} \
-  -DPREFIX=\"${prefix}\" \
-  -DSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
-  -DDATADIR=\"${GNC_SHAREDIR}\" \
-  -DLIBDIR=\"${GNC_LIBDIR}\" \
+  -DPKGSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
+  -DPKGDATADIR=\"${GNC_SHAREDIR}\" \
   -DGNC_HELPDIR=\"${GNC_HELPDIR}\" \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/core-utils \

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-09-12 13:41:28 UTC (rev 14835)
@@ -85,8 +85,8 @@
 /* Priority of paths: The default is set at build time.  It may be
    overridden by environment variables, which may, in turn, be
    overridden by command line options.  */
-static char *config_path = SYSCONFDIR;
-static char *share_path = DATADIR;
+static char *config_path = PKGSYSCONFDIR;
+static char *share_path = PKGDATADIR;
 static char *help_path = GNC_HELPDIR;
 
 static void
@@ -157,6 +157,7 @@
     if (is_system_config_loaded) return;
 
     update_message("loading system configuration");
+    /* FIXME: use runtime paths from gnc-path.c here */
     system_config = g_build_filename(config_path, "config", NULL);
     is_system_config_loaded = try_load(system_config);
     g_free(system_config);
@@ -512,12 +513,24 @@
     gnc_print_unstable_message();
 
     if (add_quotes_file) {
+        gchar *prefix = gnc_path_get_prefix ();
+	gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir ();
+	gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+	gchar *pkglibdir = gnc_path_get_pkglibdir ();
         /* This option needs to run without a display, so we can't
            initialize any GUI libraries.  */
         gnome_program_init(
             "gnucash", VERSION, LIBGNOME_MODULE,
             argc, argv,
-            GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE);
+	    GNOME_PARAM_APP_PREFIX, prefix,
+	    GNOME_PARAM_APP_SYSCONFDIR, pkgsysconfdir,
+	    GNOME_PARAM_APP_DATADIR, pkgdatadir,
+	    GNOME_PARAM_APP_LIBDIR, pkglibdir,
+	    GNOME_PARAM_NONE);
+	g_free (prefix);
+	g_free (pkgsysconfdir);
+	g_free (pkgdatadir);
+	g_free (pkglibdir);
         scm_boot_guile(argc, argv, inner_main_add_price_quotes, 0);
         exit(0);  /* never reached */
     }

Modified: gnucash/trunk/src/engine/Makefile.am
===================================================================
--- gnucash/trunk/src/engine/Makefile.am	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/engine/Makefile.am	2006-09-12 13:41:28 UTC (rev 14835)
@@ -4,10 +4,6 @@
 pkglib_LTLIBRARIES = libgncmod-engine.la libgw-engine.la libgw-kvp.la
 
 AM_CFLAGS = \
-	-DPREFIX=\"${prefix}\" \
-	-DSYSCONFDIR=\"${GNC_CONFIGDIR}\" \
-	-DDATADIR=\"${GNC_SHAREDIR}\" \
-	-DLIBDIR=\"${GNC_LIBDIR}\" \
 	-I${top_srcdir}/lib/libc \
 	-I${top_srcdir}/src/core-utils \
 	-I${top_srcdir}/src \
@@ -224,14 +220,18 @@
 	touch $@
 	( cd g-wrapped; $(LN_S) -f ../gw-kvp*.scm . )
 
-gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status
+gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status Makefile
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
 		-e 's#@-LOCALE_DIR-@#${LOCALE_DIR}#g' \
 		-e 's#@-GNC_ACCOUNTS_DIR-@#${GNC_ACCOUNTS_DIR}#g' \
 		-e 's#@-GNC_GLADE_DIR-@#${GNC_GLADE_DIR}#g' \
 		-e 's#@-GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY-@#${GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY}#g' \
-                -e 's#@-libdir-@#${libdir}#g'
+		-e 's#@-pkglibdir-@#${pkglibdir}#g' \
+		-e 's#@-libdir-@#${libdir}#g' \
+		-e 's#@-pkgsysconfdir-@#${GNC_CONFIGDIR}#g' \
+		-e 's#@-pkgdatadir-@#${GNC_SHAREDIR}#g' \
+		-e 's#@-prefix-@#${prefix}#g'
 	mv $@.tmp $@
 
 BUILT_SOURCES = iso-4217-currencies.c \

Modified: gnucash/trunk/src/engine/gnc-engine.c
===================================================================
--- gnucash/trunk/src/engine/gnc-engine.c	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/engine/gnc-engine.c	2006-09-12 13:41:28 UTC (rev 14835)
@@ -86,7 +86,7 @@
   gnc_engine_init_hook_t hook;
   GList * cur;
   gchar *tracefilename;
-  gchar *pkglibdir;
+  gchar *libdir;
 
   if (1 == engine_is_initialized) return;
 
@@ -107,16 +107,16 @@
   /* Now register our core types */
   cashobjects_register();
 
-  pkglibdir = gnc_path_get_pkglibdir ();
+  libdir = gnc_path_get_libdir ();
   for (lib = libs; lib->lib ; lib++)
   {
-      if (qof_load_backend_library(pkglibdir, lib->lib))
+      if (qof_load_backend_library(libdir, lib->lib))
       {
           engine_is_initialized = 1;
       }
       else
       {
-	  g_message("failed to load %s from %s\n", lib->lib, pkglibdir);
+	  g_message("failed to load %s from %s\n", lib->lib, libdir);
 	  /* If this is a required library, stop now! */
 	  if (lib->required)
 	  {
@@ -124,7 +124,7 @@
 	  }
       }
   }
-  g_free (pkglibdir);
+  g_free (libdir);
 
   /* call any engine hooks */
   for (cur = engine_init_hooks; cur; cur = cur->next)

Modified: gnucash/trunk/src/engine/gnc-path.c
===================================================================
--- gnucash/trunk/src/engine/gnc-path.c	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/engine/gnc-path.c	2006-09-12 13:41:28 UTC (rev 14835)
@@ -38,21 +38,21 @@
 }
 
 /** Returns the datadir path, usually
- * "$prefix/share". Needed for gnome_program_init().
+ * "$prefix/share/gnucash". Needed for gnome_program_init().
  *
  * @returns A newly allocated string. */
-gchar *gnc_path_get_datadir()
+gchar *gnc_path_get_pkgdatadir()
 {
-  return g_strdup (DATADIR);
+  return g_strdup (PKGDATADIR);
 }
 
 /** Returns the sysconfdir path, usually
- * "$prefix/etc". Needed for gnome_program_init().
+ * "$prefix/etc/gnucash". Needed for gnome_program_init().
  *
  * @returns A newly allocated string. */
-gchar *gnc_path_get_sysconfdir()
+gchar *gnc_path_get_pkgsysconfdir()
 {
-  return g_strdup (SYSCONFDIR);
+  return g_strdup (PKGSYSCONFDIR);
 }
 
 
@@ -62,7 +62,7 @@
  * @returns A newly allocated string. */
 gchar *gnc_path_get_pkglibdir()
 {
-  return g_strdup (GNC_LIBDIR);
+  return g_strdup (PKGLIBDIR);
 }
 
 /** Returns the glade file path, usually

Modified: gnucash/trunk/src/engine/gnc-path.h
===================================================================
--- gnucash/trunk/src/engine/gnc-path.h	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/engine/gnc-path.h	2006-09-12 13:41:28 UTC (rev 14835)
@@ -37,17 +37,17 @@
  * @returns A newly allocated string. */
 gchar *gnc_path_get_libdir(void);
 
-/** Returns the datadir path, usually
- * "$prefix/share". Needed for gnome_program_init(void).
+/** Returns the pkgdatadir path, usually
+ * "$prefix/share/gnucash". Needed for gnome_program_init(void).
  *
  * @returns A newly allocated string. */
-gchar *gnc_path_get_datadir(void);
+gchar *gnc_path_get_pkgdatadir(void);
 
-/** Returns the sysconfdir path, usually
- * "$prefix/etc". Needed for gnome_program_init(void).
+/** Returns the pkgsysconfdir path, usually
+ * "$prefix/etc/gnucash". Needed for gnome_program_init(void).
  *
  * @returns A newly allocated string. */
-gchar *gnc_path_get_sysconfdir(void);
+gchar *gnc_path_get_pkgsysconfdir(void);
 
 
 /** Returns the pkglibdir path, usually

Modified: gnucash/trunk/src/engine/gncla-dir.h.in
===================================================================
--- gnucash/trunk/src/engine/gncla-dir.h.in	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/engine/gncla-dir.h.in	2006-09-12 13:41:28 UTC (rev 14835)
@@ -23,8 +23,13 @@
  *  02110-1301, USA.
  */
 
-#define GNC_LIBDIR "@-libdir-@"
+#define PREFIX "@-prefix-@"
+#define PKGDATADIR "@-pkgdatadir-@"
+#define PKGSYSCONFDIR "@-pkgsysconfdir-@"
 
+#define LIBDIR "@-libdir-@"
+#define PKGLIBDIR "@-pkglibdir-@"
+
 #define LOCALE_DIR  "@-LOCALE_DIR-@"
 
 #define GNC_ACCOUNTS_DIR "@-GNC_ACCOUNTS_DIR-@"

Modified: gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c	2006-09-12 07:34:34 UTC (rev 14834)
+++ gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c	2006-09-12 13:41:28 UTC (rev 14835)
@@ -195,23 +195,23 @@
   char *fullname;
   GError *error = NULL;
   gchar *prefix = gnc_path_get_prefix ();
-  gchar *sysconfdir = gnc_path_get_sysconfdir ();
-  gchar *datadir = gnc_path_get_datadir ();
-  gchar *libdir = gnc_path_get_libdir ();
+  gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir ();
+  gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+  gchar *pkglibdir = gnc_path_get_pkglibdir ();
 
   gnc_gtk_add_rc_file();
   gnucash_program = gnome_program_init(
       "gnucash", version, LIBGNOMEUI_MODULE,
       argc, argv,
       GNOME_PARAM_APP_PREFIX, prefix,
-      GNOME_PARAM_APP_SYSCONFDIR, sysconfdir,
-      GNOME_PARAM_APP_DATADIR, datadir,
-      GNOME_PARAM_APP_LIBDIR, libdir,
+      GNOME_PARAM_APP_SYSCONFDIR, pkgsysconfdir,
+      GNOME_PARAM_APP_DATADIR, pkgdatadir,
+      GNOME_PARAM_APP_LIBDIR, pkglibdir,
       GNOME_PARAM_NONE);
   g_free (prefix);
-  g_free (sysconfdir);
-  g_free (datadir);
-  g_free (libdir);
+  g_free (pkgsysconfdir);
+  g_free (pkgdatadir);
+  g_free (pkglibdir);
 
   /* initialization required for gtkhtml */
   gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());



More information about the gnucash-changes mailing list