commit:     e2727746cd7823177e43b15f01314e60d68397a6
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 18 10:41:05 2023 +0000
Commit:     Matthew Smith <matthew <AT> gentoo <DOT> org>
CommitDate: Sat Feb 18 10:43:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2727746

sci-electronics/kicad: Use wxGTK-3.2

wxGTK is slotted and wxpython is not. The versions must match, so use
the latest version for now.

Closes: https://bugs.gentoo.org/895188
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>

 .../files/kicad-7.0.0-wxwidgets-version.patch      | 95 ++++++++++++++++++++++
 .../{kicad-7.0.0.ebuild => kicad-7.0.0-r1.ebuild}  | 10 ++-
 2 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/sci-electronics/kicad/files/kicad-7.0.0-wxwidgets-version.patch 
b/sci-electronics/kicad/files/kicad-7.0.0-wxwidgets-version.patch
new file mode 100644
index 000000000000..9ef12e97b573
--- /dev/null
+++ b/sci-electronics/kicad/files/kicad-7.0.0-wxwidgets-version.patch
@@ -0,0 +1,95 @@
+From b536580119c59fde78e38d8d6388f2540ecb6cf9 Mon Sep 17 00:00:00 2001
+From: Ian McInerney <ian.s.mciner...@ieee.org>
+Date: Mon, 13 Feb 2023 21:24:26 +0000
+Subject: [PATCH] Support subrelease field in wxWidgets cmake detection
+
+Sometimes wxWidgets increments the subrelease to a non-zero value, and
+since wxPython will report a subrelease, we must ensure we can get the
+subrelease from the wx library properly, otherwise configure will fail
+thinking the library isn't the same version as that used by wxPython.
+
+Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13887
+--- a/cmake/FindwxWidgets.cmake
++++ b/cmake/FindwxWidgets.cmake
+@@ -926,8 +926,17 @@ if(wxWidgets_FOUND)
+     "\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
+   string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
+     "\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
+-  set(wxWidgets_VERSION_STRING
+-    
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}"
 )
++  string(REGEX REPLACE "^(.*\n)?#define +wxSUBRELEASE_NUMBER +([0-9]+).*"
++    "\\2" wxWidgets_VERSION_SUBRELEASE "${_wx_version_h}" )
++
++  if( ${wxWidgets_VERSION_SUBRELEASE} GREATER 0 )
++    set(wxWidgets_VERSION_STRING
++      
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}.${wxWidgets_VERSION_SUBRELEASE}"
 )
++  else()
++    set(wxWidgets_VERSION_STRING
++      
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}"
 )
++  endif()
++
+   DBG_MSG("wxWidgets_VERSION_STRING:    ${wxWidgets_VERSION_STRING}")
+ endif()
+ 
+-- 
+From 1e8cc6855d6a8fc1f9dfc933224c3a10fb759f9c Mon Sep 17 00:00:00 2001
+From: Ian McInerney <ian.s.mciner...@ieee.org>
+Date: Tue, 14 Feb 2023 00:18:56 +0000
+Subject: [PATCH] Relax wxPython version mismatch check to major.minor
+
+The previous version check failed when the version was even slightly
+different, including on the revision field. Theoretically the ABI of the
+wx minor versions in use should be the same, so this might work. On the
+other hand, with wxPython it could break as well. YOLO.
+--- a/scripting/python_scripting.cpp
++++ b/scripting/python_scripting.cpp
+@@ -50,6 +50,7 @@
+ #include <kiplatform/environment.h>
+ 
+ #include <wx/app.h>
++#include <wx/regex.h>
+ #include <wx/utils.h>
+ 
+ #include <config.h>
+@@ -128,7 +129,39 @@ except:
+                                            wxVI.GetMajor(), wxVI.GetMinor(), 
wxVI.GetMicro() );
+         version = version.Mid( idx + 10 );
+ 
+-        if( wxVersion.Cmp( version ) != 0 )
++        int wxPy_major = 0;
++        int wxPy_minor = 0;
++        int wxPy_micro = 0;
++        int wxPy_rev   = 0;
++
++        // Compile a regex to extract the wxPython version
++        wxRegEx re( "([0-9]+)\\.([0-9]+)\\.?([0-9]+)?\\.?([0-9]+)?" );
++        wxASSERT( re.IsValid() );
++
++        if( re.Matches( version ) )
++        {
++            wxString v = re.GetMatch( version, 1 );
++
++            if( !v.IsEmpty() )
++                v.ToInt( &wxPy_major );
++
++            v = re.GetMatch( version, 2 );
++
++            if( !v.IsEmpty() )
++                v.ToInt( &wxPy_minor );
++
++            v = re.GetMatch( version, 3 );
++
++            if( !v.IsEmpty() )
++                v.ToInt( &wxPy_micro );
++
++            v = re.GetMatch( version, 4 );
++
++            if( !v.IsEmpty() )
++                v.ToInt( &wxPy_rev );
++        }
++
++        if( ( wxVI.GetMajor() != wxPy_major ) || ( wxVI.GetMinor() != 
wxPy_minor ) )
+         {
+             wxString msg = wxT( "The wxPython library was compiled against 
wxWidgets %s but KiCad is "
+                                 "using %s.  Python plugins will not be 
available." );
+-- 

diff --git a/sci-electronics/kicad/kicad-7.0.0.ebuild 
b/sci-electronics/kicad/kicad-7.0.0-r1.ebuild
similarity index 95%
rename from sci-electronics/kicad/kicad-7.0.0.ebuild
rename to sci-electronics/kicad/kicad-7.0.0-r1.ebuild
index 96825330a19f..5371ccfee521 100644
--- a/sci-electronics/kicad/kicad-7.0.0.ebuild
+++ b/sci-electronics/kicad/kicad-7.0.0-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{9..10} )
-WX_GTK_VER="3.0-gtk3"
+WX_GTK_VER="3.2-gtk3"
 
 inherit check-reqs cmake optfeature python-single-r1 toolchain-funcs wxwidgets 
xdg-utils
 
@@ -50,7 +50,7 @@ COMMON_DEPEND="
        sys-libs/zlib
        $(python_gen_cond_dep '
                dev-libs/boost:=[context,nls,python,${PYTHON_USEDEP}]
-               dev-python/wxpython:4.0[${PYTHON_USEDEP}]
+               ~dev-python/wxpython-4.2.0:*[${PYTHON_USEDEP}]
        ')
        ${PYTHON_DEPS}
        ngspice? (
@@ -74,6 +74,11 @@ fi
 
 CHECKREQS_DISK_BUILD="900M"
 
+PATCHES=(
+       # https://bugs.gentoo.org/895188
+       "${FILESDIR}"/${PN}-7.0.0-wxwidgets-version.patch
+)
+
 pkg_setup() {
        [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 
@@ -97,6 +102,7 @@ src_configure() {
                -DKICAD_DOCS="${EPREFIX}/usr/share/doc/${PN}-doc-${PV}"
 
                -DKICAD_SCRIPTING_WXPYTHON=ON
+               -DKICAD_USE_EGL=ON
 
                -DKICAD_BUILD_I18N="$(usex nls)"
                -DKICAD_I18N_UNIX_STRICT_PATH="$(usex nls)"

Reply via email to