On Wed, Jan 17, 2007, Goswin von Brederlow wrote: > To get ia32-libs-gtk working properly chunks 1+2 of the patch need to > be applied. Chunks 3+4 just round things up by allowing the admin and > user to have different gtkrc files if they so choose.
I've started looking into the problem last week, and it's relatively complex. Actually, for module pathes, Gtk will try plenty of pathes (as you might have seen in straces), so either we support a diversion of all of these (such as /etc/gtk-2.0/$host => /etc/gtk-2.0/$host.32), or we simply advice people to move away of these pathes (by default, a path including the triplet is checked). I've given some thought on how to handle this, and I don't want to spam all users with a fat NEWS.Debian, so I thought simply supporting diversions for what Debian ever shipped is enough (in /etc/gtk: gdk.loaders and gtk.immodules), and we shouldn't bother with supporting anything else at the code level, but this should be documented in README.Debian. I think this is particularly true for ~/.gtk-2.0 modules as I can imagine users compiling an IM method if they need one. I doubt changing the lookups in /usr/lib is useful, however I did not have time to look at all getenv calls to see whether or not some modules can be forcibly loaded without a full path via env vars. I'm not sure about handling of gtkrc, what made you customize this one? The possibility of loading modules from gtkrc? > +# if defined (__i386__) > + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "32", > "gdk-pixbuf.loaders", NULL); > +# else > + if (! g_access(result, R_OK)) I've collected patches from all other distros last week, and while they all use different names, I would prefer we use one of the existing names. Ubuntu: GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders.32", OpenSuse: GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf64.loaders" Fedora: GTK_SYSCONFDIR, "gtk-2.0", HOST, "gdk-pixbuf.loaders" (-DHOST=\"$(host_triplet)\") (BTW, Fedora uses a slightly nicer test:) g_file_test (result, G_FILE_TEST_EXISTS) The patches are attached. My personal preference goes for the Ubuntu option, but the Fedora one might be the best as it re-uses a path which is already handled by Gtk, the only difference is that the path is preferred when present and no further path is used; this might be problematic with the default location of the loaders which we currently use, and it's too late to change it for this cycle. -- Loïc Minier <[EMAIL PROTECTED]>
--- gtk+-2.8.13/gdk-pixbuf/gdk-pixbuf-io.c~ 2005-10-03 17:11:49.000000000 +0200 +++ gtk+-2.8.13/gdk-pixbuf/gdk-pixbuf-io.c 2006-03-01 20:33:36.524552192 +0100 @@ -32,6 +32,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#include <sys/utsname.h> #include "gdk-pixbuf-private.h" #include "gdk-pixbuf-io.h" @@ -276,8 +277,21 @@ gchar *result = g_strdup (g_getenv ("GDK_PIXBUF_MODULE_FILE")); if (!result) - result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders", NULL); +#if defined(__linux__) && defined (__i386__) + { + struct utsname uts; + uname(&uts); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders.32", NULL); + if (strcmp("x86_64", uts.machine) || access(result, R_OK)) + { + g_free(result); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders", NULL); + } + } +#else + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders", NULL); +#endif return result; } --- gtk+-2.8.13/gtk/gtkprivate.h~ 2005-03-22 03:14:55.000000000 +0100 +++ gtk+-2.8.13/gtk/gtkprivate.h 2006-03-01 19:51:42.510740384 +0100 @@ -96,6 +96,13 @@ #endif /* G_OS_WIN32 */ +#if defined(__linux__) && defined (__i386__) +const gchar *_gtk_get_libdir (); + +#undef GTK_LIBDIR +#define GTK_LIBDIR _gtk_get_libdir () +#endif + gboolean _gtk_fnmatch (const char *pattern, const char *string, gboolean no_leading_period); --- gtk+-2.8.13/gtk/gtkmain.c~ 2005-12-06 17:14:30.000000000 +0100 +++ gtk+-2.8.13/gtk/gtkmain.c 2006-03-01 20:36:05.175953744 +0100 @@ -42,6 +42,7 @@ #include <unistd.h> #endif #include <sys/types.h> /* For uid_t, gid_t */ +#include <sys/utsname.h> #ifdef G_OS_WIN32 #define STRICT @@ -336,6 +337,28 @@ #endif /* G_OS_WIN32 */ +#if defined(__linux__) && defined (__i386__) +const gchar * +_gtk_get_libdir (void) +{ + static char *gtk_libdir = NULL; + if (gtk_libdir == NULL) + { +#if defined(__linux__) && defined (__i386__) + struct utsname uts; + + uname(&uts); + if (!strcmp("x86_64", uts.machine) + && !access("/usr/lib32/gtk-2.0", R_OK|X_OK)) + gtk_libdir = "/usr/lib32"; + else +#endif + gtk_libdir = "/usr/lib"; + } + return gtk_libdir; +} +#endif + static gboolean do_setlocale = TRUE; /** --- gtk+-2.8.13/gtk/gtkrc.c~ 2005-11-23 15:24:51.000000000 +0100 +++ gtk+-2.8.13/gtk/gtkrc.c 2006-03-01 20:33:25.952159440 +0100 @@ -38,6 +38,10 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <sys/utsname.h> #include <glib.h> @@ -364,7 +368,21 @@ if (im_module_file) result = g_strdup (im_module_file); else +#if defined(__linux__) && defined (__i386__) + { + struct utsname uts; + + uname(&uts); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules.32", NULL); + if (strcmp("x86_64", uts.machine) || access(result, R_OK)) + { + g_free(result); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL); + } + } +#else result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL); +#endif } return result;
--- gtk+-2.10.6/demos/Makefile.am +++ gtk+-2.10.6/demos/Makefile.am @@ -38,8 +38,8 @@ pixbuf_csource=$(GDK_PIXBUF_CSOURCE) pixbuf_csource_deps= else -pixbuf_csource=GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/gdk-pixbuf.loaders $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource -pixbuf_csource_deps=$(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(top_builddir)/gdk-pixbuf/gdk-pixbuf.loaders +pixbuf_csource=GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/gdk-pixbuf64.loaders $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource +pixbuf_csource_deps=$(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(top_builddir)/gdk-pixbuf/gdk-pixbuf64.loaders endif test-inline-pixbufs.h: $(pixbuf_csource_deps) apple-red.png gnome-foot.png --- gtk+-2.10.6/gdk-pixbuf/Makefile.am +++ gtk+-2.10.6/gdk-pixbuf/Makefile.am @@ -359,7 +359,7 @@ gdk-pixbuf-enum-types.c \ gdk-pixbuf-marshal.h \ gdk-pixbuf-marshal.c \ - gdk-pixbuf.loaders + gdk-pixbuf64.loaders # # gdk-pixbuf-enum-types.h @@ -467,10 +467,10 @@ install-data-hook: install-ms-lib install-def-file @if $(RUN_QUERY_LOADER_TEST) ; then \ $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \ - $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders > $(DESTDIR)$(sysconfdir)/gtk-2.0/gdk-pixbuf.loaders ; \ + $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders > $(DESTDIR)$(sysconfdir)/gtk-2.0/gdk-pixbuf64.loaders ; \ else \ echo "***" ; \ - echo "*** Warning: gdk-pixbuf.loaders not built" ; \ + echo "*** Warning: gdk-pixbuf64.loaders not built" ; \ echo "***" ; \ echo "*** Generate this file manually on host" ; \ echo "*** system using gdk-pixbuf-query-loaders" ; \ @@ -478,25 +478,25 @@ fi uninstall-local: uninstall-ms-lib uninstall-def-file - rm -f $(DESTDIR)$(sysconfdir)/gtk-2.0/gdk-pixbuf.loaders + rm -f $(DESTDIR)$(sysconfdir)/gtk-2.0/gdk-pixbuf64.loaders if CROSS_COMPILING else -all-local: gdk-pixbuf.loaders +all-local: gdk-pixbuf64.loaders endif if BUILD_DYNAMIC_MODULES -gdk-pixbuf.loaders: $(loader_LTLIBRARIES) gdk-pixbuf-query-loaders$(EXEEXT) +gdk-pixbuf64.loaders: $(loader_LTLIBRARIES) gdk-pixbuf-query-loaders$(EXEEXT) LOADERS=`echo libpixbufloader-*.la` ; \ if test "x$$LOADERS" != 'xlibpixbufloader-*.la' ; then \ echo "Writing a gdk-pixbuf.loader file to use when running examples before installing gdk-pixbuf."; \ - $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders $$LOADERS > ./gdk-pixbuf.loaders ;\ + $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders $$LOADERS > ./gdk-pixbuf64.loaders ;\ else \ echo "No dynamic modules found; will use only static modules for uninstalled example programs."; \ - touch gdk-pixbuf.loaders; \ + touch gdk-pixbuf64.loaders; \ fi else -gdk-pixbuf.loaders: +gdk-pixbuf64.loaders: echo "No dynamic modules found; will use only static modules for uninstalled example programs."; \ - touch gdk-pixbuf.loaders; + touch gdk-pixbuf64.loaders; endif --- gtk+-2.10.6/gdk-pixbuf/gdk-pixbuf-io.c +++ gtk+-2.10.6/gdk-pixbuf/gdk-pixbuf-io.c @@ -258,7 +258,7 @@ { /* This is an entry put there by gdk-pixbuf-query-loaders on the * packager's system. On Windows a prebuilt GTK+ package can be - * installed in a random location. The gdk-pixbuf.loaders file + * installed in a random location. The gdk-pixbuf64.loaders file * distributed in such a package contains paths from the package * builder's machine. Replace the build-time prefix with the * installation prefix on this machine. @@ -277,7 +277,7 @@ gchar *result = g_strdup (g_getenv ("GDK_PIXBUF_MODULE_FILE")); if (!result) - result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders", NULL); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf64.loaders", NULL); return result; } --- gtk+-2.10.6/gtk/Makefile.am +++ gtk+-2.10.6/gtk/Makefile.am @@ -842,7 +842,7 @@ DEPS = $(gtktargetlib) $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la $(top_builddir)/gdk/$(gdktargetlib) -TEST_DEPS = $(DEPS) gtk.immodules +TEST_DEPS = $(DEPS) gtk64.immodules LDADDS = \ $(gtktargetlib) \ @@ -1117,7 +1117,7 @@ gtkbuiltincache.h: @REBUILD@ stamp-icons $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT) - GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/gdk-pixbuf.loaders \ + GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/gdk-pixbuf64.loaders \ ./gtk-update-icon-cache --force --ignore-theme-index \ --source builtin_icons stock-icons > gtkbuiltincache.h --- gtk+-2.10.6/gtk/gtkmodules.c +++ gtk+-2.10.6/gtk/gtkmodules.c @@ -69,7 +69,7 @@ if (home_dir) home_gtk_dir = g_build_filename (home_dir, ".gtk-2.0", NULL); - module_path_env = g_getenv ("GTK_PATH"); + module_path_env = g_getenv ("GTK_PATH64"); exe_prefix = g_getenv ("GTK_EXE_PREFIX"); if (exe_prefix) --- gtk+-2.10.6/gtk/gtkrc.c +++ gtk+-2.10.6/gtk/gtkrc.c @@ -447,7 +447,7 @@ if (im_module_file) result = g_strdup (im_module_file); else - result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL); + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk64.immodules", NULL); } return result; --- gtk+-2.10.6/modules/input/Makefile.am +++ gtk+-2.10.6/modules/input/Makefile.am @@ -102,11 +102,11 @@ @if $(RUN_QUERY_IMMODULES_TEST) ; then \ echo $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \ $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/gtk-2.0 ; \ - echo "$(top_builddir)/gtk/gtk-query-immodules-2.0 > $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk.immodules" ; \ - $(top_builddir)/gtk/gtk-query-immodules-2.0 > $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk.immodules ; \ + echo "$(top_builddir)/gtk/gtk-query-immodules-2.0 > $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk64.immodules" ; \ + $(top_builddir)/gtk/gtk-query-immodules-2.0 > $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk64.immodules ; \ else \ echo "***" ; \ - echo "*** Warning: gtk.immodules not built" ; \ + echo "*** Warning: gtk64.immodules not built" ; \ echo "***" ; \ echo "*** Generate this file manually on host" ; \ echo "*** system using gtk-query-immodules-2.0" ; \ @@ -114,7 +114,7 @@ fi uninstall-local: - rm -f $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk.immodules + rm -f $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk64.immodules module_LTLIBRARIES = \ $(IM_XIM_MODULE) \ @@ -129,12 +129,12 @@ im-viqr.la \ $(IM_IME_MODULE) -gtk.immodules: Makefile.am $(module_LTLIBRARIES) - $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > gtk.immodules +gtk64.immodules: Makefile.am $(module_LTLIBRARIES) + $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > gtk64.immodules -CLEANFILES = gtk.immodules +CLEANFILES = gtk64.immodules if CROSS_COMPILING else -all-local: gtk.immodules +all-local: gtk64.immodules endif
--- gtk+-2.6.0/gdk-pixbuf/gdk-pixbuf-io.c.lib64 2004-12-21 14:33:41.296252000 -0500 +++ gtk+-2.6.0/gdk-pixbuf/gdk-pixbuf-io.c 2004-12-21 14:35:57.858554000 -0500 @@ -258,7 +258,17 @@ gchar *result = g_strdup (g_getenv ("GDK_PIXBUF_MODULE_FILE")); if (!result) - result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gdk-pixbuf.loaders", NULL); + { + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", + HOST, "gdk-pixbuf.loaders", NULL); + if (!g_file_test (result, G_FILE_TEST_EXISTS)) + { + g_free (result); + + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", + "gdk-pixbuf.loaders", NULL); + } + } return result; } --- gtk+-2.6.0/gdk-pixbuf/Makefile.am.lib64 2004-12-21 14:33:49.952587000 -0500 +++ gtk+-2.6.0/gdk-pixbuf/Makefile.am 2004-12-21 14:34:45.644839000 -0500 @@ -274,6 +274,7 @@ -I$(top_srcdir)/gdk-pixbuf \ -I$(top_builddir)/gdk-pixbuf \ -DGTK_SYSCONFDIR=\"$(sysconfdir)\" \ + -DHOST=\"$(host_triplet)\" \ -DGTK_VERSION=\"$(GTK_VERSION)\" \ -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \ -DG_DISABLE_DEPRECATED \ --- gtk+-2.6.0/gtk/gtkrc.c.lib64 2004-12-21 14:34:02.909617000 -0500 +++ gtk+-2.6.0/gtk/gtkrc.c 2004-12-21 14:36:39.265106000 -0500 @@ -377,7 +377,17 @@ if (im_module_file) result = g_strdup (im_module_file); else - result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL); + { + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", GTK_HOST, + "gtk.immodules", NULL); + if (!g_file_test (result, G_FILE_TEST_EXISTS)) + { + g_free (result); + + result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", + "gtk.immodules", NULL); + } + } } #ifdef G_OS_WIN32