update to 4.1.1
This commit is contained in:
parent
8b7b5bf1ae
commit
a1c20af7c3
@ -1,45 +0,0 @@
|
|||||||
From 7dfe940d9a54d458e73c3485b53b8612cad6bb27 Mon Sep 17 00:00:00 2001
|
|
||||||
From: chen-jan <chen_aka_jan@163.com>
|
|
||||||
Date: Thu, 13 Jul 2023 17:07:22 +0800
|
|
||||||
Subject: [PATCH] Ruby-Fix-deprecation-warnings-with-Ruby-3.x
|
|
||||||
|
|
||||||
reference: https://github.com/swig/swig/commit/7dfe940d9a54d458e73c3485b53b8612cad6bb27
|
|
||||||
---
|
|
||||||
Lib/ruby/rubyhead.swg | 9 +++++----
|
|
||||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg
|
|
||||||
index bf4e362..42871ce 100644
|
|
||||||
--- a/Lib/ruby/rubyhead.swg
|
|
||||||
+++ b/Lib/ruby/rubyhead.swg
|
|
||||||
@@ -1,4 +1,5 @@
|
|
||||||
#include <ruby.h>
|
|
||||||
+#include <ruby/version.h> /* For RUBY_API_VERSION_CODE */
|
|
||||||
|
|
||||||
/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
|
|
||||||
* breaks using rb_intern as an lvalue, as SWIG does. We work around this
|
|
||||||
@@ -100,9 +101,9 @@
|
|
||||||
/*
|
|
||||||
* The following macros are used for providing the correct type of a
|
|
||||||
* function pointer to the Ruby C API.
|
|
||||||
- * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being
|
|
||||||
- * defined) these macros act transparently due to Ruby's moving away from
|
|
||||||
- * ANYARGS and instead employing strict function signatures.
|
|
||||||
+ *
|
|
||||||
+ * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving
|
|
||||||
+ * moving away from ANYARGS and instead employing strict function signatures.
|
|
||||||
*
|
|
||||||
* Note: In case of C (not C++) the macros are transparent even before
|
|
||||||
* Ruby 2.7 due to the fact that the Ruby C API used function declarators
|
|
||||||
@@ -126,7 +127,7 @@
|
|
||||||
* SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer
|
|
||||||
* argument(s) of Ruby C API functions like st_foreach().
|
|
||||||
*/
|
|
||||||
-#if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL)
|
|
||||||
+#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700
|
|
||||||
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
|
||||||
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
|
||||||
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
|
||||||
--
|
|
||||||
2.39.1
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
From 76d5a9ec270a763c892ae28070e391cf99e0b7cd Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Tue, 18 Jan 2022 21:37:02 +0000
|
|
||||||
Subject: [PATCH] gcc-12 warning fix in test-case
|
|
||||||
|
|
||||||
Closes #2145
|
|
||||||
|
|
||||||
reference: https://github.com/swig/swig/commit/76d5a9ec270a763c892ae28070e391cf99e0b7cd
|
|
||||||
---
|
|
||||||
Examples/test-suite/nested_class.i | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i
|
|
||||||
index b10c33949..c778a12cf 100644
|
|
||||||
--- a/Examples/test-suite/nested_class.i
|
|
||||||
+++ b/Examples/test-suite/nested_class.i
|
|
||||||
@@ -201,7 +201,7 @@ struct Outer {
|
|
||||||
Integer xx;
|
|
||||||
} MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
|
|
||||||
|
|
||||||
-#if defined(__GNUC__) || defined(_MSC_VER) || defined(SWIG)
|
|
||||||
+#if (defined(__GNUC__) && __GNUC__ < 12) || defined(_MSC_VER) || defined(SWIG)
|
|
||||||
/* some compilers do not accept these */
|
|
||||||
struct : public InnerMultiple {
|
|
||||||
Integer xx;
|
|
||||||
--
|
|
||||||
2.39.1
|
|
||||||
|
|
||||||
@ -1,322 +0,0 @@
|
|||||||
From 70be7506121500945b1b31ae87085aa0b9fed771 Mon Sep 17 00:00:00 2001
|
|
||||||
From: misaka00251 <liuxin@iscas.ac.cn>
|
|
||||||
Date: Mon, 5 Jun 2023 18:24:06 +0800
|
|
||||||
Subject: [PATCH] Backport php 8 support from upstream
|
|
||||||
|
|
||||||
---
|
|
||||||
Doc/Manual/Php.html | 6 +--
|
|
||||||
Doc/Manual/Preprocessor.html | 2 +-
|
|
||||||
Doc/Manual/SWIG.html | 2 +-
|
|
||||||
Examples/Makefile.in | 6 +--
|
|
||||||
Examples/test-suite/director_overload2.i | 4 ++
|
|
||||||
.../php/evil_diamond_prop_runme.php | 2 +-
|
|
||||||
Lib/cdata.i | 2 +-
|
|
||||||
Lib/exception.i | 2 +-
|
|
||||||
Lib/php/phprun.swg | 8 ++-
|
|
||||||
Source/Modules/php.cxx | 53 +++++++++++++++----
|
|
||||||
configure.ac | 10 ++--
|
|
||||||
11 files changed, 71 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
|
|
||||||
index d0ec0df..20d2ac3 100644
|
|
||||||
--- a/Doc/Manual/Php.html
|
|
||||||
+++ b/Doc/Manual/Php.html
|
|
||||||
@@ -51,12 +51,12 @@
|
|
||||||
|
|
||||||
<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 66061a5..4e783c8 100644
|
|
||||||
--- a/Doc/Manual/Preprocessor.html
|
|
||||||
+++ b/Doc/Manual/Preprocessor.html
|
|
||||||
@@ -123,7 +123,7 @@ SWIGOCAML Defined when using OCaml
|
|
||||||
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 f9b5d7c..9cbcd72 100644
|
|
||||||
--- a/Doc/Manual/SWIG.html
|
|
||||||
+++ b/Doc/Manual/SWIG.html
|
|
||||||
@@ -127,7 +127,7 @@ Supported Target Language Options
|
|
||||||
-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 87386f7..2efcd92 100644
|
|
||||||
--- a/Examples/Makefile.in
|
|
||||||
+++ b/Examples/Makefile.in
|
|
||||||
@@ -1056,7 +1056,7 @@ ruby_clean:
|
|
||||||
rm -f *.@OBJEXT@ *$(RUBY_SO)
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
-##### PHP7 ######
|
|
||||||
+##### PHP ######
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
PHP = @PHP@
|
|
||||||
@@ -1069,7 +1069,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)
|
|
||||||
|
|
||||||
@@ -1078,7 +1078,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/director_overload2.i b/Examples/test-suite/director_overload2.i
|
|
||||||
index e467c18..b6c351c 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)
|
|
||||||
+ virtual void nnn() {}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
struct OverloadDerived2 : OverloadBase {
|
|
||||||
#if defined(__SUNPRO_CC)
|
|
||||||
virtual void nnn(int vvv) {}
|
|
||||||
+#elif defined(SWIGPHP)
|
|
||||||
+ virtual void nnn(int vvv) {}
|
|
||||||
#endif
|
|
||||||
virtual void nnn() {}
|
|
||||||
};
|
|
||||||
diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php
|
|
||||||
index 9bdb743..645328a 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::is_a($spam,"spam");
|
|
||||||
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 f18ed4a..cd15266 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 ee9ce9b..3d6eecc 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 a07a1b9..08b26da 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 PHP7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ext/standard/php_string.h"
|
|
||||||
@@ -204,7 +204,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 1edbd87..daacd8f 100644
|
|
||||||
--- a/Source/Modules/php.cxx
|
|
||||||
+++ b/Source/Modules/php.cxx
|
|
||||||
@@ -473,6 +473,20 @@ public:
|
|
||||||
s_arginfo = NewString("/* arginfo subsection */\n");
|
|
||||||
arginfo_used = NewHash();
|
|
||||||
|
|
||||||
+ /* Add arginfo we will 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 @@ public:
|
|
||||||
}
|
|
||||||
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 @@ public:
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
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 12b2460..479f1f2 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -2036,7 +2036,7 @@ AC_SUBST(RUBYSO)
|
|
||||||
AC_SUBST(RUBYDYNAMICLINKING)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
-# Look for PHP7
|
|
||||||
+# Look for PHP
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
PHPBIN=
|
|
||||||
@@ -2050,7 +2050,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.2 php8.1 php8.0 php7.3 php7.2 php7.1 php7.0 php])
|
|
||||||
else
|
|
||||||
PHP=$PHPBIN
|
|
||||||
fi
|
|
||||||
@@ -2061,12 +2061,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)
|
|
||||||
@@ -2077,7 +2079,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
|
|
||||||
--
|
|
||||||
2.39.2 (Apple Git-143)
|
|
||||||
|
|
||||||
@ -1,210 +0,0 @@
|
|||||||
From f8e4a5cc250ad8ee885061e30de8084f7d57981b Mon Sep 17 00:00:00 2001
|
|
||||||
From: William S Fulton <wsf@fultondesigns.co.uk>
|
|
||||||
Date: Thu, 20 Jan 2022 22:24:53 +0000
|
|
||||||
Subject: [PATCH] Few more PCRE to PCRE2 changes
|
|
||||||
|
|
||||||
---
|
|
||||||
Doc/Manual/Preface.html | 8 ++++----
|
|
||||||
Doc/Manual/SWIG.html | 6 +++---
|
|
||||||
Source/Modules/main.cxx | 2 +-
|
|
||||||
Source/Swig/misc.c | 2 +-
|
|
||||||
Tools/mkwindows.sh | 2 +-
|
|
||||||
Tools/pcre-build.sh | 26 +++++++++++++-------------
|
|
||||||
configure.ac | 18 +++++++++---------
|
|
||||||
7 files changed, 32 insertions(+), 32 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html
|
|
||||||
index 24e844c..41f21d4 100644
|
|
||||||
--- a/Doc/Manual/Preface.html
|
|
||||||
+++ b/Doc/Manual/Preface.html
|
|
||||||
@@ -281,12 +281,12 @@ You must use <a href="http://www.gnu.org/software/make/">GNU make</a> to build a
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
-<a href="http://www.pcre.org/">PCRE</a>
|
|
||||||
+<a href="http://www.pcre.org/">PCRE2</a>
|
|
||||||
needs to be installed on your system to build SWIG, in particular
|
|
||||||
-pcre2-config must be available. If you have PCRE headers and libraries but not
|
|
||||||
+pcre2-config must be available. If you have PCRE2 headers and libraries but not
|
|
||||||
pcre2-config itself or, alternatively, wish to override the compiler or linker
|
|
||||||
-flags returned by pcre-config, you may set PCRE2_LIBS and PCRE2_CFLAGS variables
|
|
||||||
-to be used instead. And if you don't have PCRE at all, the configure script
|
|
||||||
+flags returned by pcre2-config, you may set PCRE2_LIBS and PCRE2_CFLAGS variables
|
|
||||||
+to be used instead. And if you don't have PCRE2 at all, the configure script
|
|
||||||
will provide instructions for obtaining it.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
|
|
||||||
index 876c0ac..d39c0f3 100644
|
|
||||||
--- a/Doc/Manual/SWIG.html
|
|
||||||
+++ b/Doc/Manual/SWIG.html
|
|
||||||
@@ -208,7 +208,7 @@ General Options
|
|
||||||
-oh <headfile> - Set name of C++ output header file for directors to <headfile>
|
|
||||||
-outcurrentdir - Set default output dir to current dir instead of input file's path
|
|
||||||
-outdir <dir> - Set language specific files output directory to <dir>
|
|
||||||
- -pcreversion - Display PCRE version information
|
|
||||||
+ -pcreversion - Display PCRE2 version information
|
|
||||||
-small - Compile in virtual elimination and compact mode
|
|
||||||
-swiglib - Report location of SWIG library and exit
|
|
||||||
-templatereduce - Reduce all the typedefs in templates
|
|
||||||
@@ -2022,8 +2022,8 @@ and a more descriptive one, but the two functions are otherwise equivalent:
|
|
||||||
<td>String after (Perl-like) regex substitution operation. This function
|
|
||||||
allows to apply arbitrary regular expressions to the identifier names. The
|
|
||||||
<i>pattern</i> part is a regular expression in Perl syntax (as supported
|
|
||||||
- by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions (PCRE)</a>)
|
|
||||||
- library and the <i>subst</i> string
|
|
||||||
+ by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions</a>)
|
|
||||||
+ (PCRE2 library) and the <i>subst</i> string
|
|
||||||
can contain back-references of the form <tt>\N</tt> where <tt>N</tt> is a digit
|
|
||||||
from 0 to 9, or one of the following escape sequences: <tt>\l</tt>, <tt>\L</tt>,
|
|
||||||
<tt>\u</tt>, <tt>\U</tt> or <tt>\E</tt>. The back-references are replaced with the
|
|
||||||
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
|
|
||||||
index d8f2ab6..1476ddb 100644
|
|
||||||
--- a/Source/Modules/main.cxx
|
|
||||||
+++ b/Source/Modules/main.cxx
|
|
||||||
@@ -137,7 +137,7 @@ static const char *usage4 = (const char *) "\
|
|
||||||
-oh <headfile> - Set name of C++ output header file for directors to <headfile>\n\
|
|
||||||
-outcurrentdir - Set default output dir to current dir instead of input file's path\n\
|
|
||||||
-outdir <dir> - Set language specific files output directory to <dir>\n\
|
|
||||||
- -pcreversion - Display PCRE version information\n\
|
|
||||||
+ -pcreversion - Display PCRE2 version information\n\
|
|
||||||
-small - Compile in virtual elimination and compact mode\n\
|
|
||||||
-swiglib - Report location of SWIG library and exit\n\
|
|
||||||
-templatereduce - Reduce all the typedefs in templates\n\
|
|
||||||
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
|
|
||||||
index 1324f4d..62a9787 100644
|
|
||||||
--- a/Source/Swig/misc.c
|
|
||||||
+++ b/Source/Swig/misc.c
|
|
||||||
@@ -1493,7 +1493,7 @@ String *Swig_pcre_version(void) {
|
|
||||||
char *buf = malloc(len);
|
|
||||||
String *result;
|
|
||||||
pcre2_config(PCRE2_CONFIG_VERSION, buf);
|
|
||||||
- result = NewStringf("PCRE Version: %s", buf);
|
|
||||||
+ result = NewStringf("PCRE2 Version: %s", buf);
|
|
||||||
free(buf);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
diff --git a/Tools/mkwindows.sh b/Tools/mkwindows.sh
|
|
||||||
index 4717e1c..ad96c97 100755
|
|
||||||
--- a/Tools/mkwindows.sh
|
|
||||||
+++ b/Tools/mkwindows.sh
|
|
||||||
@@ -87,7 +87,7 @@ tarball=$swigbasename.tar.gz
|
|
||||||
pcre_tarball=`ls pcre2-*.tar.*`
|
|
||||||
|
|
||||||
if ! test -f "$pcre_tarball"; then
|
|
||||||
- echo "Could not find PCRE tarball. Please download a PCRE source tarball from http://www.pcre.org"
|
|
||||||
+ echo "Could not find PCRE2 tarball. Please download a PCRE2 source tarball from http://www.pcre.org"
|
|
||||||
echo "and place in the same directory as the SWIG tarball."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
diff --git a/Tools/pcre-build.sh b/Tools/pcre-build.sh
|
|
||||||
index ffa7a69..e986d68 100755
|
|
||||||
--- a/Tools/pcre-build.sh
|
|
||||||
+++ b/Tools/pcre-build.sh
|
|
||||||
@@ -4,17 +4,17 @@ pcre_subdir=pcre/pcre-swig-install
|
|
||||||
pcre_install_dir=`pwd`/$pcre_subdir
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
- echo "Helper script to build PCRE as a static library from a tarball just for use during the"
|
|
||||||
- echo "SWIG build. It does not install PCRE for global use on your system."
|
|
||||||
+ echo "Helper script to build PCRE2 as a static library from a tarball just for use during the"
|
|
||||||
+ echo "SWIG build. It does not install PCRE2 for global use on your system."
|
|
||||||
echo "Usage: pcre-build.sh [--help] [args]"
|
|
||||||
- echo " args - optional additional arguments passed on to the PCRE configure script (leave out"
|
|
||||||
+ echo " args - optional additional arguments passed on to the PCRE2 configure script (leave out"
|
|
||||||
echo " unless you are an expert at configure)"
|
|
||||||
echo " --help - Display this help information."
|
|
||||||
echo "Instructions:"
|
|
||||||
- echo " - Download the latest PCRE source tarball from http://www.pcre.org and place in the"
|
|
||||||
+ echo " - Download the latest PCRE2 source tarball from http://www.pcre.org and place in the"
|
|
||||||
echo " directory that you will configure and build SWIG."
|
|
||||||
echo " - Run this script in the same directory that you intend to configure and build SWIG in."
|
|
||||||
- echo " This will configure and build PCRE as a static library."
|
|
||||||
+ echo " This will configure and build PCRE2 as a static library."
|
|
||||||
echo " - Afterwards run the SWIG configure script which will then find and use the PCRE static"
|
|
||||||
echo " libraries in the $pcre_subdir subdirectory."
|
|
||||||
exit 0
|
|
||||||
@@ -35,21 +35,21 @@ if test -f "pcre-build.sh" ; then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
-echo "Looking for PCRE tarball..."
|
|
||||||
+echo "Looking for PCRE2 tarball..."
|
|
||||||
rm -rf pcre
|
|
||||||
pcre_tarball=`ls pcre2-*.tar*`
|
|
||||||
test -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre2-*.tar*"
|
|
||||||
-test -f "$pcre_tarball" || bail "Could not find a single PCRE tarball. Found: $pcre_tarball"
|
|
||||||
+test -f "$pcre_tarball" || bail "Could not find a single PCRE2 tarball. Found: $pcre_tarball"
|
|
||||||
|
|
||||||
echo "Extracting tarball: $pcre_tarball"
|
|
||||||
tar -xf $pcre_tarball || bail "Could not untar $pcre_tarball"
|
|
||||||
pcre_dir=`echo $pcre_tarball | sed -e "s/\.tar.*//"`
|
|
||||||
echo "Configuring PCRE in directory: pcre"
|
|
||||||
mv $pcre_dir pcre || bail "Could not create pcre directory"
|
|
||||||
-cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
|
|
||||||
-echo "Building PCRE..."
|
|
||||||
-${MAKE:-make} -s || bail "Could not build PCRE"
|
|
||||||
-echo "Installing PCRE locally to $pcre_install_dir..."
|
|
||||||
-${MAKE:-make} -s install || bail "Could not install PCRE"
|
|
||||||
+cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE2 configure failed"
|
|
||||||
+echo "Building PCRE2..."
|
|
||||||
+${MAKE:-make} -s || bail "Could not build PCRE2"
|
|
||||||
+echo "Installing PCRE2 locally to $pcre_install_dir..."
|
|
||||||
+${MAKE:-make} -s install || bail "Could not install PCRE2"
|
|
||||||
echo ""
|
|
||||||
-echo "The SWIG configure script can now be run, whereupon PCRE will automatically be detected and used from $pcre_install_dir/bin/pcre-config."
|
|
||||||
+echo "The SWIG configure script can now be run, whereupon PCRE2 will automatically be detected and used from $pcre_install_dir/bin/pcre-config."
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index c5ae9fc..209dba1 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -48,16 +48,16 @@ fi
|
|
||||||
dnl PCRE
|
|
||||||
AC_ARG_WITH([pcre],
|
|
||||||
[AS_HELP_STRING([--without-pcre],
|
|
||||||
- [Disable support for regular expressions using PCRE])],
|
|
||||||
+ [Disable support for regular expressions using PCRE2])],
|
|
||||||
[],
|
|
||||||
[with_pcre=yes])
|
|
||||||
|
|
||||||
-AC_MSG_CHECKING([whether to enable PCRE support])
|
|
||||||
+AC_MSG_CHECKING([whether to enable PCRE2 support])
|
|
||||||
AC_MSG_RESULT([$with_pcre])
|
|
||||||
|
|
||||||
dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
|
|
||||||
if test x"${with_pcre}" = xyes ; then
|
|
||||||
- AC_MSG_CHECKING([whether to use local PCRE])
|
|
||||||
+ AC_MSG_CHECKING([whether to use local PCRE2])
|
|
||||||
local_pcre_config=no
|
|
||||||
if test -z $PCRE2_CONFIG; then
|
|
||||||
if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
|
|
||||||
@@ -71,20 +71,20 @@ AS_IF([test "x$with_pcre" != xno],
|
|
||||||
[AX_PATH_GENERIC([pcre2],
|
|
||||||
[], dnl Minimal version of PCRE we need -- accept any
|
|
||||||
[], dnl custom sed script for version parsing is not needed
|
|
||||||
- [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
|
|
||||||
+ [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE2 library])
|
|
||||||
LIBS="$LIBS $PCRE2_LIBS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS"
|
|
||||||
],
|
|
||||||
[AC_MSG_FAILURE([
|
|
||||||
- Cannot find pcre2-config script from PCRE (Perl Compatible Regular Expressions)
|
|
||||||
+ Cannot find pcre2-config script from PCRE2 (Perl Compatible Regular Expressions)
|
|
||||||
library package. This dependency is needed for configure to complete,
|
|
||||||
Either:
|
|
||||||
- - Install the PCRE developer package on your system (preferred approach).
|
|
||||||
- - Download the PCRE source tarball, build and install on your system
|
|
||||||
+ - Install the PCRE2 developer package on your system (preferred approach).
|
|
||||||
+ - Download the PCRE2 source tarball, build and install on your system
|
|
||||||
as you would for any package built from source distribution.
|
|
||||||
- - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
|
|
||||||
+ - Use the Tools/pcre-build.sh script to build PCRE2 just for SWIG to statically
|
|
||||||
link against. Run 'Tools/pcre-build.sh --help' for instructions.
|
|
||||||
- (quite easy and does not require privileges to install PCRE on your system)
|
|
||||||
+ (quite easy and does not require privileges to install PCRE2 on your system)
|
|
||||||
- Use configure --without-pcre to disable regular expressions support in SWIG
|
|
||||||
(not recommended).])
|
|
||||||
],
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,288 +0,0 @@
|
|||||||
From 15515f390c5e3316a7faf0cf85d661a297d45a50 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Julien Schueller <schueller@phimeca.com>
|
|
||||||
Date: Tue, 4 Jan 2022 13:50:02 +0100
|
|
||||||
Subject: [PATCH] PCRE2
|
|
||||||
|
|
||||||
Closes #2120
|
|
||||||
---
|
|
||||||
Doc/Manual/Preface.html | 6 +++---
|
|
||||||
Source/Swig/misc.c | 41 +++++++++++++++++++++++++++--------------
|
|
||||||
Source/Swig/naming.c | 22 ++++++++++++++--------
|
|
||||||
Tools/mkwindows.sh | 2 +-
|
|
||||||
Tools/nuget-install.cmd | 28 ----------------------------
|
|
||||||
Tools/pcre-build.sh | 4 ++--
|
|
||||||
configure.ac | 19 ++++++++++---------
|
|
||||||
7 files changed, 60 insertions(+), 65 deletions(-)
|
|
||||||
delete mode 100644 Tools/nuget-install.cmd
|
|
||||||
|
|
||||||
diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html
|
|
||||||
index 36a99bd..24e844c 100644
|
|
||||||
--- a/Doc/Manual/Preface.html
|
|
||||||
+++ b/Doc/Manual/Preface.html
|
|
||||||
@@ -283,9 +283,9 @@ You must use <a href="http://www.gnu.org/software/make/">GNU make</a> to build a
|
|
||||||
<p>
|
|
||||||
<a href="http://www.pcre.org/">PCRE</a>
|
|
||||||
needs to be installed on your system to build SWIG, in particular
|
|
||||||
-pcre-config must be available. If you have PCRE headers and libraries but not
|
|
||||||
-pcre-config itself or, alternatively, wish to override the compiler or linker
|
|
||||||
-flags returned by pcre-config, you may set PCRE_LIBS and PCRE_CFLAGS variables
|
|
||||||
+pcre2-config must be available. If you have PCRE headers and libraries but not
|
|
||||||
+pcre2-config itself or, alternatively, wish to override the compiler or linker
|
|
||||||
+flags returned by pcre-config, you may set PCRE2_LIBS and PCRE2_CFLAGS variables
|
|
||||||
to be used instead. And if you don't have PCRE at all, the configure script
|
|
||||||
will provide instructions for obtaining it.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c
|
|
||||||
index ef6fcc0..1324f4d 100644
|
|
||||||
--- a/Source/Swig/misc.c
|
|
||||||
+++ b/Source/Swig/misc.c
|
|
||||||
@@ -1312,7 +1312,8 @@ void Swig_offset_string(String *s, int number) {
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_PCRE
|
|
||||||
-#include <pcre.h>
|
|
||||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
|
||||||
+#include <pcre2.h>
|
|
||||||
|
|
||||||
static int split_regex_pattern_subst(String *s, String **pattern, String **subst, const char **input)
|
|
||||||
{
|
|
||||||
@@ -1375,7 +1376,7 @@ static void copy_with_maybe_case_conversion(String *dst, const char *src, int le
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-String *replace_captures(int num_captures, const char *input, String *subst, int captures[], String *pattern, String *s)
|
|
||||||
+String *replace_captures(int num_captures, const char *input, String *subst, size_t captures[], String *pattern, String *s)
|
|
||||||
{
|
|
||||||
int convertCase = 0, convertNextOnly = 0;
|
|
||||||
String *result = NewStringEmpty();
|
|
||||||
@@ -1397,7 +1398,7 @@ String *replace_captures(int num_captures, const char *input, String *subst, int
|
|
||||||
} else if (isdigit((unsigned char)*p)) {
|
|
||||||
int group = *p++ - '0';
|
|
||||||
if (group < num_captures) {
|
|
||||||
- int l = captures[group*2], r = captures[group*2 + 1];
|
|
||||||
+ int l = (int)captures[group*2], r = (int)captures[group*2 + 1];
|
|
||||||
if (l != -1) {
|
|
||||||
copy_with_maybe_case_conversion(result, input + l, r - l, &convertCase, convertNextOnly);
|
|
||||||
}
|
|
||||||
@@ -1449,26 +1450,31 @@ String *Swig_string_regex(String *s) {
|
|
||||||
const int pcre_options = 0;
|
|
||||||
|
|
||||||
String *res = 0;
|
|
||||||
- pcre *compiled_pat = 0;
|
|
||||||
- const char *pcre_error, *input;
|
|
||||||
- int pcre_errorpos;
|
|
||||||
+ pcre2_code *compiled_pat = 0;
|
|
||||||
+ const char *input;
|
|
||||||
+ PCRE2_UCHAR pcre_error[256];
|
|
||||||
+ int pcre_errornum;
|
|
||||||
+ size_t pcre_errorpos;
|
|
||||||
String *pattern = 0, *subst = 0;
|
|
||||||
- int captures[30];
|
|
||||||
-
|
|
||||||
+ size_t *captures = 0;
|
|
||||||
+ pcre2_match_data *match_data = 0;
|
|
||||||
if (split_regex_pattern_subst(s, &pattern, &subst, &input)) {
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
- compiled_pat = pcre_compile(
|
|
||||||
- Char(pattern), pcre_options, &pcre_error, &pcre_errorpos, NULL);
|
|
||||||
+ compiled_pat = pcre2_compile(
|
|
||||||
+ (PCRE2_SPTR8)Char(pattern), PCRE2_ZERO_TERMINATED, pcre_options, &pcre_errornum, &pcre_errorpos, NULL);
|
|
||||||
if (!compiled_pat) {
|
|
||||||
+ pcre2_get_error_message (pcre_errornum, pcre_error, sizeof pcre_error);
|
|
||||||
Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
|
|
||||||
pcre_error, Char(pattern), pcre_errorpos);
|
|
||||||
SWIG_exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
- rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
|
|
||||||
+ match_data = pcre2_match_data_create_from_pattern (compiled_pat, NULL);
|
|
||||||
+ rc = pcre2_match(compiled_pat, (PCRE2_SPTR8)input, PCRE2_ZERO_TERMINATED, 0, 0, match_data, NULL);
|
|
||||||
+ captures = pcre2_get_ovector_pointer (match_data);
|
|
||||||
if (rc >= 0) {
|
|
||||||
res = replace_captures(rc, input, subst, captures, pattern, s);
|
|
||||||
- } else if (rc != PCRE_ERROR_NOMATCH) {
|
|
||||||
+ } else if (rc != PCRE2_ERROR_NOMATCH) {
|
|
||||||
Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
|
|
||||||
rc, Char(pattern), input);
|
|
||||||
SWIG_exit(EXIT_FAILURE);
|
|
||||||
@@ -1477,12 +1483,19 @@ String *Swig_string_regex(String *s) {
|
|
||||||
|
|
||||||
DohDelete(pattern);
|
|
||||||
DohDelete(subst);
|
|
||||||
- pcre_free(compiled_pat);
|
|
||||||
+ pcre2_code_free(compiled_pat);
|
|
||||||
+ pcre2_match_data_free(match_data);
|
|
||||||
return res ? res : NewStringEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
String *Swig_pcre_version(void) {
|
|
||||||
- return NewStringf("PCRE Version: %s", pcre_version());
|
|
||||||
+ int len = pcre2_config(PCRE2_CONFIG_VERSION, NULL);
|
|
||||||
+ char *buf = malloc(len);
|
|
||||||
+ String *result;
|
|
||||||
+ pcre2_config(PCRE2_CONFIG_VERSION, buf);
|
|
||||||
+ result = NewStringf("PCRE Version: %s", buf);
|
|
||||||
+ free(buf);
|
|
||||||
+ return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
|
|
||||||
index 871a9e5..a1a0381 100644
|
|
||||||
--- a/Source/Swig/naming.c
|
|
||||||
+++ b/Source/Swig/naming.c
|
|
||||||
@@ -1092,26 +1092,32 @@ static DOH *get_lattr(Node *n, List *lattr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PCRE
|
|
||||||
-#include <pcre.h>
|
|
||||||
+#define PCRE2_CODE_UNIT_WIDTH 8
|
|
||||||
+#include <pcre2.h>
|
|
||||||
|
|
||||||
static int name_regexmatch_value(Node *n, String *pattern, String *s) {
|
|
||||||
- pcre *compiled_pat;
|
|
||||||
- const char *err;
|
|
||||||
- int errpos;
|
|
||||||
+ pcre2_code *compiled_pat;
|
|
||||||
+ PCRE2_UCHAR err[256];
|
|
||||||
+ int errornum;
|
|
||||||
+ size_t errpos;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
- compiled_pat = pcre_compile(Char(pattern), 0, &err, &errpos, NULL);
|
|
||||||
+ compiled_pat = pcre2_compile((PCRE2_SPTR8)Char(pattern), PCRE2_ZERO_TERMINATED, 0, &errornum, &errpos, NULL);
|
|
||||||
if (!compiled_pat) {
|
|
||||||
+ pcre2_get_error_message (errornum, err, sizeof err);
|
|
||||||
Swig_error("SWIG", Getline(n),
|
|
||||||
"Invalid regex \"%s\": compilation failed at %d: %s\n",
|
|
||||||
Char(pattern), errpos, err);
|
|
||||||
SWIG_exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
- rc = pcre_exec(compiled_pat, NULL, Char(s), Len(s), 0, 0, NULL, 0);
|
|
||||||
- pcre_free(compiled_pat);
|
|
||||||
+ pcre2_match_data *match_data = 0;
|
|
||||||
+ match_data = pcre2_match_data_create_from_pattern (compiled_pat, NULL);
|
|
||||||
+ rc = pcre2_match(compiled_pat, (PCRE2_SPTR8)Char(s), PCRE2_ZERO_TERMINATED, 0, 0, match_data, 0);
|
|
||||||
+ pcre2_code_free(compiled_pat);
|
|
||||||
+ pcre2_match_data_free(match_data);
|
|
||||||
|
|
||||||
- if (rc == PCRE_ERROR_NOMATCH)
|
|
||||||
+ if (rc == PCRE2_ERROR_NOMATCH)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (rc < 0 ) {
|
|
||||||
diff --git a/Tools/mkwindows.sh b/Tools/mkwindows.sh
|
|
||||||
index 5e4d2f0..4717e1c 100755
|
|
||||||
--- a/Tools/mkwindows.sh
|
|
||||||
+++ b/Tools/mkwindows.sh
|
|
||||||
@@ -84,7 +84,7 @@ export CXXFLAGS="$compileflags"
|
|
||||||
swigbasename=swig-$version
|
|
||||||
swigwinbasename=swigwin-$version
|
|
||||||
tarball=$swigbasename.tar.gz
|
|
||||||
-pcre_tarball=`ls pcre-*.tar.*`
|
|
||||||
+pcre_tarball=`ls pcre2-*.tar.*`
|
|
||||||
|
|
||||||
if ! test -f "$pcre_tarball"; then
|
|
||||||
echo "Could not find PCRE tarball. Please download a PCRE source tarball from http://www.pcre.org"
|
|
||||||
diff --git a/Tools/nuget-install.cmd b/Tools/nuget-install.cmd
|
|
||||||
deleted file mode 100644
|
|
||||||
index eec7f87..0000000
|
|
||||||
--- a/Tools/nuget-install.cmd
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,28 +0,0 @@
|
|
||||||
-rem Workaround 'nuget install' not being reliable by retrying a few times
|
|
||||||
-@echo off
|
|
||||||
-rem initiate the retry number
|
|
||||||
-set errorCode=1
|
|
||||||
-set retryNumber=0
|
|
||||||
-set maxRetries=5
|
|
||||||
-
|
|
||||||
-:RESTORE
|
|
||||||
-nuget install %*
|
|
||||||
-
|
|
||||||
-rem problem?
|
|
||||||
-IF ERRORLEVEL %errorCode% GOTO :RETRY
|
|
||||||
-
|
|
||||||
-rem everything is fine!
|
|
||||||
-@echo Installed nuget, retries: %reTryNumber%
|
|
||||||
-GOTO :EXIT
|
|
||||||
-
|
|
||||||
-:RETRY
|
|
||||||
-@echo Oops, nuget restore exited with code %errorCode% - let us try again!
|
|
||||||
-set /a retryNumber=%retryNumber%+1
|
|
||||||
-IF %reTryNumber% LSS %maxRetries% (GOTO :RESTORE)
|
|
||||||
-IF %retryNumber% EQU %maxRetries% (GOTO :ERR)
|
|
||||||
-
|
|
||||||
-:ERR
|
|
||||||
-@echo Sorry, we tried restoring nuget packages for %maxRetries% times and all attempts were unsuccessful!
|
|
||||||
-EXIT /B 1
|
|
||||||
-
|
|
||||||
-:EXIT
|
|
||||||
diff --git a/Tools/pcre-build.sh b/Tools/pcre-build.sh
|
|
||||||
index 92f645d..ffa7a69 100755
|
|
||||||
--- a/Tools/pcre-build.sh
|
|
||||||
+++ b/Tools/pcre-build.sh
|
|
||||||
@@ -37,8 +37,8 @@ fi
|
|
||||||
|
|
||||||
echo "Looking for PCRE tarball..."
|
|
||||||
rm -rf pcre
|
|
||||||
-pcre_tarball=`ls pcre-*.tar*`
|
|
||||||
-test -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre-*.tar*"
|
|
||||||
+pcre_tarball=`ls pcre2-*.tar*`
|
|
||||||
+test -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre2-*.tar*"
|
|
||||||
test -f "$pcre_tarball" || bail "Could not find a single PCRE tarball. Found: $pcre_tarball"
|
|
||||||
|
|
||||||
echo "Extracting tarball: $pcre_tarball"
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index ed83620..c5ae9fc 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -59,24 +59,24 @@ dnl To make configuring easier, check for a locally built PCRE using the Tools/p
|
|
||||||
if test x"${with_pcre}" = xyes ; then
|
|
||||||
AC_MSG_CHECKING([whether to use local PCRE])
|
|
||||||
local_pcre_config=no
|
|
||||||
- if test -z $PCRE_CONFIG; then
|
|
||||||
- if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
|
|
||||||
- PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
|
|
||||||
- local_pcre_config=$PCRE_CONFIG
|
|
||||||
+ if test -z $PCRE2_CONFIG; then
|
|
||||||
+ if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
|
|
||||||
+ PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config
|
|
||||||
+ local_pcre_config=$PCRE2_CONFIG
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$local_pcre_config])
|
|
||||||
fi
|
|
||||||
AS_IF([test "x$with_pcre" != xno],
|
|
||||||
- [AX_PATH_GENERIC([pcre],
|
|
||||||
+ [AX_PATH_GENERIC([pcre2],
|
|
||||||
[], dnl Minimal version of PCRE we need -- accept any
|
|
||||||
[], dnl custom sed script for version parsing is not needed
|
|
||||||
[AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
|
|
||||||
- LIBS="$LIBS $PCRE_LIBS"
|
|
||||||
- CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
|
|
||||||
+ LIBS="$LIBS $PCRE2_LIBS"
|
|
||||||
+ CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS"
|
|
||||||
],
|
|
||||||
[AC_MSG_FAILURE([
|
|
||||||
- Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
|
|
||||||
+ Cannot find pcre2-config script from PCRE (Perl Compatible Regular Expressions)
|
|
||||||
library package. This dependency is needed for configure to complete,
|
|
||||||
Either:
|
|
||||||
- Install the PCRE developer package on your system (preferred approach).
|
|
||||||
@@ -87,7 +87,8 @@ AS_IF([test "x$with_pcre" != xno],
|
|
||||||
(quite easy and does not require privileges to install PCRE on your system)
|
|
||||||
- Use configure --without-pcre to disable regular expressions support in SWIG
|
|
||||||
(not recommended).])
|
|
||||||
- ])
|
|
||||||
+ ],
|
|
||||||
+ [],[],[--libs8])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From 6043554c38edc30cbe27ba632462f55fb702bb87 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Olly Betts <olly@survex.com>
|
|
||||||
Date: Wed, 13 Apr 2022 11:14:29 +1200
|
|
||||||
Subject: [PATCH] configure.ac: Add missing shell quoting
|
|
||||||
|
|
||||||
Fixes "./configure[4896]: test: argument expected" on stderr.
|
|
||||||
---
|
|
||||||
configure.ac | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 3ea50e9..0d86e9c 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -59,7 +59,7 @@ dnl To make configuring easier, check for a locally built PCRE using the Tools/p
|
|
||||||
if test x"${with_pcre}" = xyes ; then
|
|
||||||
AC_MSG_CHECKING([whether to use local PCRE2])
|
|
||||||
local_pcre_config=no
|
|
||||||
- if test -z $PCRE2_CONFIG; then
|
|
||||||
+ if test -z "$PCRE2_CONFIG"; then
|
|
||||||
if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
|
|
||||||
PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config
|
|
||||||
local_pcre_config=$PCRE2_CONFIG
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
Binary file not shown.
14
swig.spec
14
swig.spec
@ -1,19 +1,12 @@
|
|||||||
Name: swig
|
Name: swig
|
||||||
Version: 4.0.2
|
Version: 4.1.1
|
||||||
Release: 6
|
Release: 1
|
||||||
Summary: Links C/C++/Objective C to languages for some advanced programing
|
Summary: Links C/C++/Objective C to languages for some advanced programing
|
||||||
License: GPLv3+ and BSD
|
License: GPLv3+ and BSD
|
||||||
URL: http://swig.sourceforge.net/
|
URL: http://swig.sourceforge.net/
|
||||||
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
|
Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
|
||||||
Source1: description.h2m
|
Source1: description.h2m
|
||||||
|
|
||||||
Patch1: backport-PCRE2.patch
|
|
||||||
Patch2: backport-Few-more-PCRE-to-PCRE2-changes.patch
|
|
||||||
Patch3: backport-configure.ac-Add-missing-shell-quoting.patch
|
|
||||||
Patch4: Backport-php-8-support-from-upstream.patch
|
|
||||||
Patch5: 0001-Ruby-Fix-deprecation-warnings-with-Ruby-3.x.patch
|
|
||||||
Patch6: 0001-gcc-12-warning-fix-in-test-case.patch
|
|
||||||
|
|
||||||
BuildRequires: perl-interpreter pcre2-devel python3-devel autoconf automake gawk dos2unix
|
BuildRequires: perl-interpreter pcre2-devel python3-devel autoconf automake gawk dos2unix
|
||||||
BuildRequires: gcc-c++ help2man perl-devel perl(base) perl(Config) perl(Devel::Peek)
|
BuildRequires: gcc-c++ help2man perl-devel perl(base) perl(Config) perl(Devel::Peek)
|
||||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(fields) perl(Math::BigInt) perl(strict)
|
BuildRequires: perl(ExtUtils::MakeMaker) perl(fields) perl(Math::BigInt) perl(strict)
|
||||||
@ -106,6 +99,9 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb
|
|||||||
%{_mandir}/man1/swig.1*
|
%{_mandir}/man1/swig.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 24 2023 liyanan <thistleslyn@163.com> - 4.1.1-1
|
||||||
|
- Update to 4.1.1
|
||||||
|
|
||||||
* Thu Jul 13 2023 chenchen <chen_aka_jan@163.com> - 4.0.2-6
|
* Thu Jul 13 2023 chenchen <chen_aka_jan@163.com> - 4.0.2-6
|
||||||
- fix build error caused by upgrading gcc to 12.3.0
|
- fix build error caused by upgrading gcc to 12.3.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user