commit:     412ae3ad157b444a673faee249afbf76f5106149
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 08:04:07 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 21 08:04:28 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=412ae3ad

app-office/gnucash: fix build w/ swig-4.3

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

 .../gnucash/files/gnucash-5.10-swig-4.3.patch      | 59 ++++++++++++++++++++++
 app-office/gnucash/gnucash-5.10.ebuild             |  3 +-
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/app-office/gnucash/files/gnucash-5.10-swig-4.3.patch 
b/app-office/gnucash/files/gnucash-5.10-swig-4.3.patch
new file mode 100644
index 000000000000..48afe2452b47
--- /dev/null
+++ b/app-office/gnucash/files/gnucash-5.10-swig-4.3.patch
@@ -0,0 +1,59 @@
+https://bugs.gentoo.org/953429
+https://github.com/Gnucash/gnucash/commit/85084e75d63633b8c7e44b99ee6cc20f421b52fc
+
+From 85084e75d63633b8c7e44b99ee6cc20f421b52fc Mon Sep 17 00:00:00 2001
+From: John Ralls <[email protected]>
+Date: Thu, 26 Dec 2024 11:45:10 -0800
+Subject: [PATCH] Fix python bindings build with Swig-4.3.0.
+
+---
+ bindings/python/time64.i                     | 11 ++++++++---
+ common/cmake_modules/GncAddSwigCommand.cmake |  6 ++++++
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/bindings/python/time64.i b/bindings/python/time64.i
+index 93d9f261f8c..3f85448dedc 100644
+--- a/bindings/python/time64.i
++++ b/bindings/python/time64.i
+@@ -132,6 +132,12 @@
+     $1 = &secs;
+ }
+ 
++#ifdef HAVE_SWIG_APPENDOUTPUT
++#define SWIG_APPENDOUTPUT(res, func) SWIG_AppendOutput(res, func)
++#else
++#define SWIG_APPENDOUTPUT(res, func) SWIG_Python_AppendOutput(res, func)
++#endif
++
+ %typemap(argout) time64 *date (time64 secs) {
+   PyDateTime_IMPORT;
+   PyObject *tp;
+@@ -148,9 +154,8 @@
+       tp = PyDateTime_FromDateAndTime(t.tm_year + 1900, t.tm_mon + 1,
+                                                  t.tm_mday, t.tm_hour, 
t.tm_min,
+                                                  t.tm_sec, 0);
+-
+-      $result = SWIG_Python_AppendOutput($result, tp);
+-  } else $result = SWIG_Python_AppendOutput($result, Py_None);
++      $result = SWIG_APPENDOUTPUT($result, tp);
++  } else $result = SWIG_APPENDOUTPUT($result, Py_None);
+ }
+ 
+ %apply time64 *date { time64 *last_date };
+diff --git a/common/cmake_modules/GncAddSwigCommand.cmake 
b/common/cmake_modules/GncAddSwigCommand.cmake
+index 811f347608d..a3c8dac995f 100644
+--- a/common/cmake_modules/GncAddSwigCommand.cmake
++++ b/common/cmake_modules/GncAddSwigCommand.cmake
+@@ -86,6 +86,12 @@ macro (gnc_add_swig_python_command _target _out_var 
_py_out_var _output _py_outp
+        )
+ 
+     set (PYTHON_SWIG_FLAGS ${DEFAULT_SWIG_PYTHON_FLAGS})
++
++    if (SWIG_VERSION VERSION_GREATER_EQUAL "4.3.0")
++      list(APPEND PYTHON_SWIG_FLAGS
++        -DHAVE_SWIG_APPENDOUTPUT=1)
++    endif()
++
+     foreach (dir ${DEFAULT_SWIG_PYTHON_C_INCLUDES} ${_include_dirs})
+         list (APPEND PYTHON_SWIG_FLAGS "-I${dir}")
+     endforeach (dir)

diff --git a/app-office/gnucash/gnucash-5.10.ebuild 
b/app-office/gnucash/gnucash-5.10.ebuild
index acc455214339..e1c7c26e83db 100644
--- a/app-office/gnucash/gnucash-5.10.ebuild
+++ b/app-office/gnucash/gnucash-5.10.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -119,6 +119,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-5.0-webkit2gtk-4.1.patch"
        "${FILESDIR}/${P}-import-qif.patch"
        "${FILESDIR}/${PN}-5.8-guile-load-path.patch"
+       "${FILESDIR}/${P}-swig-4.3.patch"
 )
 
 pkg_setup() {

Reply via email to