gtk3/gtk3-path-local.patch
2011-11-15 09:21:47 +00:00

95 lines
3.3 KiB
Diff

https://bugzilla.novell.com/show_bug.cgi?id=369696
This patch adds support for /usr/local without setting of GTK_PATH.
/usr/local path preference is a behavior expected by FHS.
This patch cannot be upstreamed as is:
- It needs to be platform dependent.
- It needs to solve situation, when prefix != /usr (and maybe add /usr
to the search path, but after the default_dir).
- There is no consensus for /usr/local/lib x /usr/local/lib64 yet.
Defaulting to /usr/local/lib64 may need /usr/local/share/config.site
file (bnc#382344).
Note that the patch it does not provide solution for bi-arch path clash:
http://bugzilla.gnome.org/show_bug.cgi?id=153848
Index: gtk/gtkmodules.c
===================================================================
--- gtk/gtkmodules.c.orig
+++ gtk/gtkmodules.c
@@ -60,6 +60,7 @@ get_module_path (void)
gchar *home_gtk_dir = NULL;
gchar *module_path;
gchar *default_dir;
+ gchar *local_dir;
static gchar **result = NULL;
if (result)
@@ -73,25 +74,32 @@ get_module_path (void)
exe_prefix = g_getenv ("GTK_EXE_PREFIX");
if (exe_prefix)
+ {
default_dir = g_build_filename (exe_prefix, "lib", "gtk-3.0", NULL);
+ local_dir = g_build_filename ("/usr/local", "lib", "gtk-3.0", NULL);
+ }
else
+ {
default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL);
+ local_dir = g_build_filename ("/usr/local", SUSE_HACK_LIB, "gtk-3.0", NULL);
+ }
if (module_path_env && home_gtk_dir)
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- module_path_env, home_gtk_dir, default_dir, NULL);
+ module_path_env, home_gtk_dir, local_dir, default_dir, NULL);
else if (module_path_env)
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- module_path_env, default_dir, NULL);
+ module_path_env, local_dir, default_dir, NULL);
else if (home_gtk_dir)
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- home_gtk_dir, default_dir, NULL);
+ home_gtk_dir, local_dir, default_dir, NULL);
else
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- default_dir, NULL);
+ local_dir, default_dir, NULL);
g_free (home_gtk_dir);
g_free (default_dir);
+ g_free (local_dir);
result = pango_split_file_list (module_path);
g_free (module_path);
Index: gtk/Makefile.am
===================================================================
--- gtk/Makefile.am.orig
+++ gtk/Makefile.am
@@ -32,8 +32,10 @@ endif
endif
endif
+suse_hack_lib=`echo $(libdir) | sed 's:.*/::'`
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gtk\" \
+ -DSUSE_HACK_LIB=\"$(suse_hack_lib)\" \
-DGTK_LIBDIR=\"$(libdir)\" \
-DGTK_DATADIR=\"$(datadir)\" \
-DGTK_DATA_PREFIX=\"$(prefix)\" \
Index: gtk/Makefile.in
===================================================================
--- gtk/Makefile.in.orig
+++ gtk/Makefile.in
@@ -806,8 +806,10 @@ SUBDIRS = a11y . tests
@HAVE_CUPS_FALSE@@HAVE_PAPI_CUPS_FALSE@@HAVE_PAPI_TRUE@GTK_PRINT_BACKENDS = file,papi
@HAVE_CUPS_TRUE@@HAVE_PAPI_CUPS_FALSE@GTK_PRINT_BACKENDS = file,cups
@HAVE_PAPI_CUPS_TRUE@GTK_PRINT_BACKENDS = file,papi,cups
+suse_hack_lib=`echo $(libdir) | sed 's:.*/::'`
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gtk\" \
+ -DSUSE_HACK_LIB=\"$(suse_hack_lib)\" \
-DGTK_LIBDIR=\"$(libdir)\" \
-DGTK_DATADIR=\"$(datadir)\" \
-DGTK_DATA_PREFIX=\"$(prefix)\" \