File gtk-path-local.patch of Package gtk2

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-2.0", NULL);
+    local_dir = g_build_filename ("/usr/local", "lib", "gtk-2.0", NULL);
+  }
   else
+  {
     default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", NULL);
+    local_dir = g_build_filename ("/usr/local", LIB, "gtk-2.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: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -1340,7 +1340,8 @@ AC_SUBST(GDK_EXTRA_LIBS)
 AC_SUBST(GDK_EXTRA_CFLAGS)
 AC_SUBST(GDK_DEP_LIBS)
 AC_SUBST(GDK_DEP_CFLAGS)
-
+LIB=`echo $libdir | sed 's:.*/::'`
+AC_DEFINE_UNQUOTED([LIB],["$LIB"],[Platform dependent tail of libdir.])
 
 ########################################
 # Check for Accessibility Toolkit flags
openSUSE Build Service is sponsored by