Proposal: drop the hard dependency on mingw32-gettext from mingw32-glib2

Erik van Pienbroek erik at vanpienbroek.nl
Tue Oct 12 10:58:39 UTC 2010


Hi,

Recently I was browsing the upstream GTK website and I noticed that
upstream has used a special trick to build the Win32 binaries for GLib.

In order to make the dependency on gettext a soft one they used a small
static wrapper library called libproxy-intl [1]. With this wrapper
library the GLib DLL doesn't depend directly anymore on libintl-8.dll
(from mingw32-gettext). The wrapper library makes the hard dependency a
runtime one. This means that if libintl-8.dll is bundled with the
application then gettext translations will be used, otherwise nothing
gets translated.

I'd like to propose that we apply this change as well in our Fedora
MinGW toolchain.

Such a change consists of the following smaller changes:
- Bundle the libproxy-intl code (1 .c file and 1 .h file) in
  the mingw32-gettext srpm as additional source files
- Compile the libproxy-intl code with these 2 instructions:
    %{_mingw32_cc} -c libintl.c -o libintl.o -I.
    %{_mingw32_ar} rc libintl.a libintl.o
- Replace the files libintl.{a,.dll.a,.la} generated by the
  gettext compilation with the libintl.a file from libproxy-intl.
  This makes any binary which tries to link against mingw32-gettext
  using '-lintl' have a soft-dependency on libintl.

After this a simple rebuild of mingw32-glib2 should be sufficient enough
to make mingw32-gettext a soft dependency.

Next to glib2 there are also some other packages which have a hard
dependency on libintl-8.dll:

$ repoquery --whatrequires 'mingw32(libintl-8.dll)'
mingw32-atk-0:1.32.0-1.fc14.noarch
mingw32-gdk-pixbuf-0:2.22.0-1.fc14.noarch
mingw32-glib2-0:2.26.0-1.fc14.noarch
mingw32-gnutls-0:2.6.4-3.fc13.noarch
mingw32-gtk-vnc-0:0.4.1-1.fc14.noarch
mingw32-gtk2-0:2.22.0-1.fc14.noarch
mingw32-gtkhtml3-0:3.32.0-1.fc14.noarch
mingw32-gvnc-0:0.4.1-1.fc14.noarch
mingw32-hunspell-0:1.2.8-11.fc12.noarch
mingw32-libglade2-0:2.6.4-4.fc12.noarch
mingw32-libidn-0:1.14-5.fc12.noarch

Most of these packages (if not all) don't use gettext directly, but get
linked against gettext because of it being mentioned in glib2's
pkgconfig and .la files. A rebuild should be sufficient to replace the
hard dependencies on those packages by soft ones. However, in order to
prevent the libproxy-intl functions from being exported in other DLL's
(as mentioned on [1]) I think it's better drop the reference to libintl
from glib2's pkgconfig and .la files. As most of the packages mentioned
above don't use gettext directly, but the GLib gettext functions to
handle translations this shouldn't cause any major problems.

As the glib2 headers depend on the libintl.h header a 'Requires:
mingw32-gettext' also needs to be added to the mingw32-glib2 package.

I already applied these changes in a testing repository for a generic
cross compiler framework (coming soon!) [2][3] and it works fine there.

Another thing GTK upstream has done in their Win32 binaries is using
win-iconv instead of GNU iconv. I just put up a review request for
mingw32-win-iconv at [4]. Could somebody please review that package?

Does everybody agree to these changes?

Kind regards,

Erik van Pienbroek

[1]: http://www.gtk.org/download-windows.html
[2]: http://svn.openftd.org/svn/fedora_cross
[3]: http://svn.openftd.org/viewvc/Fedora%20Cross%20Compiler%
20Framework/
[4]: https://bugzilla.redhat.com/show_bug.cgi?id=642208




More information about the mingw mailing list