commit:     8baaa10af7d9944c5bf0fdfc0190cea6abbd296a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 00:46:00 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 14 00:46:00 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8baaa10a

x11-libs/wxGTK: bodge ABI issues one more time

See https://bugs.gentoo.org/955902#c8 onwards for details, but in summary,
we have a bunch of seds in the ebuild, and they break the version script 
upstream
supplies, resulting in made-up symbol versions that are Gentoo-specific (!!!)

```
       sed -i \
               -e "s:\(WX_VERSION=\).*:\1${WXVERSION}:" \
               -e "s:\(WX_RELEASE=\).*:\1${WXRELEASE}:" \
               -e "s:\(WX_SUBVERSION=\).*:\1${WXSUBVERSION}:" \
               -e '/WX_VERSION_TAG=/ s:${WX_RELEASE}:3.0:' \ # <--- here
               configure || die
```

I question how much of the seds are necessary at all, but the mangling of the 
version
script is a critical ABI issue as it makes us incompatible with other 
distributions
and upstream binaries.

However, fixing this correctly while also quickly to solve bug #955902
isn't really feasible, so..

Quickly bodge this by patching the affected symbols in
https://github.com/wxWidgets/wxWidgets/commit/f3eb19ce2efa839c0d3e8dc922445cbb49bd9e5d
to have 3.0.x. In for a penny, in for a pound.

Then can try actually fix this once wxGTK is building again and figure out
proper ABI compatibility with our made up symbols as well as the upstream ones
in a followup revision. Filed bug #955936 for that proper fix.

TL;DR: Leave proper fixing for it until later to fix the immediate emergency,
extend the previous hack to newly-added symbols.

Bug: https://bugs.gentoo.org/955936
Closes: https://bugs.gentoo.org/955902
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/wxGTK-3.2.8-bodge-version-script.patch   | 94 ++++++++++++++++++++++
 x11-libs/wxGTK/wxGTK-3.2.8.ebuild                  | 22 ++---
 2 files changed, 107 insertions(+), 9 deletions(-)

diff --git a/x11-libs/wxGTK/files/wxGTK-3.2.8-bodge-version-script.patch 
b/x11-libs/wxGTK/files/wxGTK-3.2.8-bodge-version-script.patch
new file mode 100644
index 000000000000..a6ad73726348
--- /dev/null
+++ b/x11-libs/wxGTK/files/wxGTK-3.2.8-bodge-version-script.patch
@@ -0,0 +1,94 @@
+See https://bugs.gentoo.org/955902 but especially 
https://bugs.gentoo.org/955902#c15.
+
+This is a temporary hack to have things building again and have internal
+consistency with older wxGTK in Gentoo, but we need to do more work to 
reconcile
+this with upstream.
+--- a/include/wx/private/elfversion.h
++++ b/include/wx/private/elfversion.h
+@@ -58,7 +58,7 @@
+     // Note that this macro takes strings, not symbols, and that it includes
+     // the trailing semicolon for consistency with the empty version below.
+     #define wxELF_VERSION_COMPAT(sym, ver) \
+-        wxELF_SYMVER_NON_DEFAULT(sym, sym "@" wxMAKE_ELF_VERSION_TAG("3.2")) \
++        wxELF_SYMVER_NON_DEFAULT(sym, sym "@" wxMAKE_ELF_VERSION_TAG("3.0")) \
+         wxELF_SYMVER(sym, sym "@@" wxMAKE_ELF_VERSION_TAG(ver))
+ #else
+     #define wxELF_VERSION_COMPAT(sym, ver)
+--- a/src/common/translation.cpp
++++ b/src/common/translation.cpp
+@@ -1422,13 +1422,13 @@ bool wxTranslations::AddCatalog(const wxString& domain,
+ }
+ #endif // !wxUSE_UNICODE
+ 
+-wxELF_VERSION_COMPAT("_ZN14wxTranslations19AddAvailableCatalogERK8wxString", 
"3.2.3")
++wxELF_VERSION_COMPAT("_ZN14wxTranslations19AddAvailableCatalogERK8wxString", 
"3.0.3")
+ bool wxTranslations::AddAvailableCatalog(const wxString& domain)
+ {
+     return AddAvailableCatalog(domain, wxLANGUAGE_ENGLISH_US);
+ }
+ 
+-wxELF_VERSION_COMPAT("_ZN14wxTranslations19AddAvailableCatalogERK8wxString10wxLanguage",
 "3.2.6")
