]> Pileus Git - ~andy/gtk/commitdiff
A proper build of GNU libintl is supposed to export the variable
authorTor Lillqvist <tml@novell.com>
Wed, 28 Nov 2007 01:06:07 +0000 (01:06 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Wed, 28 Nov 2007 01:06:07 +0000 (01:06 +0000)
2007-11-28  Tor Lillqvist  <tml@novell.com>

A proper build of GNU libintl is supposed to export the variable
_nl_msg_cat_cntr. configure looks for that variable in order to
recognize GNU gettext. If it sees that it is indeed GNU gettext
that is used, it decides to install message catalogs in
share/locale, otherwise in lib/locale. Until now on Windows I have
built GTK+ against a build of GNU gettext that did not export
_nl_msg_cat_cntr. But this will change, so we can't assume message
catalogs are always in lib/locale.

* gtk/gtkmain.c: (_gtk_get_localedir) [Win32]: Rework to handle
GTK_LOCALEDIR being either in "lib" or "share". Move the function
before the inclusion of gtkprivate.h so that it sees the original
GTK_LOCALEDIR.

* gtk-zip.sh.in: Check whether the message catalogs are in
share/locale or lib/locale.

svn path=/trunk/; revision=19083

ChangeLog
gtk-zip.sh.in
gtk/gtkmain.c

index 7c141eb9daeab43cbda9bf566b5b7303705852ab..188bf1be21a1b2510719ab59e11699cde663fa2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-11-28  Tor Lillqvist  <tml@novell.com>
+
+       A proper build of GNU libintl is supposed to export the variable
+       _nl_msg_cat_cntr. configure looks for that variable in order to
+       recognize GNU gettext. If it sees that it is indeed GNU gettext
+       that is used, it decides to install message catalogs in
+       share/locale, otherwise in lib/locale. Until now on Windows I have
+       built GTK+ against a build of GNU gettext that did not export
+       _nl_msg_cat_cntr. But this will change, so we can't assume message
+       catalogs are always in lib/locale.
+
+       * gtk/gtkmain.c: (_gtk_get_localedir) [Win32]: Rework to handle
+       GTK_LOCALEDIR being either in "lib" or "share". Move the function
+       before the inclusion of gtkprivate.h so that it sees the original
+       GTK_LOCALEDIR.
+
+       * gtk-zip.sh.in: Check whether the message catalogs are in
+       share/locale or lib/locale.
+
 2007-11-28  Tor Lillqvist  <tml@novell.com>
 
        * gtk/Makefile.am: Improve portability. The -o option is present
index f32c10e3e42a9af22b47fe54a072212666a5d119..8cd89a90f233ebfb471ce42b426e496f288aa3f4 100755 (executable)
@@ -14,7 +14,6 @@ cp -p @abs_srcdir@/COPYING share/doc/gtk+-dev-@GTK_VERSION@
 
 rm $ZIP
 zip $ZIP -@ <<EOF
-COPYING.LIB-2
 etc/gtk-2.0/gdk-pixbuf.loaders
 etc/gtk-2.0/gtkrc
 etc/gtk-2.0/gtk.immodules
@@ -32,8 +31,21 @@ zip $ZIP share/themes/Default/gtk-2.0-key/gtkrc
 zip $ZIP share/themes/Emacs/gtk-2.0-key/gtkrc
 zip $ZIP share/themes/MS-Windows/gtk-2.0/gtkrc
 
-zip $ZIP lib/locale/*/LC_MESSAGES/gtk20.mo
-zip $ZIP lib/locale/*/LC_MESSAGES/gtk20-properties.mo
+if [ -f lib/locale/de/LC_MESSAGES/gtk20.mo -a -f share/locale/de/LC_MESSAGES/gtk20.mo ]; then
+  if [ lib/locale/de/LC_MESSAGES/gtk20.mo -nt share/locale/de/LC_MESSAGES/gtk20.mo ]; then
+    zip -r $ZIP lib/locale/*/LC_MESSAGES/gtk20.mo
+    zip -r $ZIP lib/locale/*/LC_MESSAGES/gtk20-properties.mo
+  else
+    zip -r $ZIP share/locale/*/LC_MESSAGES/gtk20.mo
+    zip -r $ZIP share/locale/*/LC_MESSAGES/gtk20-properties.mo
+  fi
+elif [ -f lib/locale/de/LC_MESSAGES/gtk20.mo ]; then
+  zip -r $ZIP lib/locale/*/LC_MESSAGES/gtk20.mo
+  zip -r $ZIP lib/locale/*/LC_MESSAGES/gtk20-properties.mo
+else
+  zip -r $ZIP share/locale/*/LC_MESSAGES/gtk20.mo
+  zip -r $ZIP share/locale/*/LC_MESSAGES/gtk20-properties.mo
+fi
 
 zip -r $ZIP share/doc/gtk+-@GTK_VERSION@
 
index c645a084e46d18c544c1a590e5e14047eef9ddb3..b09afc3c3f4971264e14e80ba01c3c62089210eb 100644 (file)
 #include "gtkwidget.h"
 #include "gtkwindow.h"
 #include "gtktooltip.h"
-#include "gtkprivate.h"
 #include "gtkdebug.h"
 #include "gtkalias.h"
 
 #include "gdk/gdkprivate.h" /* for GDK_WINDOW_DESTROYED */
 
+#ifdef G_OS_WIN32
+
+G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
+
+/* This here before inclusion of gtkprivate.h so that it sees the
+ * original GTK_LOCALEDIR definition. Yeah, this is a bit sucky.
+ */
+const gchar *
+_gtk_get_localedir (void)
+{
+  static char *gtk_localedir = NULL;
+  if (gtk_localedir == NULL)
+    {
+      const gchar *p;
+      gchar *temp;
+      
+      /* GTK_LOCALEDIR ends in either /lib/locale or
+       * /share/locale. Scan for that slash.
+       */
+      p = GTK_LOCALEDIR + strlen (GTK_LOCALEDIR);
+      while (*--p != '/')
+       ;
+      while (*--p != '/')
+       ;
+
+      temp = g_win32_get_package_installation_subdirectory
+        (GETTEXT_PACKAGE, dll_name, p);
+
+      /* gtk_localedir is passed to bindtextdomain() which isn't
+       * UTF-8-aware.
+       */
+      gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
+      g_free (temp);
+    }
+  return gtk_localedir;
+}
+
+#endif
+
+#include "gtkprivate.h"
+
 /* Private type definitions
  */
 typedef struct _GtkInitFunction                 GtkInitFunction;
@@ -268,8 +308,6 @@ check_setugid (void)
 
 #ifdef G_OS_WIN32
 
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
-
 const gchar *
 _gtk_get_datadir (void)
 {
@@ -292,26 +330,6 @@ _gtk_get_libdir (void)
   return gtk_libdir;
 }
 
-const gchar *
-_gtk_get_localedir (void)
-{
-  static char *gtk_localedir = NULL;
-  if (gtk_localedir == NULL)
-    {
-      gchar *temp;
-      
-      temp = g_win32_get_package_installation_subdirectory
-        (GETTEXT_PACKAGE, dll_name, "lib\\locale");
-
-      /* gtk_localedir is passed to bindtextdomain() which isn't
-       * UTF-8-aware.
-       */
-      gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
-      g_free (temp);
-    }
-  return gtk_localedir;
-}
-
 const gchar *
 _gtk_get_sysconfdir (void)
 {