A proper build of GNU libintl is supposed to export the variable

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
This commit is contained in:
Tor Lillqvist 2007-11-28 01:06:07 +00:00 committed by Tor Lillqvist
parent 2159f9c7ca
commit 10825b14b8
3 changed files with 75 additions and 26 deletions

View File

@ -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

View File

@ -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@

View File

@ -67,12 +67,52 @@
#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)
{