Stuart Henderson writes:
> On 2014/09/08 02:34, Anthony J. Bentley wrote:
> > Landry Breuil writes:
> > > On Thu, Sep 04, 2014 at 08:36:12AM -0400, Brian Callahan wrote:
> > > > The preferences menuhas alot of things like
> > > > preferencesMainTabtitle
> > > > 
> > > > I'm guessing that's because of the removal of patch-gtk_res_options_gtk
> 2_ui
> > > > 
> > > > I don't think it's a terribly bad thing though since the information is
> n't
> > > > indiscernible.
> > > 
> > > yeah, this is a bit annoying and iirc we already looked into it without
> > > a proper solution besides patching ... will give it a spin on powerpc.
> > 
> > $ wc -l /usr/ports/www/netsurf/browser/patches/patch-gtk_res_options_gtk2_u
> i
> >     1078 /usr/ports/www/netsurf/browser/patches/patch-gtk_res_options_gtk2_
> ui
> > 
> > Sadly that's not really maintainable. And the patch doesn't apply with
> > this release either.
> > 
> > http://bugs.netsurf-browser.org/mantis/view.php?id=2045
> > 
> > 2014-09-06 04:48 <kyllikki> bentley`: #2045 is relatively simple. The gtk
> > library uses symbols from gettext specificaly gettext(), dgettext(),
> > dcgettext() when NetSurf links to GTK we provide our own implementation
> > in gtk/gettext.[ch] at no point do we ever ask for linkikage of the
> > gettext library
> > 
> > Antoine says our linking of gettext with GTK is correct, so I guess we
> > just have to tell the linker to prefer NetSurf's gettext symbols instead?
> > What's the way to do that?
> > 
> > -- 
> > Anthony J. Bentley
> > 
> 
> So this problem is caused by NetSurf doing internationalisation support
> in a different way than is done in most other software. They are trying to
> override the *gettext() functions which are used by gtk with their own
> version.
> 
> On Linux (and AIUI Solaris), gettext / dgettext / dcgettext usually come
> from libc where they are weak symbols, and libintl is not used. In this case
> they are overridden by the symbols provided by netsurf.
> 
> With libintl that we're using, these symbols are not weak so the library
> versions take priority over the same-named functions in netsurf, and of
> course the library versions work in the normal way rather than the special
> way that NetSurf's use.

Would it make sense to make the libintl symbols weak? Would that make any
difference in this situation?

> There are some suggestions for getting around this in
> http://stackoverflow.com/questions/617554/override-a-function-call-in-c -
> and you may be able to do something with wrapper functions and the --wrap
> linker flag, though I think this is going to be fairly messy and quite
> likely not something that can go upstream (seems that --wrap is specific
> to the GNU linker).

This seems like the most practical option but so far nothing I've tried
has gotten --wrap to handle this case in NetSurf (although I can use
--wrap with small, self-contained examples). I would expect adding
-Wl,-{undefined,wrap},{,d,dc}gettext to LDFLAGS and renaming the functions
in gtk/gettext.c to __wrap_foo() to work, but it doesn't.

> Otherwise I wonder if it's possible to convert the resources/FatMessages
> file to a standard .mo and install that, so that the normal gettext
> library can use it.

Doing this would still require us to patch gtk/res/options/gtk2.ui to use
the English strings by default, so it has the same maintainability issue
we have now.

-- 
Anthony J. Bentley

Reply via email to