[PATCH][W32] W32 and MSys compatibility

LRN lrn1986 at gmail.com
Sat May 19 16:09:20 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 19.05.2012 23:26, Dan Nicholson wrote:
> On May 19, 2012 10:58 AM, "LRN" <lrn1986 at gmail.com> wrote:
>> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> On 19.05.2012 21:13, LRN wrote:
>>> On 18.05.2012 20:36, Dan Nicholson wrote:
>>>> On Fri, May 18, 2012 at 09:21:08AM -0700, Dan Nicholson
>>>> wrote:
>>>>> On Sat, Mar 31, 2012 at 09:27:54AM +0400, LRN wrote:
>>>>>> 09-fix-pkgconfig-pc-path-on.mingw32.patch: Can't use 
>>>>>> deprecated w32 functions with new glib :( Also leaks a
>>>>>> bit less memory (no that anyone would notice...)
>>>>> 
>>>>> This one is also in bug 45742. I liked your version of the 
>>>>> patch better where a separate symbol was added. However, I
>>>>> like it even more if we always use the symbol and only use
>>>>> the conditional once when it's constructed. I also added a
>>>>> version check for glib in configure to make sure we have a
>>>>> new enough version.
>>>>> 
>>>>> Can you give the attached patch a shot and let me know if
>>>>> it works?
>>> 
>>>> Whoops, I missed a conditional in pkg.c I wanted to fix. Can
>>>> you try this patch?
>>> It compiles (against external glib). And passes all 12 tests.
>>> I'll install the compiled binaries into my buildslave to see
>>> how they work
>> OK, found a silly bug in the patch, here's a patch that fixes
>> your patch.
> 
> Sheesh, good catch. I'll squash that in and commit soon.
> 
> Thanks for trying internal glib too. I tried it on a windows VM and
> hit some problems I didn't feel like investigating. I think libintl
> is unfortunately required on glib, so I think I'll have to add
> back GLIB_WITH_NLS at least. What's happening now is the equivalent
> of --disable-nls since we never define ENABLE_NLS,
Wrong. I get:
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
My guess is that you forgot to re-configure glib after patching it (or
that you forgot to add glib source directory to autogen.sh, here's a
patch for that).
Also, you removed GLIB_GNU_GETTEXT from configure.ac, but left
GLIB_DEFINE_LOCALEDIR intact. GLIB_DEFINE_LOCALEDIR requires
GLIB_GNU_GETTEXT. Here's a patch for that too (you need to add
CPPFLAGS=-DGLIB_LOCALE_DIR=\\\"/share/locale\\\", otherwise it won't
compile; the value itself is only used on W32).
> but clearly there's still code that needs symbols from libintl.
This might be trivially explained. Here's the list of missing symbols:
libintl_bindtextdomain
libintl_bind_textdomain_codeset
libintl_textdomain
libintl_gettext
libintl_dgettext
libintl_dcgettext
libintl_dngettext
Note that the code never calls any of these. However, libintl.h
contains the following defines:
# define bindtextdomain libintl_bindtextdomain
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
# define textdomain libintl_textdomain
# define gettext libintl_gettext
# define dgettext libintl_dgettext
# define dcgettext libintl_dcgettext
# define dngettext libintl_dngettext

while glib "disables" NLS by not including libintl.h and defining instead:
#define textdomain(String) ((String) ? (String) : "messages")
#define gettext(String) (String)
#define dgettext(Domain,String) (String)
#define dcgettext(Domain,String,Type) (String)
#define dngettext(Domain,String1,String2,N) ((N) == 1 ? (String1) :
(String2))
#define bindtextdomain(Domain,Directory) (Domain)
#define bind_textdomain_codeset(Domain,Codeset)

glibintl.h is not included by lots of files. libintl.h, on the other
hand, is only included by ggettext.c, gi18n-lib.h and gi18n.h (and
glibintl.h itself, obviously, when NLS is enabled).

So the problem should be fixable by removing #include <libintl.h> from
ggettext.c, replacing it with #include "glibintl.h". Here's a patch.

That said, when compiled with internal glib, pkg-config unexplainably
crashes on gthread-win32.c:343

> I don't think we can get away from that unless we hack around on
> glib a bit. Can you show the errors you hit? Can you see what
> happens if you shove GLIB_WITH_NLS back into glib/ configure.ac?
> 
> -- Dan
> 


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPuCggAAoJEOs4Jb6SI2CwPdcIAJ1oirmkSGo1REb7PtRr7EBn
9t2Zbo6cTNq1wmrldiZzzNgYCZUgu98Bz2uhbWJmfYmrLZ/TofOpD3p+XQ6BLXSx
m8UJUnh5/5etpXiU1Dsq4Uu1W27twNXH0njlxvqGyp3Qy5IEZjrC4GR1t2/gLfu0
B309XI7VszcS77YlcRhkMfMLZZO3My+AoFta2OZ+p+Ncz1zxwIMwN5/gLhVw84+r
vzeKsenIpSyQtgsje0qG3HvSwWPEYUc6I5JPgT+8PtS20hQbcvUrsp1wAJ+P6b6j
ZE0xO7Bm7HOlunTQGGgwcBIKdqfRwiyg41yHVzdrjiIlklqOIwKr0YY1bw1+LxQ=
=mc4/
-----END PGP SIGNATURE-----
-------------- next part --------------
--- pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/glib/glib/ggettext.c.orig	2012-05-19 21:47:53 +0400
+++ pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/glib/glib/ggettext.c	2012-05-20 00:16:47 +0400
@@ -40,7 +40,7 @@
 
 #include <string.h>
 #include <locale.h>
-#include <libintl.h>
+#include "glibintl.h"
 
 #ifdef G_OS_WIN32
 
-------------- next part --------------
--- pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/autogen.sh.orig	2012-05-20 00:18:07 +0400
+++ pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/autogen.sh	2012-05-20 00:32:29 +0400
@@ -11,6 +11,9 @@
 # Rebuild the autotools for pkg-config
 ${AUTORECONF-autoreconf} -iv || exit $?
 
+cd $srcdir/glib
+${AUTORECONF-autoreconf} -iv || exit $?
+
 cd $ORIGDIR
 
 if [ -z "$NOCONFIGURE" ] && [ "$1" != --no-configure ]; then
-------------- next part --------------
--- pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/glib/configure.ac.orig	2012-05-20 00:33:05 +0400
+++ pkg-config-git-b87359cc9b9039b30ab0f76b67fad52980b7913a/glib/configure.ac	2012-05-20 00:45:28 +0400
@@ -460,8 +460,6 @@
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], 
   [Define the gettext package to be used])
 
-GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
-
 dnl
 dnl Now we are done with gettext checks, figure out ICONV_LIBS
 dnl


More information about the pkg-config mailing list