Compare commits
56 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74b108992c | ||
|
|
b3992326f1 | ||
|
|
6eb1208d37 | ||
|
|
28a355063e | ||
|
|
ad62c005a3 | ||
|
|
9a1f1a1a55 | ||
|
|
36cdf9d256 | ||
|
|
7f3c4ff630 | ||
|
|
79b2996e10 | ||
|
|
6d8e3c9268 | ||
|
|
65e8c5a6c2 | ||
|
|
b2c552c89d | ||
|
|
fc387ae5fe | ||
|
|
967cd34363 | ||
|
|
b769227485 | ||
|
|
b2f85aac64 | ||
|
|
7c0f355005 | ||
|
|
eb7c0ebce6 | ||
|
|
7c322c4f69 | ||
|
|
797df90a0b | ||
|
|
07e662f6d6 | ||
|
|
abae643ad3 | ||
|
|
daa3574f6d | ||
|
|
2f97bd3f0c | ||
|
|
48a62aa030 | ||
|
|
5a53f07653 | ||
|
|
f77b41fc2e | ||
|
|
ed86a8d491 | ||
|
|
8b63a5b179 | ||
|
|
d32feca3e6 | ||
|
|
6463e51599 | ||
|
|
bef85e9f4f | ||
|
|
3cfcd3fd2e | ||
|
|
4fcc29d0a3 | ||
|
|
cfa2a17e5e | ||
|
|
a88b74f2ba | ||
|
|
3b57be16db | ||
|
|
1e5ff9449e | ||
|
|
bad99c2667 | ||
|
|
4043e54fe7 | ||
|
|
fa8219acb6 | ||
|
|
474931b379 | ||
|
|
f50f0e420e | ||
|
|
3fe391e859 | ||
|
|
5a104ce6fb | ||
|
|
f1e63a8640 | ||
|
|
cff75cf870 |
||
|
|
1d2ecc9240 |
||
|
|
37afcecc7c | ||
|
|
1fe0c72f6b | ||
|
|
f74f288cd0 | ||
|
|
c972358d36 | ||
|
|
34774501ed | ||
|
|
4adf2d1284 | ||
|
|
a2bd7ba1ee | ||
|
|
3b059fb6f1 |
11 changed files with 360 additions and 2942 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -25,3 +25,11 @@ swig-2.0.0.tar.gz
|
|||
/swig-4.0.0.tar.gz
|
||||
/swig-4.0.1.tar.gz
|
||||
/swig-4.0.2.tar.gz
|
||||
/swig-4.1.0.tar.gz
|
||||
/swig-4.1.1.tar.gz
|
||||
/swig-4.2.0.tar.gz
|
||||
/swig-4.2.1.tar.gz
|
||||
/swig-4.3.0.tar.gz
|
||||
/swig-4.3.1.tar.gz
|
||||
/swig-4.4.0.tar.gz
|
||||
/swig-4.4.1.tar.gz
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (swig-4.0.2.tar.gz) = 05e7da70ce6d9a733b96c0bcfa3c1b82765bd859f48c74759bbf4bb1467acb1809caa310cba5e2b3280cd704fca249eaa0624821dffae1d2a75097c7f55d14ed
|
||||
SHA512 (swig-4.4.1.tar.gz) = 103ddb4a5914f28e6739a006d35042c701e55ba05066acff3f3609befb5f43f253ea717fc41d06c93d8fb187ded4399c12c94665b93dc06d0fb835069391c7c7
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
From b7dedecfdd708c5323addc1b28e16cc727e01980 Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Thu, 18 Mar 2021 10:53:58 +1300
|
||||
Subject: [PATCH] php: Fix char* typecheck typemap to accept Null
|
||||
|
||||
The corresponding in typemap already does.
|
||||
|
||||
Fixes #1655, reported by CJSlominski.
|
||||
---
|
||||
CHANGES.current | 4 ++++
|
||||
Examples/test-suite/overload_polymorphic.i | 3 +++
|
||||
.../test-suite/php/overload_polymorphic_runme.php | 14 ++++++++++++++
|
||||
Lib/php/php.swg | 5 ++++-
|
||||
4 files changed, 25 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Examples/test-suite/php/overload_polymorphic_runme.php
|
||||
|
||||
#diff --git a/CHANGES.current b/CHANGES.current
|
||||
#index 58fd05a56..f287e3d60 100644
|
||||
#--- a/CHANGES.current
|
||||
#+++ b/CHANGES.current
|
||||
#@@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||
# Version 4.1.0 (in progress)
|
||||
# ===========================
|
||||
#
|
||||
#+2021-03-18: olly
|
||||
#+ #1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
|
||||
#+ corresponding in typemap does.
|
||||
#+
|
||||
# 2021-03-18: olly
|
||||
# #1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
|
||||
# non-void return.
|
||||
diff --git a/Examples/test-suite/overload_polymorphic.i b/Examples/test-suite/overload_polymorphic.i
|
||||
index ac004f948..72aabd840 100644
|
||||
--- a/Examples/test-suite/overload_polymorphic.i
|
||||
+++ b/Examples/test-suite/overload_polymorphic.i
|
||||
@@ -23,4 +23,7 @@ class Unknown;
|
||||
int test2(Unknown* unknown) { return 0; }
|
||||
int test2(Base* base) { return 1; }
|
||||
|
||||
+int test3(const char*, const Base* = 0, bool = false) { return 0; }
|
||||
+int test3(Base&, const char* = 0, const Base* = 0, bool = false) { return 1; }
|
||||
+
|
||||
%}
|
||||
diff --git a/Examples/test-suite/php/overload_polymorphic_runme.php b/Examples/test-suite/php/overload_polymorphic_runme.php
|
||||
new file mode 100644
|
||||
index 000000000..0afe16808
|
||||
--- /dev/null
|
||||
+++ b/Examples/test-suite/php/overload_polymorphic_runme.php
|
||||
@@ -0,0 +1,14 @@
|
||||
+<?php
|
||||
+
|
||||
+require "tests.php";
|
||||
+require "overload_polymorphic.php";
|
||||
+
|
||||
+$t = new Derived();
|
||||
+
|
||||
+check::equal(overload_polymorphic::test($t), 0, "test(Derived)");
|
||||
+check::equal(overload_polymorphic::test(1), 1, "test(1)");
|
||||
+check::equal(overload_polymorphic::test2($t), 1, "test2(Derived)");
|
||||
+check::equal(overload_polymorphic::test3($t, null, $t), 1, "test3(Derived, null, Derived)");
|
||||
+
|
||||
+check::done();
|
||||
+?>
|
||||
diff --git a/Lib/php/php.swg b/Lib/php/php.swg
|
||||
index 4eba6be2a..ccfd371ab 100644
|
||||
--- a/Lib/php/php.swg
|
||||
+++ b/Lib/php/php.swg
|
||||
@@ -465,7 +465,10 @@
|
||||
%php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE)
|
||||
%php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING)
|
||||
|
||||
-%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char []
|
||||
+%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&
|
||||
+ " $1 = (Z_TYPE($input) == IS_STRING || Z_TYPE($input) == IS_NULL); "
|
||||
+
|
||||
+%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char []
|
||||
" $1 = (Z_TYPE($input) == IS_STRING); "
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
From a2850397ba3eec5d4c58304cf8277ca535919760 Mon Sep 17 00:00:00 2001
|
||||
From: Julien Schueller <schueller@phimeca.com>
|
||||
Date: Thu, 5 Aug 2021 14:05:10 +0200
|
||||
Subject: [PATCH] [Python] Fix overload_simple_cast test with 3.10
|
||||
|
||||
Closes #2044
|
||||
---
|
||||
Examples/test-suite/python/python_overload_simple_cast_runme.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
|
||||
index fc398ab29b9..7a0174af8a2 100644
|
||||
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
|
||||
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
|
||||
@@ -9,6 +9,8 @@ def __init__(self, x):
|
||||
def __int__(self):
|
||||
return self.x
|
||||
|
||||
+ def __index__(self):
|
||||
+ return self.x
|
||||
|
||||
class Ad:
|
||||
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
From 2e7da86b2ced479e48741cc8713479dee426be61 Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Wed, 9 Dec 2020 09:48:55 +1300
|
||||
Subject: [PATCH] php: Fix overloaded directed methods with non-void return
|
||||
|
||||
We were treating such methods like constructors and assigning to the
|
||||
internal _cPtr, which just seems bizarrely wrong.
|
||||
|
||||
Fixes #1900
|
||||
---
|
||||
CHANGES.current | 4 ++++
|
||||
Examples/test-suite/director_overload.i | 11 ++++++++++-
|
||||
.../test-suite/php/director_overload_runme.php | 18 ++++++++++++++++++
|
||||
Source/Modules/php.cxx | 4 ++--
|
||||
4 files changed, 34 insertions(+), 3 deletions(-)
|
||||
create mode 100644 Examples/test-suite/php/director_overload_runme.php
|
||||
|
||||
#diff --git a/CHANGES.current b/CHANGES.current
|
||||
#index acaea3aea..58fd05a56 100644
|
||||
#--- a/CHANGES.current
|
||||
#+++ b/CHANGES.current
|
||||
#@@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||
# Version 4.1.0 (in progress)
|
||||
# ===========================
|
||||
#
|
||||
#+2021-03-18: olly
|
||||
#+ #1900, #1905 [PHP] Fix wrapping of overloaded directed methods with
|
||||
#+ non-void return.
|
||||
#+
|
||||
# 2021-03-11: murillo128
|
||||
# #1498 [Javascript] Support type conversion.
|
||||
#
|
||||
diff --git a/Examples/test-suite/director_overload.i b/Examples/test-suite/director_overload.i
|
||||
index 604ffe5ca..d6feb122b 100644
|
||||
--- a/Examples/test-suite/director_overload.i
|
||||
+++ b/Examples/test-suite/director_overload.i
|
||||
@@ -47,5 +47,14 @@ public:
|
||||
virtual void notover(int *p) const {}
|
||||
};
|
||||
|
||||
-%}
|
||||
+class OverloadedGetSet
|
||||
+{
|
||||
+ int v;
|
||||
+public:
|
||||
+ OverloadedGetSet() : v(42) { }
|
||||
+ virtual ~OverloadedGetSet() { }
|
||||
+ virtual int rw() const { return v; }
|
||||
+ virtual void rw(int new_v) { v = new_v; }
|
||||
+};
|
||||
|
||||
+%}
|
||||
diff --git a/Examples/test-suite/php/director_overload_runme.php b/Examples/test-suite/php/director_overload_runme.php
|
||||
new file mode 100644
|
||||
index 000000000..f5fc56b65
|
||||
--- /dev/null
|
||||
+++ b/Examples/test-suite/php/director_overload_runme.php
|
||||
@@ -0,0 +1,18 @@
|
||||
+
|
||||
+<?php
|
||||
+
|
||||
+require "tests.php";
|
||||
+require "director_overload.php";
|
||||
+
|
||||
+check::functions(array('new_overloadedClass','new_overloadedPointers','new_overloadedGetSet','overloadedclass_method1','overloadedclass_method3','overloadedclass_method2','overloadedpointers_method','overloadedpointers_notover','overloadedgetset_rw'));
|
||||
+
|
||||
+check::classes(array('OverloadedClass','OverloadedPointers','OverloadedGetSet'));
|
||||
+check::globals(array());
|
||||
+
|
||||
+$o = new OverloadedGetSet;
|
||||
+check::equal($o->rw(), 42, "get_set() initial value not 42");
|
||||
+check::equal($o->rw(7), null, "get_set() failed to set");
|
||||
+check::equal($o->rw(), 7, "get_set() didn't return back set value");
|
||||
+
|
||||
+check::done();
|
||||
+?>
|
||||
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
|
||||
index 1edbd874c..eaae32d63 100644
|
||||
--- a/Source/Modules/php.cxx
|
||||
+++ b/Source/Modules/php.cxx
|
||||
@@ -1566,7 +1566,7 @@ public:
|
||||
Printf(prepare, "case %d: ", ++last_handled_i);
|
||||
}
|
||||
if (non_void_return) {
|
||||
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
|
||||
+ if (!constructor) {
|
||||
Append(prepare, "$r=");
|
||||
} else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
|
||||
Append(prepare, "$r=");
|
||||
@@ -1590,7 +1590,7 @@ public:
|
||||
if (had_a_case)
|
||||
Printf(prepare, "default: ");
|
||||
if (non_void_return) {
|
||||
- if ((!directorsEnabled() || !Swig_directorclass(n)) && !constructor) {
|
||||
+ if (!constructor) {
|
||||
Append(prepare, "$r=");
|
||||
} else if (wrapperType == staticmemberfn || wrapperType == staticmembervar) {
|
||||
Append(prepare, "$r=");
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
From 71475b0af9677deeaf6fe55c0c5f53fec9f730d2 Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Thu, 18 Mar 2021 15:50:52 +1300
|
||||
Subject: [PATCH] Improve PHP object creation
|
||||
|
||||
Reportedly the code we were using in the directorin case gave segfaults
|
||||
in PHP 7.2 and later - we've been unable to reproduce these, but the new
|
||||
approach is also simpler and should be bit faster too.
|
||||
|
||||
Fixes #1527, #1975
|
||||
---
|
||||
CHANGES.current | 6 ++++++
|
||||
Lib/php/phprun.swg | 14 +++++---------
|
||||
2 files changed, 11 insertions(+), 9 deletions(-)
|
||||
|
||||
#diff --git a/CHANGES.current b/CHANGES.current
|
||||
#index f287e3d60..79d41001f 100644
|
||||
#--- a/CHANGES.current
|
||||
#+++ b/CHANGES.current
|
||||
#@@ -7,6 +7,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||
# Version 4.1.0 (in progress)
|
||||
# ===========================
|
||||
#
|
||||
#+2021-03-19: olly
|
||||
#+ #1527 [PHP] Improve PHP object creation in directorin case.
|
||||
#+ Reportedly the code we were using in this case gave segfaults in
|
||||
#+ PHP 7.2 and later - we've been unable to reproduce these, but the
|
||||
#+ new approach is also simpler and should be bit faster too.
|
||||
#+
|
||||
# 2021-03-18: olly
|
||||
# #1655 [PHP] Fix char* typecheck typemap to accept PHP Null like the
|
||||
# corresponding in typemap does.
|
||||
diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg
|
||||
index a07a1b9f8..f3a4e6ad1 100644
|
||||
--- a/Lib/php/phprun.swg
|
||||
+++ b/Lib/php/phprun.swg
|
||||
@@ -90,15 +90,13 @@ SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
|
||||
} else {
|
||||
/*
|
||||
* Wrap the resource in an object, the resource will be accessible
|
||||
- * via the "_cPtr" member. This is currently only used by
|
||||
+ * via the "_cPtr" property. This code path is currently only used by
|
||||
* directorin typemaps.
|
||||
*/
|
||||
- zval resource;
|
||||
zend_class_entry *ce = NULL;
|
||||
const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */
|
||||
size_t type_name_len;
|
||||
const char * p;
|
||||
- HashTable * ht;
|
||||
|
||||
/* Namespace__Foo -> Foo */
|
||||
/* FIXME: ugly and goes wrong for classes with __ in their names. */
|
||||
@@ -107,7 +105,6 @@ SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
|
||||
}
|
||||
type_name_len = strlen(type_name);
|
||||
|
||||
- ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata)));
|
||||
if (SWIG_PREFIX_LEN > 0) {
|
||||
zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0);
|
||||
memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN);
|
||||
@@ -121,13 +118,12 @@ SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
|
||||
}
|
||||
if (ce == NULL) {
|
||||
/* class does not exist */
|
||||
- ce = zend_standard_class_def;
|
||||
+ object_init(z);
|
||||
+ } else {
|
||||
+ object_init_ex(z, ce);
|
||||
}
|
||||
|
||||
- ALLOC_HASHTABLE(ht);
|
||||
- zend_hash_init(ht, 1, NULL, NULL, 0);
|
||||
- zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource);
|
||||
- object_and_properties_init(z, ce, ht);
|
||||
+ add_property_resource_ex(z, "_cPtr", sizeof("_cPtr") - 1, zend_register_resource(value, *(int *)(type->clientdata)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
|
@ -1,409 +0,0 @@
|
|||
From 3584c7d49cb598ce79d5e285d6c17b2dedfe3ecb Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Wed, 17 Mar 2021 12:45:17 +1300
|
||||
Subject: [PATCH 1/4] Add initial support for PHP8
|
||||
|
||||
Testcase director_overload2 is failing, but the rest of the testsuite
|
||||
passes.
|
||||
---
|
||||
.travis.yml | 4 ++
|
||||
Doc/Manual/Php.html | 6 +-
|
||||
Doc/Manual/Preprocessor.html | 2 +-
|
||||
Doc/Manual/SWIG.html | 2 +-
|
||||
Examples/Makefile.in | 6 +-
|
||||
.../php/evil_diamond_prop_runme.php | 2 +-
|
||||
Lib/cdata.i | 2 +-
|
||||
Lib/exception.i | 2 +-
|
||||
Lib/php/phprun.swg | 8 ++-
|
||||
Source/Modules/php.cxx | 55 +++++++++++++++----
|
||||
configure.ac | 10 ++--
|
||||
11 files changed, 72 insertions(+), 27 deletions(-)
|
||||
|
||||
#diff --git a/.travis.yml b/.travis.yml
|
||||
#index 8c293c2f9fb..9477bed946f 100644
|
||||
#--- a/.travis.yml
|
||||
#+++ b/.travis.yml
|
||||
#@@ -154,6 +154,10 @@ matrix:
|
||||
# os: linux
|
||||
# env: SWIGLANG=php VER=7.4
|
||||
# dist: xenial
|
||||
#+ - compiler: gcc
|
||||
#+ os: linux
|
||||
#+ env: SWIGLANG=php VER=8.0
|
||||
#+ dist: xenial
|
||||
# - compiler: gcc
|
||||
# os: linux
|
||||
# env: SWIGLANG=python # 2.7
|
||||
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
|
||||
index 09c514e944a..4b91958894a 100644
|
||||
--- a/Doc/Manual/Php.html
|
||||
+++ b/Doc/Manual/Php.html
|
||||
@@ -51,12 +51,12 @@ <H1><a name="Php">32 SWIG and PHP</a></H1>
|
||||
|
||||
<p>
|
||||
In this chapter, we discuss SWIG's support of PHP. SWIG currently supports
|
||||
-generating wrappers for PHP7. Support for PHP5 was removed in SWIG 4.0.0
|
||||
-and support for PHP4 was removed in SWIG 1.3.37.
|
||||
+generating wrappers for PHP7 and PHP8. Support for PHP5 was removed in SWIG
|
||||
+4.0.0 and support for PHP4 was removed in SWIG 1.3.37.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
-Currently any PHP7 release should work.
|
||||
+Currently any PHP7 or PHP8 release should work.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
|
||||
index 51cc0637836..0c704bde959 100644
|
||||
--- a/Doc/Manual/Preprocessor.html
|
||||
+++ b/Doc/Manual/Preprocessor.html
|
||||
@@ -123,7 +123,7 @@ <H2><a name="Preprocessor_condition_compilation">11.3 Conditional Compilation</a
|
||||
SWIGOCTAVE Defined when using Octave
|
||||
SWIGPERL Defined when using Perl
|
||||
SWIGPHP Defined when using PHP (any version)
|
||||
-SWIGPHP7 Defined when using PHP7
|
||||
+SWIGPHP7 Defined when using PHP 7 or later
|
||||
SWIGPYTHON Defined when using Python
|
||||
SWIGR Defined when using R
|
||||
SWIGRUBY Defined when using Ruby
|
||||
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
|
||||
index c54d117e018..f4884256536 100644
|
||||
--- a/Doc/Manual/SWIG.html
|
||||
+++ b/Doc/Manual/SWIG.html
|
||||
@@ -127,7 +127,7 @@ <H2><a name="SWIG_nn2">5.1 Running SWIG</a></H2>
|
||||
-lua - Generate Lua wrappers
|
||||
-octave - Generate Octave wrappers
|
||||
-perl5 - Generate Perl 5 wrappers
|
||||
- -php7 - Generate PHP 7 wrappers
|
||||
+ -php7 - Generate PHP 7 or later wrappers
|
||||
-python - Generate Python wrappers
|
||||
-r - Generate R (aka GNU S) wrappers
|
||||
-ruby - Generate Ruby wrappers
|
||||
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
|
||||
index 3f6140b5e79..3978a959836 100644
|
||||
--- a/Examples/Makefile.in
|
||||
+++ b/Examples/Makefile.in
|
||||
@@ -1045,7 +1045,7 @@ ruby_clean:
|
||||
rm -f *.@OBJEXT@ *$(RUBY_SO)
|
||||
|
||||
##################################################################
|
||||
-##### PHP7 ######
|
||||
+##### PHP ######
|
||||
##################################################################
|
||||
|
||||
PHP = @PHP@
|
||||
@@ -1058,7 +1058,7 @@ PHP_SCRIPT = $(SRCDIR)$(RUNME).php
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
php: $(SRCDIR_SRCS)
|
||||
- $(SWIG) -php7 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
+ $(SWIG) -php $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE)
|
||||
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
|
||||
|
||||
@@ -1067,7 +1067,7 @@ php: $(SRCDIR_SRCS)
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
php_cpp: $(SRCDIR_SRCS)
|
||||
- $(SWIG) -php7 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
+ $(SWIG) -php -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE)
|
||||
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO)
|
||||
|
||||
diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php
|
||||
index 9bdb7435f1c..645328affda 100644
|
||||
--- a/Examples/test-suite/php/evil_diamond_prop_runme.php
|
||||
+++ b/Examples/test-suite/php/evil_diamond_prop_runme.php
|
||||
@@ -31,7 +31,7 @@
|
||||
check::equal(1,$spam->_foo,"1==spam->_foo");
|
||||
check::equal(2,$spam->_bar,"2==spam->_bar");
|
||||
// multiple inheritance not supported in PHP
|
||||
-set_error_handler(NULL, 0); // Don't complain that _baz is unknown.
|
||||
+set_error_handler(function () {return true;}, E_NOTICE|E_WARNING); // Don't complain that _baz is unknown.
|
||||
check::equal(null,$spam->_baz,"null==spam->_baz");
|
||||
restore_error_handler();
|
||||
check::equal(4,$spam->_spam,"4==spam->_spam");
|
||||
diff --git a/Lib/cdata.i b/Lib/cdata.i
|
||||
index f18ed4af53c..cd15266431e 100644
|
||||
--- a/Lib/cdata.i
|
||||
+++ b/Lib/cdata.i
|
||||
@@ -21,7 +21,7 @@ typedef struct SWIGCDATA {
|
||||
}
|
||||
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
|
||||
|
||||
-#elif SWIGPHP7
|
||||
+#elif SWIGPHP
|
||||
|
||||
%typemap(out) SWIGCDATA {
|
||||
ZVAL_STRINGL($result, $1.data, $1.len);
|
||||
diff --git a/Lib/exception.i b/Lib/exception.i
|
||||
index ee9ce9bc632..3d6eeccdf2e 100644
|
||||
--- a/Lib/exception.i
|
||||
+++ b/Lib/exception.i
|
||||
@@ -12,7 +12,7 @@
|
||||
%insert("runtime") "swigerrors.swg"
|
||||
|
||||
|
||||
-#ifdef SWIGPHP7
|
||||
+#ifdef SWIGPHP
|
||||
%{
|
||||
#include "zend_exceptions.h"
|
||||
#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code); goto thrown; } while (0)
|
||||
diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg
|
||||
index f3a4e6ad1a9..04919878743 100644
|
||||
--- a/Lib/php/phprun.swg
|
||||
+++ b/Lib/php/phprun.swg
|
||||
@@ -12,8 +12,8 @@ extern "C" {
|
||||
#include "zend_exceptions.h"
|
||||
#include "php.h"
|
||||
|
||||
-#if PHP_MAJOR_VERSION != 7
|
||||
-# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||
+#if PHP_MAJOR_VERSION < 7
|
||||
+# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||
#endif
|
||||
|
||||
#include "ext/standard/php_string.h"
|
||||
@@ -200,7 +200,11 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
|
||||
|
||||
switch (Z_TYPE_P(z)) {
|
||||
case IS_OBJECT: {
|
||||
+#if PHP_MAJOR_VERSION < 8
|
||||
HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z);
|
||||
+#else
|
||||
+ HashTable * ht = Z_OBJ_HT_P(z)->get_properties(Z_OBJ_P(z));
|
||||
+#endif
|
||||
if (ht) {
|
||||
zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1);
|
||||
if (_cPtr) {
|
||||
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx
|
||||
index eaae32d633b..d8ee75b45fb 100644
|
||||
--- a/Source/Modules/php.cxx
|
||||
+++ b/Source/Modules/php.cxx
|
||||
@@ -473,6 +473,20 @@ class PHP : public Language {
|
||||
s_arginfo = NewString("/* arginfo subsection */\n");
|
||||
arginfo_used = NewHash();
|
||||
|
||||
+ // Add arginfo we'll definitely need for *_alter_newobject and *_get_newobject.
|
||||
+ SetFlag(arginfo_used, "1");
|
||||
+ Append(s_arginfo,
|
||||
+ "ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_1, 0, 0, 0)\n"
|
||||
+ " ZEND_ARG_INFO(0,arg1)\n"
|
||||
+ "ZEND_END_ARG_INFO()\n");
|
||||
+
|
||||
+ SetFlag(arginfo_used, "2");
|
||||
+ Append(s_arginfo,
|
||||
+ "ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_2, 0, 0, 0)\n"
|
||||
+ " ZEND_ARG_INFO(0,arg1)\n"
|
||||
+ " ZEND_ARG_INFO(0,arg2)\n"
|
||||
+ "ZEND_END_ARG_INFO()\n");
|
||||
+
|
||||
/* start the function entry section */
|
||||
s_entry = NewString("/* entry subsection */\n");
|
||||
|
||||
@@ -653,8 +667,8 @@ class PHP : public Language {
|
||||
}
|
||||
Printv(f_begin, s_vdecl, s_wrappers, NIL);
|
||||
Printv(f_begin, all_cs_entry, "\n\n", s_arginfo, "\n\n", s_entry,
|
||||
- " SWIG_ZEND_NAMED_FE(swig_", module, "_alter_newobject,_wrap_swig_", module, "_alter_newobject,NULL)\n"
|
||||
- " SWIG_ZEND_NAMED_FE(swig_", module, "_get_newobject,_wrap_swig_", module, "_get_newobject,NULL)\n"
|
||||
+ " SWIG_ZEND_NAMED_FE(swig_", module, "_alter_newobject,_wrap_swig_", module, "_alter_newobject,swig_arginfo_2)\n"
|
||||
+ " SWIG_ZEND_NAMED_FE(swig_", module, "_get_newobject,_wrap_swig_", module, "_get_newobject,swig_arginfo_1)\n"
|
||||
" ZEND_FE_END\n};\n\n", NIL);
|
||||
Printv(f_begin, s_init, NIL);
|
||||
Delete(s_header);
|
||||
@@ -689,25 +703,46 @@ class PHP : public Language {
|
||||
|
||||
// We want to only emit each different arginfo once, as that reduces the
|
||||
// size of both the generated source code and the compiled extension
|
||||
- // module. To do this, we name the arginfo to encode the number of
|
||||
- // parameters and which (if any) are passed by reference by using a
|
||||
- // sequence of 0s (for non-reference) and 1s (for by references).
|
||||
+ // module. The parameters at this level are just named arg1, arg2, etc
|
||||
+ // so we generate an arginfo name with the number of parameters and a
|
||||
+ // bitmap value saying which (if any) are passed by reference.
|
||||
ParmList *l = Getattr(n, "parms");
|
||||
- String * arginfo_code = NewStringEmpty();
|
||||
+ unsigned long bitmap = 0, bit = 1;
|
||||
+ int n_params = 0;
|
||||
+ bool overflowed = false;
|
||||
for (Parm *p = l; p; p = Getattr(p, "tmap:in:next")) {
|
||||
/* Ignored parameters */
|
||||
if (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
||||
continue;
|
||||
}
|
||||
- Append(arginfo_code, GetFlag(p, "tmap:in:byref") ? "1" : "0");
|
||||
+ ++n_params;
|
||||
+ if (GetFlag(p, "tmap:in:byref")) {
|
||||
+ bitmap |= bit;
|
||||
+ if (bit == 0) overflowed = true;
|
||||
+ }
|
||||
+ bit <<= 1;
|
||||
+ }
|
||||
+ String * arginfo_code;
|
||||
+ if (overflowed) {
|
||||
+ // We overflowed the bitmap so just generate a unique name - this only
|
||||
+ // happens for a function with more parameters than bits in a long
|
||||
+ // where a high numbered parameter is passed by reference, so should be
|
||||
+ // rare in practice.
|
||||
+ static int overflowed_counter = 0;
|
||||
+ arginfo_code = NewStringf("z%d", ++overflowed_counter);
|
||||
+ } else if (bitmap == 0) {
|
||||
+ // No parameters passed by reference.
|
||||
+ arginfo_code = NewStringf("%d", n_params);
|
||||
+ } else {
|
||||
+ arginfo_code = NewStringf("%d_%lx", n_params, bitmap);
|
||||
}
|
||||
|
||||
if (!GetFlag(arginfo_used, arginfo_code)) {
|
||||
- // Not had this one before, so emit it.
|
||||
+ // Not had this one before so emit it.
|
||||
SetFlag(arginfo_used, arginfo_code);
|
||||
Printf(s_arginfo, "ZEND_BEGIN_ARG_INFO_EX(swig_arginfo_%s, 0, 0, 0)\n", arginfo_code);
|
||||
- for (const char * p = Char(arginfo_code); *p; ++p) {
|
||||
- Printf(s_arginfo, " ZEND_ARG_PASS_INFO(%c)\n", *p);
|
||||
+ for (Parm *p = l; p; p = Getattr(p, "tmap:in:next")) {
|
||||
+ Printf(s_arginfo, " ZEND_ARG_INFO(%d,%s)\n", GetFlag(p, "tmap:in:byref"), Getattr(p, "lname"));
|
||||
}
|
||||
Printf(s_arginfo, "ZEND_END_ARG_INFO()\n");
|
||||
}
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 7d5824a06b5..1894001c521 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -2021,7 +2021,7 @@ AC_SUBST(RUBYSO)
|
||||
AC_SUBST(RUBYDYNAMICLINKING)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
-# Look for PHP7
|
||||
+# Look for PHP
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
PHPBIN=
|
||||
@@ -2035,7 +2035,7 @@ if test x"${PHPBIN}" = xno; then
|
||||
PHP=
|
||||
else
|
||||
if test "x$PHPBIN" = xyes; then
|
||||
- AC_CHECK_PROGS(PHP, [php7.3 php7.2 php7.1 php7.0 php])
|
||||
+ AC_CHECK_PROGS(PHP, [php8.0 php7.4 php7.3 php7.2 php7.1 php7.0 php])
|
||||
else
|
||||
PHP=$PHPBIN
|
||||
fi
|
||||
@@ -2046,12 +2046,14 @@ else
|
||||
case $PHP in
|
||||
*7.*)
|
||||
PHPCONFIG=`echo "$PHP"|sed 's/7\...*$/-config&/'` ;;
|
||||
+ *8.*)
|
||||
+ PHPCONFIG=`echo "$PHP"|sed 's/8\...*$/-config&/'` ;;
|
||||
*)
|
||||
PHPCONFIG=$PHP-config ;;
|
||||
esac
|
||||
php_version=`$PHPCONFIG --version 2>/dev/null`
|
||||
case $php_version in
|
||||
- 7.*)
|
||||
+ 7.*|8.*)
|
||||
PHPINC=`$PHPCONFIG --includes 2>/dev/null`
|
||||
if test -n "$PHPINC"; then
|
||||
AC_MSG_RESULT($PHPINC)
|
||||
@@ -2062,7 +2064,7 @@ else
|
||||
"")
|
||||
AC_MSG_RESULT([could not find $PHPCONFIG or obtain PHP version from it]) ;;
|
||||
*)
|
||||
- AC_MSG_RESULT([found PHP $php_version - not PHP 7]) ;;
|
||||
+ AC_MSG_RESULT([found PHP $php_version - not PHP 7 or 8]) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
From fd96627b2fc65353c03b160efd60fdce864d386c Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Wed, 17 Mar 2021 13:00:02 +1300
|
||||
Subject: [PATCH 2/4] Temporary hack so testsuite passes for PHP8
|
||||
|
||||
---
|
||||
Examples/test-suite/director_overload2.i | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Examples/test-suite/director_overload2.i b/Examples/test-suite/director_overload2.i
|
||||
index e467c18cea6..ddfa65bb4d3 100644
|
||||
--- a/Examples/test-suite/director_overload2.i
|
||||
+++ b/Examples/test-suite/director_overload2.i
|
||||
@@ -14,11 +14,15 @@ struct OverloadDerived1 : OverloadBase {
|
||||
virtual void nnn(int vvv) {}
|
||||
#if defined(__SUNPRO_CC)
|
||||
virtual void nnn() {}
|
||||
+#elif defined(SWIGPHP) // FIXME: Hack to stop director_overload2 failing for PHP8
|
||||
+ virtual void nnn() {}
|
||||
#endif
|
||||
};
|
||||
struct OverloadDerived2 : OverloadBase {
|
||||
#if defined(__SUNPRO_CC)
|
||||
virtual void nnn(int vvv) {}
|
||||
+#elif defined(SWIGPHP) // FIXME: Hack to stop director_overload2 failing for PHP8
|
||||
+ virtual void nnn(int vvv) {}
|
||||
#endif
|
||||
virtual void nnn() {}
|
||||
};
|
||||
|
||||
From 4c3e85fbd47f804b5956bf37f0073795296ddde2 Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Sun, 21 Mar 2021 10:43:06 +1300
|
||||
Subject: [PATCH 3/4] Clarify what SWIGPHP7 means
|
||||
|
||||
---
|
||||
Doc/Manual/Preprocessor.html | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
|
||||
index 0c704bde959..7611ea40c2b 100644
|
||||
--- a/Doc/Manual/Preprocessor.html
|
||||
+++ b/Doc/Manual/Preprocessor.html
|
||||
@@ -123,7 +123,7 @@ <H2><a name="Preprocessor_condition_compilation">11.3 Conditional Compilation</a
|
||||
SWIGOCTAVE Defined when using Octave
|
||||
SWIGPERL Defined when using Perl
|
||||
SWIGPHP Defined when using PHP (any version)
|
||||
-SWIGPHP7 Defined when using PHP 7 or later
|
||||
+SWIGPHP7 Defined when using PHP 7 or later (with a compatible C API)
|
||||
SWIGPYTHON Defined when using Python
|
||||
SWIGR Defined when using R
|
||||
SWIGRUBY Defined when using Ruby
|
||||
|
||||
From d18f98c24d9ee0e15457e0e91de2689ad591d1db Mon Sep 17 00:00:00 2001
|
||||
From: Olly Betts <olly@survex.com>
|
||||
Date: Sun, 21 Mar 2021 10:54:17 +1300
|
||||
Subject: [PATCH 4/4] Update CHANGES.current and RELEASENOTES re PHP8
|
||||
|
||||
---
|
||||
CHANGES.current | 3 +++
|
||||
RELEASENOTES | 3 +++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
#diff --git a/CHANGES.current b/CHANGES.current
|
||||
#index 79d41001f0a..6ae5689ee37 100644
|
||||
#--- a/CHANGES.current
|
||||
#+++ b/CHANGES.current
|
||||
#@@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||
# Version 4.1.0 (in progress)
|
||||
# ===========================
|
||||
#
|
||||
#+2021-03-21: olly
|
||||
#+ #1929, #1978 [PHP] Add support for PHP 8.
|
||||
#+
|
||||
# 2021-03-19: olly
|
||||
# #1527 [PHP] Improve PHP object creation in directorin case.
|
||||
# Reportedly the code we were using in this case gave segfaults in
|
||||
diff --git a/RELEASENOTES b/RELEASENOTES
|
||||
index cc3ba07121d..55590108759 100644
|
||||
--- a/RELEASENOTES
|
||||
+++ b/RELEASENOTES
|
||||
@@ -7,6 +7,9 @@ Release Notes
|
||||
Detailed release notes are available with the release and are also
|
||||
published on the SWIG web site at http://swig.org/release.html.
|
||||
|
||||
+SWIG-4.2.0 summary:
|
||||
+- Add PHP 8 support.
|
||||
+
|
||||
SWIG-4.0.2 summary:
|
||||
- A few fixes around doxygen comment handling.
|
||||
- Ruby 2.7 support added.
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,346 +0,0 @@
|
|||
From 582e3a3fee8a7cfe5903da1c4b0db8e40d5d2deb Mon Sep 17 00:00:00 2001
|
||||
From: Robert Fries <robert_fries@partech.com>
|
||||
Date: Wed, 12 May 2021 19:44:17 -0400
|
||||
Subject: [PATCH 2/5] Allow swig wrapped modules to compile with -Bsymbolic
|
||||
|
||||
---
|
||||
Lib/octave/octrun.swg | 8 ++++++++
|
||||
Lib/octave/octruntime.swg | 2 ++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
|
||||
index 1069e0e54b7..a7291df1478 100644
|
||||
--- a/Lib/octave/octrun.swg
|
||||
+++ b/Lib/octave/octrun.swg
|
||||
@@ -1178,6 +1178,10 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
#endif
|
||||
{ return ptr->print(os, pr_as_read_syntax); }
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
+ static void set_type_id(int type_id) { t_id=type_id; }
|
||||
+#endif
|
||||
+
|
||||
virtual type_conv_info numeric_conversion_function(void) const {
|
||||
return octave_base_value::type_conv_info (default_numeric_conversion_function,
|
||||
octave_scalar::static_type_id ());
|
||||
@@ -1285,6 +1289,10 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
+ static void set_type_id(int type_id) { t_id=type_id; }
|
||||
+#endif
|
||||
+
|
||||
private:
|
||||
#if !SWIG_OCTAVE_PREREQ(4,0,0)
|
||||
DECLARE_OCTAVE_ALLOCATOR;
|
||||
diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg
|
||||
index a397fb7c189..ca69e44c48f 100644
|
||||
--- a/Lib/octave/octruntime.swg
|
||||
+++ b/Lib/octave/octruntime.swg
|
||||
@@ -295,9 +295,11 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
||||
for (int i = 0; i < types.numel(); ++i) {
|
||||
if (types(i) == octave_swig_ref::static_type_name()) {
|
||||
register_octave_swig_ref = false;
|
||||
+ octave_swig_ref::set_type_id(i);
|
||||
}
|
||||
if (types(i) == octave_swig_packed::static_type_name()) {
|
||||
register_octave_swig_packed = false;
|
||||
+ octave_swig_packed::set_type_id(i);
|
||||
}
|
||||
}
|
||||
if (register_octave_swig_ref) {
|
||||
|
||||
From 2536f07ec26a06adb4290747cd229928b569ed72 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Fries <robert_fries@partech.com>
|
||||
Date: Wed, 12 May 2021 19:45:24 -0400
|
||||
Subject: [PATCH 3/5] Octave module lets examples and tests work with Octave-6
|
||||
* Try-catch replacement for check of error_state * Add execute method in
|
||||
addition to call * Replace oct_mach_info with octave::mach_info * Call
|
||||
from interpreter: global_varval global_assign * Assign a global name
|
||||
requires locating the stack which requires interpreter to tree evaluator
|
||||
to callStack * Do not use discard_error_messages or
|
||||
discard_warning_messages
|
||||
|
||||
---
|
||||
Lib/octave/octcontainer.swg | 11 +++++-
|
||||
Lib/octave/octrun.swg | 69 ++++++++++++++++++++++++++++++++++---
|
||||
Lib/octave/octruntime.swg | 12 +++++--
|
||||
3 files changed, 83 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg
|
||||
index 80d593f4fd5..85954acb031 100644
|
||||
--- a/Lib/octave/octcontainer.swg
|
||||
+++ b/Lib/octave/octcontainer.swg
|
||||
@@ -569,8 +569,17 @@ namespace swig {
|
||||
} else {
|
||||
return octseq.check() ? SWIG_OK : SWIG_ERROR;
|
||||
}
|
||||
- } catch (std::exception& e) {
|
||||
+ }
|
||||
+%#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ catch (octave::execution_exception& exec) {
|
||||
+ }
|
||||
+%#endif
|
||||
+ catch (std::exception& e) {
|
||||
+%#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ if (seq) // Know that octave is not in an error state
|
||||
+%#else
|
||||
if (seq&&!error_state)
|
||||
+%#endif
|
||||
error("swig type error: %s",e.what());
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
|
||||
index a7291df1478..68bdeea0993 100644
|
||||
--- a/Lib/octave/octrun.swg
|
||||
+++ b/Lib/octave/octrun.swg
|
||||
@@ -171,7 +171,16 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
|
||||
octave_function* function_value(bool = false) { return this; }
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
+ return execute(tw,nargout,args);
|
||||
+ }
|
||||
+#endif
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave_value_list execute(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
+#else
|
||||
octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
+#endif
|
||||
octave_value_list all_args;
|
||||
all_args.append(first_args);
|
||||
all_args.append(args);
|
||||
@@ -456,10 +465,20 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
// Fill in dim_vector
|
||||
for (int k=0;k<ndim;k++) {
|
||||
const octave_value& obj = c(k);
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ try {
|
||||
+ d.elem(k) = obj.int_value();
|
||||
+ }
|
||||
+ catch (octave::execution_exception& oee) {
|
||||
+ // __dims__ should return a cell filled with integers
|
||||
+ return dim_vector(1,1);
|
||||
+ }
|
||||
+#else
|
||||
d.elem(k) = obj.int_value();
|
||||
|
||||
// __dims__ should return a cell filled with integers
|
||||
if (error_state) return dim_vector(1,1);
|
||||
+#endif
|
||||
}
|
||||
return d;
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
@@ -468,8 +487,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
} else if (out.is_matrix_type() || out.is_numeric_type() ) {
|
||||
#endif
|
||||
if (out.rows()==1 || out.columns()==1) {
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ Array<int> a;
|
||||
+ try {
|
||||
+ a = out.int_vector_value();
|
||||
+ }
|
||||
+ catch (octave::execution_exception& oee) {
|
||||
+ return dim_vector(1,1);
|
||||
+ }
|
||||
+#else
|
||||
Array<int> a = out.int_vector_value();
|
||||
if (error_state) return dim_vector(1,1);
|
||||
+#endif
|
||||
dim_vector d;
|
||||
d.resize(a.numel() < 2 ? 2 : a.numel());
|
||||
d(0) = d(1) = 1;
|
||||
@@ -874,7 +903,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
}
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
- oct_mach_info::float_format fmt) {
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::mach_info::float_format fmt) {
|
||||
+#else
|
||||
+ oct_mach_info::float_format fmt) {
|
||||
+#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1142,7 +1175,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
{ return ptr->save_binary(os, save_as_floats); }
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
- oct_mach_info::float_format fmt)
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::mach_info::float_format fmt)
|
||||
+#else
|
||||
+ oct_mach_info::float_format fmt)
|
||||
+#endif
|
||||
{ return ptr->load_binary(is, swap, fmt); }
|
||||
|
||||
#if defined (HAVE_HDF5)
|
||||
@@ -1261,7 +1298,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
}
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
- oct_mach_info::float_format fmt) {
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::mach_info::float_format fmt) {
|
||||
+#else
|
||||
+ oct_mach_info::float_format fmt) {
|
||||
+#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1515,16 +1556,24 @@ SWIGRUNTIMEINLINE void SWIG_Octave_SetConstant(octave_swig_type *module_ns, cons
|
||||
}
|
||||
|
||||
SWIGRUNTIMEINLINE octave_value SWIG_Octave_GetGlobalValue(std::string name) {
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
+ return interp->global_varval(name);
|
||||
+#else
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
return symtab.global_varval(name);
|
||||
#else
|
||||
return get_global_value(name, true);
|
||||
#endif
|
||||
+#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value& value) {
|
||||
-#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
+ interp->global_assign(name, value);
|
||||
+#elif SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
symtab.global_assign(name, value);
|
||||
#else
|
||||
@@ -1534,10 +1583,20 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value
|
||||
|
||||
SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
- octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
octave::symbol_scope symscope = octave::interpreter::the_interpreter()->get_current_scope();
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
+ interp->assign(name, interp->global_varval(name));
|
||||
+ octave::tree_evaluator& tree_eval = interp->get_evaluator();
|
||||
+ octave::call_stack& callStack = tree_eval.get_call_stack();
|
||||
+ std::shared_ptr<octave::stack_frame> stackFrame = callStack.get_current_stack_frame();
|
||||
+ octave::symbol_record sym=symscope.lookup_symbol(name);
|
||||
+ stackFrame->mark_global(sym);
|
||||
+#else
|
||||
+ octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
symscope.assign(name, symtab.global_varval(name));
|
||||
symscope.mark_global(name);
|
||||
+#endif
|
||||
#else
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
link_to_global_variable(curr_sym_tab->lookup(name, true));
|
||||
diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg
|
||||
index ca69e44c48f..e76151f146b 100644
|
||||
--- a/Lib/octave/octruntime.swg
|
||||
+++ b/Lib/octave/octruntime.swg
|
||||
@@ -19,7 +19,8 @@ static bool SWIG_init_user(octave_swig_type* module_ns);
|
||||
SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
||||
bool retn = false;
|
||||
{
|
||||
-#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+#elif SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
octave::unwind_protect frame;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
@@ -62,7 +63,8 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
||||
SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
|
||||
bool retn = false;
|
||||
{
|
||||
-#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+#elif SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
octave::unwind_protect frame;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
@@ -316,7 +318,11 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
||||
SWIG_InitializeModule(0);
|
||||
SWIG_PropagateClientData();
|
||||
|
||||
-#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator();
|
||||
+ octave::call_stack& stack = tree_eval.get_call_stack();
|
||||
+ octave_function *me = stack.current_function();
|
||||
+#elif SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::call_stack& stack = octave::interpreter::the_interpreter()->get_call_stack();
|
||||
octave_function *me = stack.current();
|
||||
#else
|
||||
|
||||
From 0bf0d58c52e477cae99986b7c7a656c09d50aa43 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Fries <robert_fries@partech.com>
|
||||
Date: Wed, 12 May 2021 20:22:30 -0400
|
||||
Subject: [PATCH 4/5] Additional changes due to name changes in octave-6 *
|
||||
is_map to isstruct, is_object to isobject
|
||||
|
||||
---
|
||||
Lib/octave/octrun.swg | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
|
||||
index 68bdeea0993..e95f9e9de6b 100644
|
||||
--- a/Lib/octave/octrun.swg
|
||||
+++ b/Lib/octave/octrun.swg
|
||||
@@ -660,7 +660,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
return true;
|
||||
}
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ virtual bool isstruct() const {
|
||||
+#else
|
||||
virtual bool is_map() const {
|
||||
+#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -808,7 +812,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
return as_value();
|
||||
}
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ virtual bool isobject() const {
|
||||
+#else
|
||||
virtual bool is_object() const {
|
||||
+#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1117,8 +1125,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
bool is_defined() const
|
||||
{ return ptr->is_defined(); }
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ virtual bool isstruct() const
|
||||
+ { return ptr->isstruct(); }
|
||||
+#else
|
||||
virtual bool is_map() const
|
||||
{ return ptr->is_map(); }
|
||||
+#endif
|
||||
|
||||
virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx)
|
||||
{ return ptr->subsref(ops, idx); }
|
||||
@@ -1129,8 +1142,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
||||
octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs)
|
||||
{ return ptr->subsasgn(ops, idx, rhs); }
|
||||
|
||||
+#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
+ virtual bool isobject() const
|
||||
+ { return ptr->isobject(); }
|
||||
+#else
|
||||
virtual bool is_object() const
|
||||
{ return ptr->is_object(); }
|
||||
+#endif
|
||||
|
||||
virtual bool is_string() const
|
||||
{ return ptr->is_string(); }
|
||||
|
||||
153
swig-python-Python-3.14-support.patch
Normal file
153
swig-python-Python-3.14-support.patch
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
From 50e1cc8bc0d090164762ec166439f8b0f3855308 Mon Sep 17 00:00:00 2001
|
||||
From: Julien Schueller <schueller@phimeca.com>
|
||||
Date: Thu, 10 Apr 2025 17:22:15 +0200
|
||||
Subject: [PATCH 1/3] Python: Handle __package__ removal
|
||||
|
||||
Closes #2967
|
||||
---
|
||||
Doc/Manual/Python.html | 6 +++---
|
||||
Source/Modules/python.cxx | 8 +++++---
|
||||
2 files changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
|
||||
index 23587e5dbcc..01fc449a68a 100644
|
||||
--- a/Doc/Manual/Python.html
|
||||
+++ b/Doc/Manual/Python.html
|
||||
@@ -6552,7 +6552,7 @@ <H4><a name="Python_package_search_both_package_modules">33.11.6.1 Both modules
|
||||
|
||||
<p>
|
||||
In this configuration, the pure Python module, foo.py, tries to load the C/C++ module, _foo, from the same package foo.py is
|
||||
-located in. The package name is determined from the <tt>__package__</tt>
|
||||
+located in. The package name is determined from the <tt>__spec__.parent</tt> (or <tt>__package__</tt> before Python 3.4)
|
||||
attribute if available, see <a href="https://www.python.org/dev/peps/pep-0366/">PEP 366</a>. Otherwise it is derived from the <tt>__name__</tt>
|
||||
attribute given to foo.py by the Python loader that imported foo.py.
|
||||
The interface file for this configuration would contain:
|
||||
@@ -6675,7 +6675,7 @@ <H4><a name="Python_custom_module_import">33.11.6.4 More on customizing the modu
|
||||
|
||||
<div class="targetlang">
|
||||
<pre>
|
||||
-if __package__ or '.' in __name__:
|
||||
+if getattr(__spec__, "parent", None) or '.' in __name__:
|
||||
from . import _foo
|
||||
else:
|
||||
import _foo
|
||||
@@ -6760,7 +6760,7 @@ <H4><a name="Python_custom_module_import">33.11.6.4 More on customizing the modu
|
||||
|
||||
<div class="targetlang">
|
||||
<pre>
|
||||
-if __package__ or '.' in __name__:
|
||||
+if getattr(__spec__, "parent", None) or '.' in __name__:
|
||||
from ._foo import *
|
||||
else:
|
||||
from _foo import *
|
||||
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
|
||||
index 86daf131c8b..a71fc3cdb25 100644
|
||||
--- a/Source/Modules/python.cxx
|
||||
+++ b/Source/Modules/python.cxx
|
||||
@@ -703,20 +703,22 @@ class PYTHON:public Language {
|
||||
* onwards (implicit relative imports raised a DeprecationWarning in 2.6,
|
||||
* and fail in 2.7 onwards).
|
||||
*
|
||||
- * First check for __package__ which is available from 2.6 onwards, see PEP366.
|
||||
+ * First check for __spec__.parent which is available from 3.4 onwards,
|
||||
+ * see https://docs.python.org/3/reference/import.html#spec. If not,
|
||||
+ * check for __package__, which was set before 3.14.
|
||||
* Next try determine the shadow wrapper's package based on the __name__ it
|
||||
* was given by the importer that loaded it.
|
||||
* If the module is in a package, load the low-level C/C++ module from the
|
||||
* same package, otherwise load it as a global module.
|
||||
*/
|
||||
Printv(default_import_code, "# Import the low-level C/C++ module\n", NULL);
|
||||
- Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
|
||||
+ Printv(default_import_code, "if getattr(globals().get(\"__spec__\"), \"parent\", None) or globals().get(\"__package__\") or \".\" in __name__:\n", NULL);
|
||||
Printv(default_import_code, tab4, "from . import ", module, "\n", NULL);
|
||||
Printv(default_import_code, "else:\n", NULL);
|
||||
Printv(default_import_code, tab4, "import ", module, "\n", NULL);
|
||||
} else {
|
||||
Printv(default_import_code, "# Pull in all the attributes from the low-level C/C++ module\n", NULL);
|
||||
- Printv(default_import_code, "if __package__ or \".\" in __name__:\n", NULL);
|
||||
+ Printv(default_import_code, "if getattr(globals().get(\"__spec__\"), \"parent\", None) or globals().get(\"__package__\") or \".\" in __name__:\n", NULL);
|
||||
Printv(default_import_code, tab4, "from .", module, " import *\n", NULL);
|
||||
Printv(default_import_code, "else:\n", NULL);
|
||||
Printv(default_import_code, tab4, "from ", module, " import *\n", NULL);
|
||||
|
||||
From 3bfdf13c602f877860a9949ba751a5b5a9ba70aa Mon Sep 17 00:00:00 2001
|
||||
From: Julien Schueller <schueller@phimeca.com>
|
||||
Date: Thu, 10 Apr 2025 18:35:25 +0200
|
||||
Subject: [PATCH 2/3] Python: Add ht_token
|
||||
|
||||
---
|
||||
Source/Modules/python.cxx | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
|
||||
index a71fc3cdb25..3070a94face 100644
|
||||
--- a/Source/Modules/python.cxx
|
||||
+++ b/Source/Modules/python.cxx
|
||||
@@ -4374,6 +4374,11 @@ class PYTHON:public Language {
|
||||
Printv(f, "#if PY_VERSION_HEX >= 0x030b0000\n", NIL);
|
||||
printSlot(f, getSlot(n, "feature:python:_ht_tpname"), "_ht_tpname", "char *");
|
||||
|
||||
+ // void *ht_token;
|
||||
+ Printv(f, "#if PY_VERSION_HEX >= 0x030e0000\n", NIL);
|
||||
+ printSlot(f, getSlot(n, "feature:python:ht_token"), "ht_token", "void *");
|
||||
+ Printv(f, "#endif\n", NIL);
|
||||
+
|
||||
// struct _specialization_cache _spec_cache;
|
||||
Printf(f, " {\n");
|
||||
printSlot(f, getSlot(n, "feature:python:getitem"), "getitem", "PyObject *");
|
||||
|
||||
From 55237efa7219f65a04e0ffc69a81c574b5f5e162 Mon Sep 17 00:00:00 2001
|
||||
From: Julien Schueller <schueller@phimeca.com>
|
||||
Date: Thu, 10 Apr 2025 17:47:59 +0200
|
||||
Subject: [PATCH 3/3] Python: Amend annotations test
|
||||
|
||||
---
|
||||
.../python_annotations_variable_c_runme.py | 24 +++++++++++++------
|
||||
1 file changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Examples/test-suite/python/python_annotations_variable_c_runme.py b/Examples/test-suite/python/python_annotations_variable_c_runme.py
|
||||
index 153852d05e6..d1f359bbbd0 100644
|
||||
--- a/Examples/test-suite/python/python_annotations_variable_c_runme.py
|
||||
+++ b/Examples/test-suite/python/python_annotations_variable_c_runme.py
|
||||
@@ -1,4 +1,17 @@
|
||||
import sys
|
||||
+import inspect
|
||||
+
|
||||
+
|
||||
+def get_annotations(cls):
|
||||
+ # Python >=3.14 removed the __annotations__ attribute
|
||||
+ # retrieve it via inspect (see also annotationlib)
|
||||
+ if hasattr(inspect, "get_annotations"):
|
||||
+ # Python >=3.10
|
||||
+ return inspect.get_annotations(cls)
|
||||
+ else:
|
||||
+ # Python <3.10
|
||||
+ return getattr(cls, "__annotations__", {})
|
||||
+
|
||||
|
||||
# Variable annotations for properties is only supported in python-3.6 and later (PEP 526)
|
||||
if sys.version_info[0:2] >= (3, 6):
|
||||
@@ -8,17 +21,14 @@
|
||||
annotations_supported = not(is_python_builtin() or is_python_fastproxy())
|
||||
|
||||
if annotations_supported:
|
||||
- ts = TemplateShort()
|
||||
- anno = ts.__annotations__
|
||||
+ anno = get_annotations(TemplateShort)
|
||||
if anno != {'member_variable': 'int'}:
|
||||
raise RuntimeError("annotations mismatch: {}".format(anno))
|
||||
|
||||
- ts = StructWithVar()
|
||||
- anno = ts.__annotations__
|
||||
+ anno = get_annotations(StructWithVar)
|
||||
if anno != {'member_variable': 'int'}:
|
||||
raise RuntimeError("annotations mismatch: {}".format(anno))
|
||||
|
||||
- ts = StructWithVarNotAnnotated()
|
||||
- if getattr(ts, "__annotations__", None) != None:
|
||||
- anno = ts.__annotations__
|
||||
+ anno = get_annotations(StructWithVarNotAnnotated)
|
||||
+ if anno != {}:
|
||||
raise RuntimeError("annotations mismatch: {}".format(anno))
|
||||
|
||||
233
swig.spec
233
swig.spec
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
%if %{without testsuite}
|
||||
%global tcl 0
|
||||
%global guile 0
|
||||
%global lualang 0
|
||||
%global perllang 0
|
||||
%global phplang 0
|
||||
|
|
@ -12,39 +13,54 @@
|
|||
%global octave 0
|
||||
%global Rlang 0
|
||||
%global javalang 0
|
||||
%global ocamllang 0
|
||||
%endif
|
||||
|
||||
%{!?tcl:%global tcl 1}
|
||||
%{!?guile:%global guile 0}
|
||||
%{!?lualang:%global lualang 1}
|
||||
%{!?perllang:%global perllang 1}
|
||||
%{!?phplang:%global phplang 1}
|
||||
# Disable Ruby test failed with swig 4.0.0 on s390
|
||||
%ifarch s390x %{power64}
|
||||
%{!?rubylang:%global rubylang 0}
|
||||
%else
|
||||
%{!?rubylang:%global rubylang 1}
|
||||
%endif
|
||||
%{!?python3lang:%global python3lang 1}
|
||||
|
||||
# PHP drop support for 32-bit builds since Fedora 41.
|
||||
%if 0%{?fedora} >= 41 || 0%{?rhel} >= 11
|
||||
%ifarch %{ix86}
|
||||
%global phplang 0
|
||||
%endif
|
||||
%endif
|
||||
%{!?phplang:%global phplang 1}
|
||||
|
||||
# OCaml packages not built on i686 since OCaml 5 / Fedora 39.
|
||||
%ifarch %{ix86}
|
||||
%{!?ocamllang:%global ocamllang 0}
|
||||
%else
|
||||
%{!?ocamllang:%global ocamllang 1}
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel}
|
||||
%{!?golang:%global golang 0}
|
||||
%{!?guile:%global guile 0}
|
||||
%{!?octave:%global octave 0}
|
||||
%{!?Rlang:%global Rlang 0}
|
||||
%bcond_with build_ccache_swig
|
||||
%else
|
||||
%{!?guile:%global guile 1}
|
||||
%{!?octave:%global octave 1}
|
||||
%{!?Rlang:%global Rlang 1}
|
||||
# R-core requires tcl < 9.0.0
|
||||
%{!?Rlang:%global Rlang 0}
|
||||
%bcond_without build_ccache_swig
|
||||
%endif
|
||||
%ifarch aarch64 %{arm} %{mips} ppc %{power64} s390 s390x
|
||||
|
||||
%ifarch %{ix86}
|
||||
%{!?javalang:%global javalang 0}
|
||||
%else
|
||||
# Temporary disable java tests, because they doesn't pass with java-21-openjdk
|
||||
# https://github.com/swig/swig/issues/2767
|
||||
%{!?javalang:%global javalang 1}
|
||||
%endif
|
||||
|
||||
# Do not run Go tests, they failed with 4.0.0 on ppc64le
|
||||
%ifarch %{ix86} x86_64 %{arm} aarch64
|
||||
# Do not run Go tests, they failed with 4.0.0 on ppc64le, s390
|
||||
%ifarch x86_64 %{arm} aarch64
|
||||
%{!?golang:%global golang 1}
|
||||
%else
|
||||
%{!?golang:%global golang 0}
|
||||
|
|
@ -52,10 +68,10 @@
|
|||
|
||||
Summary: Connects C/C++/Objective C to some high-level programming languages
|
||||
Name: swig
|
||||
Version: 4.0.2
|
||||
Release: 10%{?dist}
|
||||
License: GPLv3+ and BSD
|
||||
URL: http://swig.sourceforge.net/
|
||||
Version: 4.4.1
|
||||
Release: 1%{?dist}
|
||||
License: GPL-3.0-or-later AND BSD-3-Clause
|
||||
URL: https://www.swig.org/
|
||||
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
|
||||
# Define the part of man page sections
|
||||
Source1: description.h2m
|
||||
|
|
@ -65,24 +81,15 @@ Source3: ccache-swig.sh
|
|||
Source4: ccache-swig.csh
|
||||
%endif
|
||||
|
||||
# https://github.com/swig/swig/pull/1702
|
||||
Patch0: swig-Upgrade-to-support-newer-NodeJS.patch
|
||||
# Backport PHP 7.x and 8 updates
|
||||
Patch1: swig-4.0.2-Fix-overloaded-directed-methods-with-non-void-re.patch
|
||||
Patch2: swig-4.0.2-Fix-char-typecheck-typemap-to-accept-Null.patch
|
||||
Patch3: swig-4.0.2-Improve-PHP-object-creation.patch
|
||||
Patch4: swig-4.0.2-Support-PHP8.patch
|
||||
# octave 6 support - rebased version of https://github.com/swig/swig/pull/2020
|
||||
Patch5: swig-octave-6.patch
|
||||
# Fix overload_simple_cast test with Python 3.10 GH#2044
|
||||
Patch6: swig-4.0.2-Fix-overload_simple_cast-test-with-Python-3.10.patch
|
||||
|
||||
BuildRequires: coreutils
|
||||
BuildRequires: findutils
|
||||
BuildRequires: make
|
||||
BuildRequires: perl-interpreter, pcre-devel
|
||||
BuildRequires: perl-interpreter, pcre2-devel
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: autoconf, automake, gawk, dos2unix
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: help2man
|
||||
BuildRequires: sed
|
||||
BuildRequires: perl-devel
|
||||
BuildRequires: perl(base)
|
||||
BuildRequires: perl(Config)
|
||||
|
|
@ -98,7 +105,7 @@ BuildRequires: boost-devel
|
|||
# Need when Source/CParse/parser.y is patched
|
||||
BuildRequires: bison
|
||||
%if %{tcl}
|
||||
BuildRequires: tcl-devel
|
||||
BuildRequires: tcl-devel >= 9.0.0
|
||||
%endif
|
||||
%if %{guile}
|
||||
BuildRequires: guile-devel
|
||||
|
|
@ -109,7 +116,9 @@ BuildRequires: octave-devel
|
|||
%if %{golang}
|
||||
BuildRequires: golang
|
||||
BuildRequires: golang-bin
|
||||
%ifnarch s390x
|
||||
BuildRequires: golang-shared
|
||||
%endif
|
||||
BuildRequires: golang-src
|
||||
%endif
|
||||
%if %{lualang}
|
||||
|
|
@ -127,6 +136,10 @@ BuildRequires: java, java-devel
|
|||
%if %{phplang}
|
||||
BuildRequires: php, php-devel
|
||||
%endif
|
||||
%if %{ocamllang}
|
||||
BuildRequires: ocaml
|
||||
BuildRequires: ocaml-findlib
|
||||
%endif
|
||||
|
||||
%description
|
||||
Simplified Wrapper and Interface Generator (SWIG) is a software
|
||||
|
|
@ -144,7 +157,7 @@ testing and prototyping C/C++ software.
|
|||
%if %{with build_ccache_swig}
|
||||
%package -n ccache-swig
|
||||
Summary: Fast compiler cache
|
||||
License: GPLv2+
|
||||
License: GPL-2.0-or-later
|
||||
Requires: swig
|
||||
Conflicts: swig < 3.0.8-2
|
||||
|
||||
|
|
@ -156,7 +169,7 @@ being done again. ccache-swig is ccache plus support for SWIG.
|
|||
|
||||
%package doc
|
||||
Summary: Documentation files for SWIG
|
||||
License: BSD
|
||||
License: BSD-3-Clause
|
||||
BuildArch: noarch
|
||||
|
||||
%description doc
|
||||
|
|
@ -164,7 +177,7 @@ This package contains documentation for SWIG and useful examples
|
|||
|
||||
%package gdb
|
||||
Summary: Commands for easier debugging of SWIG
|
||||
License: BSD
|
||||
License: BSD-3-Clause
|
||||
Requires: swig
|
||||
|
||||
%description gdb
|
||||
|
|
@ -186,13 +199,14 @@ done
|
|||
# Disable maximum compile warnings when octave is supported, because Octave
|
||||
# code produces lots of the warnings demanded by strict ISO C and ISO C++.
|
||||
# It causes that log had more then 600M.
|
||||
# AC_CHECK_PROGS requires just the name, so use for configure
|
||||
# --with-python3=python3 --with-2to3=2to3
|
||||
%configure \
|
||||
%if %{ocamllang}
|
||||
--with-ocaml \
|
||||
%else
|
||||
--without-ocaml \
|
||||
%endif
|
||||
%if %{python3lang}
|
||||
--with-python3=python3 \
|
||||
--with-2to3=2to3 \
|
||||
%else
|
||||
--without-python3 \
|
||||
%endif
|
||||
|
|
@ -216,6 +230,9 @@ done
|
|||
%if ! %{golang}
|
||||
--without-go \
|
||||
%endif
|
||||
%if ! %{guile}
|
||||
--without-guile \
|
||||
%endif
|
||||
%if %{octave}
|
||||
--with-octave=%{_bindir}/octave \
|
||||
--without-maximum-compile-warnings \
|
||||
|
|
@ -346,6 +363,152 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
|
|||
%{_datadir}/%{name}/gdb
|
||||
|
||||
%changelog
|
||||
* Mon Dec 08 2025 Jitka Plesnikova <jplesnik@redhat.com> - 4.4.1-1
|
||||
- 4.4.1 bump (rhbz#2419819, rhbz#2415440)
|
||||
|
||||
* Tue Oct 21 2025 Jitka Plesnikova <jplesnik@redhat.com> - 4.4.0-1
|
||||
- 4.4.0 bump (rhbz#2405182)
|
||||
|
||||
* Mon Oct 13 2025 Richard W.M. Jones <rjones@redhat.com> - 4.3.1-6
|
||||
- OCaml 5.4.0 rebuild
|
||||
|
||||
* Thu Aug 07 2025 Orion Poplawski <orion@nwra.com> - 4.3.1-5
|
||||
- Rebuild for Octave 10.2
|
||||
|
||||
* Thu Jul 31 2025 Jitka Plesnikova <jplesnik@redhat.com> - 4.3.1-4
|
||||
- Fix Python DeprecationWarning
|
||||
|
||||
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Wed Jun 25 2025 Yaakov Selkowitz <yselkowi@redhat.com> - 4.3.1-2
|
||||
- Add Python 3.14 support
|
||||
|
||||
* Wed Apr 16 2025 Jitka Plesnikova <jplesnik@redhat.com> - 4.3.1-1
|
||||
- 4.3.1 bump (rhbz#2360009)
|
||||
|
||||
* Mon Feb 17 2025 Jitka Plesnikova <jplesnik@redhat.com> - 4.3.0-5
|
||||
- Disable R tests, because they need tcl < 9
|
||||
|
||||
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Thu Nov 14 2024 Orion Poplawski <orion@nwra.com> - 4.3.0-3
|
||||
- Rebuild for octave 9.2
|
||||
|
||||
* Tue Oct 29 2024 Jitka Plesnikova <jplesnik@redhat.com> - 4.3.0-2
|
||||
- Fix precedence of casts
|
||||
|
||||
* Mon Oct 21 2024 Jitka Plesnikova <jplesnik@redhat.com> - 4.3.0-1
|
||||
- 4.3.0 bump (rhbz#2320047)
|
||||
|
||||
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Sun Jun 23 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 4.2.1-7
|
||||
- Rebuild for Python 3.13
|
||||
|
||||
* Wed Jun 19 2024 Richard W.M. Jones <rjones@redhat.com> - 4.2.1-6
|
||||
- OCaml 5.2.0 ppc64le fix
|
||||
|
||||
* Wed May 29 2024 Richard W.M. Jones <rjones@redhat.com> - 4.2.1-5
|
||||
- OCaml 5.2.0 for Fedora 41
|
||||
|
||||
* Mon Apr 29 2024 Jitka Plesnikova <jplesnik@redhat.com> - 4.2.1-4
|
||||
- Fix gcc's -Wformat-security warning in R Raise function (rhbz#2277767)
|
||||
|
||||
* Fri Apr 12 2024 Remi Collet <remi@remirepo.net> - 4.2.1-3
|
||||
- disable PHP support on 32-bit
|
||||
https://fedoraproject.org/wiki/Changes/php_no_32_bit
|
||||
|
||||
* Tue Feb 27 2024 Jiri Vanek <jvanek@redhat.com> - 4.2.1-2
|
||||
- Rebuilt for java-21-openjdk as system jdk
|
||||
- Temporary disable java tests (rhbz#2266693)
|
||||
|
||||
* Mon Feb 26 2024 Jitka Plesnikova <jplesnik@redhat.com> - 4.2.1-1
|
||||
- 4.2.1 bump (rhbz#2265786)
|
||||
|
||||
* Tue Jan 23 2024 Jitka Plesnikova <jplesnik@redhat.com> - 4.2.0-1
|
||||
- 4.2.0 bump
|
||||
|
||||
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 4.1.1-15
|
||||
- OCaml 5.1.1 + s390x code gen fix for Fedora 40
|
||||
|
||||
* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 4.1.1-14
|
||||
- OCaml 5.1.1 rebuild for Fedora 40
|
||||
|
||||
* Thu Dec 07 2023 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.1-13
|
||||
- Fix PHP director_classes testcase failures on x86
|
||||
|
||||
* Fri Oct 20 2023 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.1-12
|
||||
- Stop using Python's 2to3
|
||||
|
||||
* Wed Oct 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.1-11
|
||||
- Fix PHP test, it fails with PHP 8.3
|
||||
|
||||
* Thu Oct 05 2023 Richard W.M. Jones <rjones@redhat.com> - 4.1.1-10
|
||||
- OCaml 5.1 rebuild for Fedora 40
|
||||
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Jul 12 2023 Jerry James <loganjerry@gmail.com> - 4.1.1-8
|
||||
- Add patch for python 3.12
|
||||
|
||||
* Tue Jul 11 2023 Richard W.M. Jones <rjones@redhat.com> - 4.1.1-8
|
||||
- OCaml 5.0 rebuild for Fedora 39
|
||||
|
||||
* Tue Jun 20 2023 Jerry James <loganjerry@gmail.com> - 4.1.1-7
|
||||
- Enable OCaml support
|
||||
- Add patch for OCaml 5.0.0
|
||||
|
||||
* Sat Apr 08 2023 Orion Poplawski <orion@nwra.com> - 4.1.1-6
|
||||
- Rebuild with octave 8.1.0
|
||||
|
||||
* Thu Mar 16 2023 Orion Poplawski <orion@nwra.com> - 4.1.1-5
|
||||
- Add patch to support octave 8.1
|
||||
|
||||
* Thu Feb 02 2023 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.1-4
|
||||
- Disable PHP test on i686
|
||||
|
||||
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Jan 12 2023 Florian Weimer <fweimer@redhat.com> - 4.1.1-2
|
||||
- Port configure script to C99
|
||||
|
||||
* Thu Dec 01 2022 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.1-1
|
||||
- Update to 4.1.1
|
||||
|
||||
* Tue Oct 25 2022 Jitka Plesnikova <jplesnik@redhat.com> - 4.1.0-1
|
||||
- Update to 4.1.0
|
||||
|
||||
* Thu Jul 21 2022 Maxwell G <gotmax@e.email> - 4.0.2-18
|
||||
- Exclude golang extension from i686
|
||||
|
||||
* Tue Jul 19 2022 Maxwell G <gotmax@e.email> - 4.0.2-17
|
||||
- Rebuild for CVE-2022-{1705,32148,30631,30633,28131,30635,30632,30630,1962} in
|
||||
golang
|
||||
|
||||
* Sat Jun 18 2022 Robert-André Mauchin <zebob.m@gmail.com> - 4.0.2-16
|
||||
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327, CVE-2022-27191,
|
||||
CVE-2022-29526, CVE-2022-30629
|
||||
|
||||
* Wed Jun 01 2022 Orion Poplawski <orion@nwra.com> - 4.0.2-15
|
||||
- Rebuild for octave 7.1
|
||||
|
||||
* Thu Feb 24 2022 Jitka Plesnikova <jplesnik@redhat.com> - 4.0.2-14
|
||||
- Disable Java tests
|
||||
|
||||
* Sat Jan 22 2022 Jitka Plesnikova <jplesnik@redhat.com> - 4.0.2-13
|
||||
- Fix tests against GCC12, enable Guile tests
|
||||
|
||||
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Wed Nov 24 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4.0.2-11
|
||||
- Disable PHP test, it fails with PHP 8.1
|
||||
|
||||
* Thu Oct 07 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4.0.2-10
|
||||
- Enable Python tests
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue