Tweaking autotools-based buildsystem for W32 compatibility

LRN lrn1986 at gmail.com
Tue Mar 18 20:43:58 EDT 2014


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

On 18.03.2014 17:14, Tomasz Wasilczyk wrote:
> W dniu 18.03.2014 13:54, LRN pisze:
>> Anyway, i've successfully built 2.x.y and 3.0.0 on W32 with 
>> autotools, which resulted in a heap of patches on my side (~44 
>> for 3.0.0, ~48 for 2.x.y). How do i go about submitting them? 
>> Usually projects frown upon attaching so many patches to one 
>> bugreport/issue/ticket, but creating 40+ tickets (maybe 10+, if
>> i group patches intelligently; that's still a bit too much, IMO) 
>> seems like a bad move too. Especially since some patches may not 
>> be committable as-is (i'm not always patient enough to come up 
>> with a change that fixes the issue for me and does not break 
>> anything for everyone else).
> 
> I'm glad to hear about your work, because this task was already on 
> my own TODO. I think, you can submit those patches on this list. 
> Creating a bunch of tickets may make it pretty hard to follow.

OK, here goes nothing...
I'll try to provide descriptions here, since patches themselves are
just `diff -u's.

Patches are packed because list moderator, apparently, doesn't approve
of messages larger than 100k, even if it's 100k of patches requested
by the developers.

0002-use-gtkspell3.all.patch:
Should be pretty obvious.
I've made this patch for 2.x.y (actually, ~50% of these patches were
for 2.x.y before i decided to try out 3.0.0 and had to convert them
for 3.0.0), and it made sense there (it still didn't quite work at
runtime, but i never got around to fixing that). Here it's pretty much
useless, since webkit webview uses its own spellchecker (which doesn't
work for me, by the way, but that's another matter entirely) and
gtkspell setup functions are never ever called. Still, if you ever
decide to roll input fields back to gtktextview, this patch may come
in handy.
I've also left alone the abhorrent practice of loading functions from
dlls at runtime, even though in fully-linked build it isn't needed.

0006-include-win32-for-ssl.all.patch:
0009-more-include-win32.all.patch:
Basically, everything includes a header that includes w32-specific
headers, so everything needs the w32 include directory in -I. Since
w32-specific headers have distinctive, unique names, this shouldn't
break anything for other platforms

0008-appropriate-socket-header-checks.all.patch:
Check for socket-related headers and include them conditionally in tests.

0012-jabber.all.patch:
Added OS_W32 automake conditional, it will be used here and later on
to add W32-specific makefile parts.

0013-mxit-stdint.all.patch:
Apparently, it needs that. Don't remember the error it gave me without
stdint.

0014-dont-use-non-standard-caddr_t.all.patch:
This patch is useless, since zephyr is not ported anyway. But i didn't
know that when i've made this patch, so here's a patch that removes
the use of non-standard (and non-existent on W32) type caddr_t.

0016-check-for-gettimeofday.all.patch:
gettimeofday is available in MinGW-w64, do check for it.

0019-fix-ifdefs.all.patch:
'rc' is used for getaddrinfo-related AND for IDN-related code, fix
ifdefs to match that.

0020-add-w32-files.all.patch:
Compile libpurple with extra w32 source files.

0021-add-inet-pton-to-w32-compat.all.patch:
Adds an implementation of inet_pton() and inet_pton6(). Debatable, but
i like to have real code that i can debug.

0022-dont-error-on-aton-detection-failure.all.patch:
Actually, now that i'm re-reading this again, this can be vastly
improved: inet_aton is an alternative to getaddrinfo, so configure
should take that into account. Getaddrinfo check should be fixed to
work on W32 (use the same try-compile-and-link test as for other
network features, see below). This patch is therefore just a fast hack
to allow configure to finish.

0023-check-for-socket.all.patch:
ws2_32 uses stdcall convention, autoconf lib checks don't work with
it, you have to use the actual prototype (from the real header) to end
up with a correct function name. Therefore most W32 API checks
(usually for winsock, one of the few parts of W32 API that is
name-compatible with POSIX) need to be compiled and linked with real
headers.

0024-dont-fail-if-ssl-dir-does-not-exist.all.patch:
This is purely for my own purposes. Since i prefer binaries to be
relocatable, hardcoding absolute ssl cert directory makes no sense,
therefore ssl directory is, in fact, a path relative to the location
where libpurple will be installed. Therefore configure shouldn't fail
when it doesn't exist.

0025-dont-pass-directories-in-cppflags.all.patch:
0029-correct-runtime-paths.all.patch:
Passing quoted strings via commandline is tricky, and on W32 these are
not used anyway. Also, MSYS mangles paths passed via commandline. So
i've just scrapped all that and put paths into configure.h

Now, for non-W32 platforms that the end of it. But W32 uses runtime
path detection. Now, i extremely dislike non-standard directory
layouts, and i dislike it when configure-set paths are ignored. So
i've added optional XDG-compliant (more or less) path detection code
(actually, it's the other way around - the old code is now optional,
you need to define PURPLE_USE_WINPATHS to enable it, while the default
is XDG).

Anyway, this is how things work now:
CONFIG_${directoryname} macros are set to what configure has
(${datadir}, ${libdir}, etc). These are expanded into real paths all
the way to the end.
PURPLE_${directoryname} macros are platform-dependent:
on W32 they are calls to wpurple_..._dir()
on other platforms they are the same as CONFIG_${directoryname}

At runtime W32 purple will get runtime root directory, then compare
CONFIG_${directoryname} to CONFIG_PREFIX, to see if it starts with a
prefix. If it does, purple will strip the prefix, append the result to
runtime root, and use that. If it doesn't, purple will append it to
runtime root as-is and use that.

Code everywhere now uses PURPLE_*DIR macros, and always keeps in mind
that this macro may be a function call that returns const char *.

Another related change is the use of PNG icons. Now you need to define
the DONT_USE_NICE_PNG_ICON_AS_DEFAULT macro to prevent libpidgin from
using those.

One really bad change it does is that it makes check_libpurple.c
generatable, because it refers to top_builddir.

As noted in earlier patches, SSL_CERTIFICATES_DIR is now allowed to be
relative on W32, and is actually used there.


0026-link-to-dnsapi.all.patch:
On W32 libpurple needs W32 libdnsapi, so link to it.

0027-nullclient-getpass.all.patch:
Just to make it compile, code copied from glib examples.

0030-signal-compat.all.patch:
there's signal.h in mingw-w64, but it doesn't do what you think it
does. Ignore it.

0031-build-with-win32-sources.all.patch:
Same as 0020-add-w32-files.all.patch earlier.
Also W32 pidgin requires zlib.

0033-mingw-ansi-printf.all.patch:
Use mingw ansi printf, which is more compatible than MS printf.

0035-no-stubs-no-init.all.patch:
These types are needed only if USE_TCL_STUBS

0037-fix-gg-protocol-to-compile-with-mingw.all.patch:
Need to include this header in GG.

0041-no-undefined-on.all.patch:
I've read somewhere that -no-undefined works only on W32, so adding it
will not affect other platforms. I have not had an opportunity to
confirm that.
Anyway, -no-undefined is always needed for shared libs on W32.

0042-dependencies.all.patch:
Plugins need to link to libpurple and (sometimes) libpidgin. Therefore
libpurple and libpidgin must be built BEFORE plugins (hence the
SUBDIRS change).
As a side-note, this was even weirder in 2.x.y, where you didn't build
libpidgin at all. I've had to make pidgin.exe export its functions,
crafted a custom import library that links to it, and linked pidgin
plugins to pidgin.exe.

0043-more-gg-fixes.all.patch:
This is from 2.x.y, i'm not sure it's still needed.

0044-more-win32dep-fixes.all.patch:
Since mingw ansi stdio is used, these defines break everything
horribly. Not sure how MSVC-compatible this will be, needs research.

0045-no-silent-libtool.all.patch:
Since the advent of silent-rules, silencing libtool is absolutely useless.

0046-no-need-for-dbus-glib.mingw.patch:
This is unfinished port to GDbus. Eventually i've had to configure
with --disable-dbus.

0047-correctly-call-mkenums.all.patch:
I'm not sure how correct this is, but it generates certain files in
srcdir now, since they depend on other files in srcdir. This all
started when the program that generates files failed to find some
headers, and escalated into this patch.

0048-link-http-to-zlib.all.patch:
Need zlib for http compression.

0049-dont-access-gtkwidget-props-directly.all.patch:
0050-dont-access-gdkwindow-props-directly.all.patch:
Port to GTK+-3.x

0051-define-before-using.all.patch:
Move stuff around, use GObject instead of GtkObject.

0052-dont-access-buddy-fields-directly.all.patch:
Port to modern libpurple

0053-extplacement-depends-on-perl.all.patch:
This extension depends on W32 perl, which i don't have.

0054-explicitly-scan-version-h-and-purple-h.all.patch:
These files are generated in builddir, point gtk-doc at them.

0055-shared-libpiding.all.patch:
s/piding/pidgin/
This is needed to make libpidgin shared, which creates an import
library for it, which allows us to link plugins to it normally
(without this patch each plugin gets its own libpidgin statically
compiled into it; ouch!)

0056-wchar-format-and-dont-assume-bslash.all.patch:
MS printf uses %s for "char *" and %S for "wchar_t *" in printf, but
%s for "wchar_t *" and %S for "char *" in wprintf. MinGW ANSI printf
uses %S for wchar and %s for char, always.
This patch also fixes path handling (does not assume that path only
uses backslashes as separators).

0057-link-to-pidgin-dll.all.patch:
This is a hack (since pidgin.exe is linked to libpidgin, it does not
need to load anything dynamically).

0058-rename-pidgin-to-pidgin3.all.patch:
Purely for my convenience (since i did have pidgin-2.x.y built as well).

0059-preprocess-pidgin-rc.all.patch:
Obvious.

0060-remove-crazy-dll-loading-code.all.patch:
This is a hack. My build is fully-linked, so this code is not needed.
Also, i'm still not sure why someone thought it was a good idea to put
dlls into separate-from-where-exe-file-is-and-not-normally-in-PATH
directory.

0061-build-wincred.all.patch:
Fix keyring linkage (i hoped that secret keyring will be built (i did
compile libsecret), but it wasn't ported), enable wincred keyring in
makefiles.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJTKOhFAAoJEOs4Jb6SI2Cw5NkH/RWeEEiXa5NJZ9UzjJ6MXGru
1sYUfR7MMhu5gndxFvqPv3Fr5bQM15mjaNjkYGDHvm9BhpNe093GXeoK+rxmwJls
2mYwzAGEl/ZEV2Y498xPK+uAYw80XxJCsTNSacpfVF17pzoJsJ37hlbiZmPMk9iU
xF6FsXEgeqrqNdS7Jo8pfrYD/1mHttqPW176kSdbu0fzMyeObYeCJ8Tm1pSd1Sdl
XzACjKOFqd6NrIYab6DUtn/pKksF4x6lDETVhpRA5tg1JvAq5XBpOtstIkVkhJ/V
nE+eqmC+yvtdv5bSLmpKEQ4oCc3v31sVP9td3Emnn2vqSJpj8a5BVTPrdOFTVl8=
=UPlw
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patches.tar.xz
Type: application/octet-stream
Size: 29732 bytes
Desc: not available
URL: <https://pidgin.im/pipermail/devel/attachments/20140319/44f840b7/attachment-0001.obj>


More information about the Devel mailing list