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
On 10/12/2010 01:58 PM, Erik van Pienbroek wrote:
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.
<snip>
I was browsing GTK+ win32 builds web page today and it would appear that they have reverted back to _not using_ libproxy-intl. The reason why they switched back to directly linking libintl isn't apparent from the web page, all it says is: "Previously the "proxy-libintl" library that loads the gettext-runtime DLL dynamically was used, but now the GTK+ stack is just linked normally to intl.dll."
"libproxy-intl" has been in Fedora for several months now. I am not sure I like it very much; several packages that use gettext now need patching and the patches aren't often upstreamable and need rebasing every time we update to new upstream sources.
If it was only libraries it might be OK, but I'm afraid it will turn off people if their programs don't build without patching.
One of the problems I ran into today was caused by "libproxy-intl". It turned out that linking to static libintl.a has a side effect which causes gettext functions being exported in libgnutls-26.dll. It wouldn't be much of a problem on itself, but we have other binaries (mingw32-webkitgtk) that now try to resolve gettext symbols from libgnutls-26.dll. When I built a different version of gnutls locally which didn't export gettext symbols, it broke mingw32-webkitgtk binary.
I'm am not sure it pays off diverging from upstream gettext like that.
Kalev Lember schreef op di 26-04-2011 om 17:23 [+0300]:
I was browsing GTK+ win32 builds web page today and it would appear that they have reverted back to _not using_ libproxy-intl. The reason why they switched back to directly linking libintl isn't apparent from the web page, all it says is: "Previously the "proxy-libintl" library that loads the gettext-runtime DLL dynamically was used, but now the GTK+ stack is just linked normally to intl.dll."
"libproxy-intl" has been in Fedora for several months now. I am not sure I like it very much; several packages that use gettext now need patching and the patches aren't often upstreamable and need rebasing every time we update to new upstream sources.
If it was only libraries it might be OK, but I'm afraid it will turn off people if their programs don't build without patching.
One of the problems I ran into today was caused by "libproxy-intl". It turned out that linking to static libintl.a has a side effect which causes gettext functions being exported in libgnutls-26.dll. It wouldn't be much of a problem on itself, but we have other binaries (mingw32-webkitgtk) that now try to resolve gettext symbols from libgnutls-26.dll. When I built a different version of gnutls locally which didn't export gettext symbols, it broke mingw32-webkitgtk binary.
I'm am not sure it pays off diverging from upstream gettext like that.
Hi Kalev,
I agree with you. Using proxy-libintl turned out to be worse than expected. Especially with the mingw32-webkitgtk issues we're discussing right now in #fedora-mingw. I'm okay with dropping it from the F-15 and rawhide trees.
Any objections?
Regards,
Erik van Pienbroek
Erik van Pienbroek schreef op di 26-04-2011 om 16:32 [+0200]:
I agree with you. Using proxy-libintl turned out to be worse than expected. Especially with the mingw32-webkitgtk issues we're discussing right now in #fedora-mingw. I'm okay with dropping it from the F-15 and rawhide trees.
Any objections?
The use of proxy-libintl has been dropped in Fedora 15 and Rawhide. All packages using it have now been rebuilt successfully and are all already pushed as updates. Thanks to Kalev for helping out with this rebuild!
Kind regards,
Erik van Pienbroek
On 10/12/2010 01:58 PM, Erik van Pienbroek wrote: [snip, also changed the subject]
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?
Thanks for working on this, Erik.
Fedora 15 is almost out of the door and if we want to switch over to win_iconv, it might be a good time to do it now in rawhide (F16).
win_iconv is a little project that implements the iconv API on top of the WIN32 API, making the DLL footprint much smaller than with GNU iconv. Several projects that I know of are already using win_iconv: - glib bundles a copy of win_iconv internally http://git.gnome.org/browse/glib/tree/glib/win_iconv.c - official GNOME and KDE Windows builds are built with the win_iconv library instead of GNU iconv - openSUSE MinGW project appears to have switched over to win_iconv
Amorilia has unofficially reviewed the package -- he's not an official packager yet, but given how thorough the review was, he'd make a good one.
I am slightly worried about regressions over the GNU iconv, but I guess we'll see. In any case, the small binary sounds very appealing.
Does anyone have opinions whether we should go on with retiring GNU iconv and switching over to win_iconv?