++wxELF_VERSION_COMPAT("_ZN14wxTranslations19AddAvailableCatalogERK8wxString10wxLanguage",
 "3.0.6")
+ bool wxTranslations::AddAvailableCatalog(const wxString& domain, wxLanguage 
msgIdLanguage)
+ {
+     return DoAddCatalog(domain, msgIdLanguage) == Translations_Found;
+@@ -1567,7 +1567,7 @@ wxString wxTranslations::GetBestTranslation(const 
wxString& domain,
+     return lang;
+ }
+ 
+-wxELF_VERSION_COMPAT("_ZN14wxTranslations27GetBestAvailableTranslationERK8wxString",
 "3.2.3")
++wxELF_VERSION_COMPAT("_ZN14wxTranslations27GetBestAvailableTranslationERK8wxString",
 "3.0.3")
+ wxString wxTranslations::GetBestAvailableTranslation(const wxString& domain)
+ {
+     // Determine the best language from the ones with actual translation file:
+--- a/src/common/uilocale.cpp
++++ b/src/common/uilocale.cpp
+@@ -613,7 +613,7 @@ wxString wxUILocale::GetLocalizedName(wxLocaleName name, 
wxLocaleForm form) cons
+ }
+ 
+ #if wxUSE_DATETIME
+-wxELF_VERSION_COMPAT("_ZNK10wxUILocale12GetMonthNameEN10wxDateTime5MonthENS0_9NameFlagsE",
 "3.2.3")
++wxELF_VERSION_COMPAT("_ZNK10wxUILocale12GetMonthNameEN10wxDateTime5MonthENS0_9NameFlagsE",
 "3.0.3")
+ wxString wxUILocale::GetMonthName(wxDateTime::Month month, 
wxDateTime::NameFlags flags) const
+ {
+     if (!m_impl)
+@@ -622,7 +622,7 @@ wxString wxUILocale::GetMonthName(wxDateTime::Month month, 
wxDateTime::NameFlags
+     return m_impl->GetMonthName(month, flags);
+ }
+ 
+-wxELF_VERSION_COMPAT("_ZNK10wxUILocale14GetWeekDayNameEN10wxDateTime7WeekDayENS0_9NameFlagsE",
 "3.2.3")
++wxELF_VERSION_COMPAT("_ZNK10wxUILocale14GetWeekDayNameEN10wxDateTime7WeekDayENS0_9NameFlagsE",
 "3.0.3")
+ wxString wxUILocale::GetWeekDayName(wxDateTime::WeekDay weekday, 
wxDateTime::NameFlags flags) const
+ {
+     if (!m_impl)
+@@ -680,7 +680,7 @@ wxUILocale::~wxUILocale()
+ 
+ 
+ /* static */
+-wxELF_VERSION_COMPAT("_ZN10wxUILocale17GetSystemLocaleIdEv", "3.2.2")
++wxELF_VERSION_COMPAT("_ZN10wxUILocale17GetSystemLocaleIdEv", "3.0.2")
+ wxLocaleIdent wxUILocale::GetSystemLocaleId()
+ {
+     wxUILocale defaultLocale(wxUILocaleImpl::CreateUserDefault());
+--- a/src/gtk/filedlg.cpp
++++ b/src/gtk/filedlg.cpp
+@@ -502,7 +502,7 @@ void wxFileDialog::GTKSelectionChanged(const wxString& 
filename)
+     UpdateExtraControlUI();
+ }
+ 
+-wxELF_VERSION_COMPAT("_ZN12wxFileDialog11AddShortcutERK8wxStringi", "3.2.1")
++wxELF_VERSION_COMPAT("_ZN12wxFileDialog11AddShortcutERK8wxStringi", "3.0.1")
+ bool wxFileDialog::AddShortcut(const wxString& directory, int WXUNUSED(flags))
+ {
+     wxGtkError error;
+--- a/src/unix/glegl.cpp
++++ b/src/unix/glegl.cpp
+@@ -635,7 +635,7 @@ wxGLCanvasEGL::~wxGLCanvasEGL()
+     gs_alreadySetSwapInterval.erase(this);
+ }
+ 
+-wxELF_VERSION_COMPAT("_ZN13wxGLCanvasEGL23CreateWaylandSubsurfaceEv", "3.2.3")
++wxELF_VERSION_COMPAT("_ZN13wxGLCanvasEGL23CreateWaylandSubsurfaceEv", "3.0.3")
+ void wxGLCanvasEGL::CreateWaylandSubsurface()
+ {
+ #ifdef GDK_WINDOWING_WAYLAND

diff --git a/x11-libs/wxGTK/wxGTK-3.2.8.ebuild 
b/x11-libs/wxGTK/wxGTK-3.2.8.ebuild
index 5a3fd91a45dd..96902890a118 100644
--- a/x11-libs/wxGTK/wxGTK-3.2.8.ebuild
+++ b/x11-libs/wxGTK/wxGTK-3.2.8.ebuild
@@ -81,39 +81,43 @@ PATCHES=(
        "${FILESDIR}/${PN}-3.2.1-wayland-control.patch"
        "${FILESDIR}/${PN}-3.2.1-prefer-lib64-in-tests.patch"
        "${FILESDIR}/${PN}-3.2.5-dont-break-flags.patch"
+       # Please DO NOT rebase this without handling the underlying problem
+       # in bug #955902 properly first.
+       "${FILESDIR}/${PN}-3.2.8-bodge-version-script.patch"
 )
 
 src_prepare() {
        default
 
+       # Versionating
+       #
        # find . -iname Makefile.in -not -path ./samples'/*' \
        #        | xargs grep -l WX_RELEASE
        local versioned_makefiles=(
-               ./tests/benchmarks/Makefile.in
-               ./tests/Makefile.in
-               ./utils/emulator/src/Makefile.in
-               ./utils/execmon/Makefile.in
+               ./Makefile.in
                ./utils/wxrc/Makefile.in
                ./utils/helpview/src/Makefile.in
+               ./utils/execmon/Makefile.in
                ./utils/hhp2cached/Makefile.in
+               ./utils/emulator/src/Makefile.in
                ./utils/screenshotgen/src/Makefile.in
                ./utils/ifacecheck/src/Makefile.in
-               ./Makefile.in
+               ./demos/poem/Makefile.in
                ./demos/life/Makefile.in
                ./demos/bombs/Makefile.in
                ./demos/fractal/Makefile.in
                ./demos/forty/Makefile.in
-               ./demos/poem/Makefile.in
+               ./tests/benchmarks/Makefile.in
+               ./tests/Makefile.in
        )
-
-       # Versionating
        sed -i \
                -e "s:\(WX_RELEASE = \).*:\1${WXRELEASE}:"\
                -e "s:\(WX_RELEASE_NODOT = \).*:\1${WXRELEASE_NODOT}:"\
                -e "s:\(WX_VERSION = \).*:\1${WXVERSION}:"\
                -e "s:aclocal):aclocal/wxwin${WXRELEASE_NODOT}.m4):" \
                "${versioned_makefiles[@]}" || die
-
+       # XXX: The WX_VERSION_TAG especially here is *radioactive*
+       # and must be removed in a new revision after 3.2.8. See bug #955902.
        sed -i \
                -e "s:\(WX_VERSION=\).*:\1${WXVERSION}:" \
                -e "s:\(WX_RELEASE=\).*:\1${WXRELEASE}:" \

Reply via email to