LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gtk3-path-local.patch of Package gtk3 (Project GNOME:Factory)

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
@@ -55,6 +55,7 @@ get_module_path (void)
   const gchar *exe_prefix;
   gchar *module_path;
   gchar *default_dir;
+  gchar *local_dir;
   static gchar **result = NULL;
 
   if (result)
@@ -64,18 +65,25 @@ 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)
     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-				module_path_env, default_dir, NULL);
+				module_path_env, 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 (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
@@ -48,8 +48,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
@@ -1042,8 +1042,10 @@ SUBDIRS = a11y native .
 @HAVE_CLOUDPRINT_TRUE@@HAVE_CUPS_FALSE@@HAVE_PAPI_CUPS_FALSE@@HAVE_PAPI_TRUE@GTK_PRINT_BACKENDS = file,papi,cloudprint
 @HAVE_CLOUDPRINT_TRUE@@HAVE_CUPS_TRUE@@HAVE_PAPI_CUPS_FALSE@GTK_PRINT_BACKENDS = file,cups,cloudprint
 @HAVE_CLOUDPRINT_TRUE@@HAVE_PAPI_CUPS_TRUE@GTK_PRINT_BACKENDS = file,papi,cups,cloudprint
+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)\"			\