summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2010-07-08 15:51:33 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2010-07-08 15:55:41 -0400
commite94a21a9b52a5b9f9e4a5f1e19f9c84a16bf2838 (patch)
tree7b2766bfb8c9be553d024c99443b66da8997eb88
parent3743d1c82066ecd4f8d6d6fba993b15fcc8d9773 (diff)
downloadpango-e94a21a9b52a5b9f9e4a5f1e19f9c84a16bf2838.tar.gz
Add PANGO_LIBDIR and PANGO_SYSCONFDIR enviroment variables
Add environment variables to override the compile time values for the libdir and sysconfdir. This provides additional flexibility and enables using a static pango.modules file for libraries packaged with an application on OS X by setting environment variables at application startup and using paths of the form: @executable_path/../lib/pango/modules/.. in the modules file. https://bugzilla.gnome.org/show_bug.cgi?id=554524
-rw-r--r--pango/pango-utils.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 100dbc7a..1e10448c 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -692,19 +692,23 @@ DllMain (HINSTANCE hinstDLL,
G_CONST_RETURN char *
pango_get_sysconf_subdirectory (void)
{
-#ifdef G_OS_WIN32
- static gchar *result = NULL;
+ static const gchar *result = NULL;
if (result == NULL)
{
+#ifdef G_OS_WIN32
gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
result = g_build_filename (root, "etc\\pango", NULL);
g_free (root);
- }
- return result;
#else
- return SYSCONFDIR "/pango";
+ const char *sysconfdir = g_getenv ("PANGO_SYSCONFDIR");
+ if (sysconfdir != NULL)
+ result = g_build_filename (sysconfdir, "pango", NULL);
+ else
+ result = SYSCONFDIR "/pango";
#endif
+ }
+ return result;
}
/**
@@ -721,11 +725,11 @@ pango_get_sysconf_subdirectory (void)
G_CONST_RETURN char *
pango_get_lib_subdirectory (void)
{
-#ifdef G_OS_WIN32
static gchar *result = NULL;
if (result == NULL)
{
+#ifdef G_OS_WIN32
gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
/* If we are running against an uninstalled copy of the Pango DLL,
* use the compile-time installation prefix.
@@ -735,11 +739,15 @@ pango_get_lib_subdirectory (void)
else
result = g_build_filename (root, "lib\\pango", NULL);
g_free (root);
- }
- return result;
#else
- return LIBDIR "/pango";
+ const char *libdir = g_getenv ("PANGO_LIBDIR");
+ if (libdir != NULL)
+ result = g_build_filename (libdir, "pango", NULL);
+ else
+ result = LIBDIR "/pango";
#endif
+ }
+ return result;
}