diff options
Diffstat (limited to 'external/poky/meta/recipes-devtools/swig')
7 files changed, 763 insertions, 0 deletions
diff --git a/external/poky/meta/recipes-devtools/swig/swig.inc b/external/poky/meta/recipes-devtools/swig/swig.inc new file mode 100644 index 00000000..aec54499 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig.inc @@ -0,0 +1,62 @@ +SUMMARY = "SWIG - Simplified Wrapper and Interface Generator" +HOMEPAGE = "http://swig.sourceforge.net/" +LICENSE = "BSD & GPLv3" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \ + file://LICENSE-GPL;md5=d32239bcb673463ab874e80d47fae504 \ + file://LICENSE-UNIVERSITIES;md5=8ce9dcc8f7c994de4a408b205c72ba08" + +SECTION = "devel" + +DEPENDS = "libpcre" + +SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz" + +inherit autotools python3native pkgconfig + +EXTRA_OECONF = " \ + --with-python3=${PYTHON} \ + --without-allegrocl \ + --without-android \ + --without-boost \ + --without-chicken \ + --without-clisp \ + --without-csharp \ + --without-d \ + --without-gcj \ + --without-go \ + --without-guile \ + --without-java \ + --without-lua \ + --without-mzscheme \ + --without-ocaml \ + --without-octave \ + --without-perl5 \ + --without-pike \ + --without-php \ + --without-r \ + --without-ruby \ + --without-tcl \ +" + +BBCLASSEXTEND = "native nativesdk" + +do_configure() { + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/Tools/config + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/Tools/config + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} + oe_runconf +} + +do_install_append_class-nativesdk() { + cd ${D}${bindir} + ln -s swig swig2.0 +} + +def swiglib_relpath(d): + swiglib = d.getVar('datadir') + "/" + d.getVar('BPN') + "/" + d.getVar('PV') + return os.path.relpath(swiglib, d.getVar('bindir')) + +do_install_append_class-native() { + create_wrapper ${D}${bindir}/swig SWIG_LIB='`dirname $''realpath`'/${@swiglib_relpath(d)} +} diff --git a/external/poky/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch b/external/poky/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch new file mode 100644 index 00000000..885c3956 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch @@ -0,0 +1,330 @@ +From 1a5aadcd66e85c63d228bfd811a521d617c22a38 Mon Sep 17 00:00:00 2001 +From: Patrick Schneider <patrick.schneider@meetnow.eu> +Date: Thu, 13 Apr 2017 15:02:53 +0200 +Subject: [PATCH] Add Node 7.x aka V8 5.2+ support + +* Use WeakCallbackInfo instead of WeakCallbackData +* Use GetPrivate instead of GetHiddenValue +* Adopted new signature for SetWeak to support destructor calling +* SetAccessor deprecation fixed +* Proper version checks where applicable + +Upstream-Status: Submitted [https://github.com/swig/swig/pull/968] + +Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> +--- + Lib/javascript/v8/javascriptcode.swg | 27 +++++++++++++++++----- + Lib/javascript/v8/javascripthelpers.swg | 29 +++++++++++++++++++++--- + Lib/javascript/v8/javascriptinit.swg | 16 +++++++++++-- + Lib/javascript/v8/javascriptrun.swg | 40 ++++++++++++++++++++++++++++----- + 4 files changed, 95 insertions(+), 17 deletions(-) + +diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg +index fb7d55c..b8c5089 100644 +--- a/Lib/javascript/v8/javascriptcode.swg ++++ b/Lib/javascript/v8/javascriptcode.swg +@@ -133,10 +133,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) { +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SWIGV8_Proxy *proxy = data.GetParameter(); ++#else ++ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { ++ SWIGV8_Proxy *proxy = data.GetParameter(); + #endif + + if(proxy->swigCMemOwn && proxy->swigCObject) { +@@ -147,7 +150,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat + } + delete proxy; + ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + object.Clear(); ++#endif + + #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + object.Dispose(); +@@ -155,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat + object.Dispose(isolate); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + object->Dispose(isolate); +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + object->Dispose(); + #endif + } +@@ -177,10 +182,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) { +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SWIGV8_Proxy *proxy = data.GetParameter(); ++#else ++static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { ++ SWIGV8_Proxy *proxy = data.GetParameter(); + #endif + + if(proxy->swigCMemOwn && proxy->swigCObject) { +@@ -197,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat + object->Dispose(isolate); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + object->Dispose(); +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + object.Clear(); + #endif + } +@@ -211,7 +219,11 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat + * ----------------------------------------------------------------------------- */ + %fragment("js_getter", "templates") + %{ ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) { ++#else ++static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) { ++#endif + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; +@@ -233,8 +245,11 @@ fail: + * ----------------------------------------------------------------------------- */ + %fragment("js_setter", "templates") + %{ +-static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, +- const SwigV8PropertyCallbackInfoVoid &info) { ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) ++static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) { ++#else ++static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) { ++#endif + SWIGV8_HANDLESCOPE(); + + $jslocals +diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg +index 091467d..7461079 100644 +--- a/Lib/javascript/v8/javascripthelpers.swg ++++ b/Lib/javascript/v8/javascripthelpers.swg +@@ -6,11 +6,16 @@ typedef v8::InvocationCallback SwigV8FunctionCallback; + typedef v8::AccessorGetter SwigV8AccessorGetterCallback; + typedef v8::AccessorSetter SwigV8AccessorSetterCallback; + typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid; +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + typedef v8::FunctionCallback SwigV8FunctionCallback; + typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback; + typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback; + typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; ++#else ++typedef v8::FunctionCallback SwigV8FunctionCallback; ++typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback; ++typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback; ++typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; + #endif + + /** +@@ -65,18 +70,36 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char + */ + SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol, + SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); ++#else ++ obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter); ++#endif + } + +-SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, +- const SwigV8PropertyCallbackInfoVoid& info) ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) ++SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info) ++#else ++SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info) ++#endif + { + char buffer[256]; + char msg[512]; + int res; + ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + property->WriteUtf8(buffer, 256); + res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); ++#else ++ v8::Local<v8::String> sproperty; ++ if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) { ++ sproperty->WriteUtf8(buffer, 256); ++ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); ++ } ++ else { ++ res = -1; ++ } ++#endif + + if(res<0) { + SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); +diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg +index 34befa7..86008d9 100644 +--- a/Lib/javascript/v8/javascriptinit.swg ++++ b/Lib/javascript/v8/javascriptinit.swg +@@ -7,15 +7,27 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) { + v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); + v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module); + assert(!mod.IsEmpty()); ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod); ++#else ++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); ++ global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod); ++#endif + } + + SWIGRUNTIME swig_module_info * + SWIG_V8_GetModule(void *) { + v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data")); ++#else ++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data")); ++ v8::Local<v8::Value> moduleinfo; ++ if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo)) ++ return 0; ++#endif + +- if (moduleinfo.IsEmpty()) ++ if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined()) + { + // It's not yet loaded + return 0; +@@ -23,7 +35,7 @@ SWIG_V8_GetModule(void *) { + + v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo); + +- if (moduleinfo_extern.IsEmpty()) ++ if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined()) + { + // Something's not right + return 0; +diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg +index 5ac52a5..30002c0 100644 +--- a/Lib/javascript/v8/javascriptrun.swg ++++ b/Lib/javascript/v8/javascriptrun.swg +@@ -193,8 +193,10 @@ public: + void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy); +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data); ++#else ++ void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data); + #endif + }; + +@@ -241,9 +243,12 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) { +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + SWIGV8_Proxy *proxy = data.GetParameter(); ++#else ++SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) { ++ SWIGV8_Proxy *proxy = data.GetParameter(); + #endif + + delete proxy; +@@ -312,12 +317,18 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw + } else { + cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); + } +-#else ++#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); + } else { + cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor); + } ++#else ++ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { ++ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter); ++ } else { ++ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter); ++ } + #endif + + #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +@@ -470,7 +481,14 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) { + + v8::Handle<v8::Object> objRef = valRef->ToObject(); + if(objRef->InternalFieldCount() < 1) return false; ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); ++#else ++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); ++ v8::Local<v8::Value> flag; ++ if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag)) ++ return false; ++#endif + return (flag->IsBoolean() && flag->BooleanValue()); + } + +@@ -519,10 +537,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist + SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) { +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SwigV8PackedData *cdata = data.GetParameter(); ++#else ++SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) { ++ SwigV8PackedData *cdata = data.GetParameter(); + #endif + + delete cdata; +@@ -537,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob + object->Dispose(isolate); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + object->Dispose(); +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + object.Clear(); + #endif + } +@@ -550,7 +571,12 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf + // v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW(); + v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW(); + ++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true)); ++#else ++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__")); ++ obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true)); ++#endif + + #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + obj->SetPointerInInternalField(0, cdata); +@@ -573,9 +599,11 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf + cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete); + #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); +-#else ++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2) + cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete); + // v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete); ++#else ++ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter); + #endif + + #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +-- +2.9.5 + diff --git a/external/poky/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch b/external/poky/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch new file mode 100644 index 00000000..81df3e26 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig/0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch @@ -0,0 +1,69 @@ +From a4a0440a644c6c5e5da096efe3cf05ba309a284f Mon Sep 17 00:00:00 2001 +From: "NODA, Kai" <nodakai@gmail.com> +Date: Sun, 22 Apr 2012 17:01:02 +0900 +Subject: [PATCH] Use /proc/self/exe for "swig -swiglib" on non-Win32 + platforms. + +If it wasn't found, then fall back to a fixed string just as before. + +Upstream-Status: Submitted +http://sourceforge.net/mailarchive/message.php?msg_id=29179733 + +--- + Source/Modules/main.cxx | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx +index d2f5d3b..cbb0a12 100644 +--- a/Source/Modules/main.cxx ++++ b/Source/Modules/main.cxx +@@ -26,6 +26,11 @@ char cvsroot_main_cxx[] = "$Id$"; + #include "cparse.h" + #include <ctype.h> + #include <limits.h> // for INT_MAX ++#ifndef _WIN32 ++#include <cstddef> ++#include <unistd.h> // for readlink ++#include <sys/stat.h> // for stat ++#endif + + // Global variables + +@@ -902,9 +907,9 @@ int SWIG_main(int argc, char *argv[], Language *l) { + + // Check for SWIG_LIB environment variable + if ((c = getenv("SWIG_LIB")) == (char *) 0) { ++ char *p; + #if defined(_WIN32) + char buf[MAX_PATH]; +- char *p; + if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) { + *(p + 1) = '\0'; + SwigLib = NewStringf("%sLib", buf); // Native windows installation path +@@ -914,7 +919,22 @@ int SWIG_main(int argc, char *argv[], Language *l) { + if (Len(SWIG_LIB_WIN_UNIX) > 0) + SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw) + #else +- SwigLib = NewString(SWIG_LIB); ++ char buf[PATH_MAX]; ++ if (0 < ::readlink("/proc/self/exe", buf, sizeof(buf)) && ++ (p = ::strstr(buf, "/bin/swig"))) { ++ int major, minor, patch; ++ const int ret = ::sscanf(VERSION, "%d.%d.%d", &major, &minor, &patch); ++ if (3 == ret) { ++ const ::ptrdiff_t dir_part_len = p - buf; ++ ::snprintf(p, PATH_MAX - dir_part_len, "/share/swig/%d.%d.%d", major, minor, patch); ++ struct ::stat stat_res; ++ if (0 == ::stat(buf, &stat_res) && S_ISDIR(stat_res.st_mode)) { ++ SwigLib = NewString(buf); ++ } ++ } ++ } ++ if (NULL == SwigLib) ++ SwigLib = NewString(SWIG_LIB); + #endif + } else { + SwigLib = NewString(c); +-- +1.7.9.5 + diff --git a/external/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch b/external/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch new file mode 100644 index 00000000..1b1128ac --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch @@ -0,0 +1,64 @@ +From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001 +From: Koen Kooi <koen.kooi@linaro.org> +Date: Tue, 17 Jun 2014 08:18:17 +0200 +Subject: [PATCH] configure: use pkg-config for pcre detection + +Signed-off-by: Koen Kooi <koen.kooi@linaro.org> +Upstream-Status: pending +--- + configure.ac | 38 +++++++------------------------------- + 1 file changed, 7 insertions(+), 31 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 0c984b7..6edcec1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -70,38 +70,14 @@ 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]) +- 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 +- fi +- fi +- AC_MSG_RESULT([$local_pcre_config]) +-fi +-AS_IF([test "x$with_pcre" != xno], +- [AX_PATH_GENERIC([pcre], +- [], 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" +- ], +- [AC_MSG_FAILURE([ +- Cannot find pcre-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). +- - Download the PCRE 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 +- link against. Run 'Tools/pcre-build.sh --help' for instructions. +- (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).]) +- ]) ++ PKG_CHECK_MODULES([PCRE], [libpcre], [ ++ AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library]) ++ LIBS="$LIBS $PCRE_LIBS" ++ CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS" ++ ], [ ++ AC_MSG_WARN([$PCRE_PKG_ERRORS]) + ]) ++fi + + + dnl CCache +-- +1.9.3 + diff --git a/external/poky/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch b/external/poky/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch new file mode 100644 index 00000000..a9138591 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig/Python-Fix-new-GCC8-warnings-in-generated-code.patch @@ -0,0 +1,191 @@ +From b6c0ef4b8f6e5c089ac7104b3aaba8f1d17b8b82 Mon Sep 17 00:00:00 2001 +From: Olly Betts <olly@survex.com> +Date: Mon, 11 Jun 2018 15:51:53 +1200 +Subject: [PATCH] [Python] Fix new GCC8 warnings in generated code + +Avoid casts between incompatible function types where possible (when +keyword args are in use, it is not possible to avoid such warnings as +they are inherent in the design of Python's C API in that particular +case). Fixes #1259. + +Upstream-Status: Backport +[https://github.com/swig/swig/commit/7f9883011029674553a2a4b623d459f02b512458] + +Signed-off-by: Yi Zhao <yi.zhao@windriver.com> +--- + Lib/python/pyinit.swg | 4 ++-- + Lib/python/pyrun.swg | 34 ++++++++++++++++++++++++++-------- + Source/Modules/python.cxx | 26 +++++++++++++------------- + 3 files changed, 41 insertions(+), 23 deletions(-) + +diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg +index 2cc5828..6bf68c1 100644 +--- a/Lib/python/pyinit.swg ++++ b/Lib/python/pyinit.swg +@@ -368,8 +368,8 @@ SWIG_init(void) { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { +- (PyCFunction) SwigPyObject_own, +- (PyCFunction) SwigPyObject_own ++ SwigPyObject_own, ++ SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure +diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg +index ab1237f..3d0b1b3 100644 +--- a/Lib/python/pyrun.swg ++++ b/Lib/python/pyrun.swg +@@ -465,6 +465,14 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args) + return repr; + } + ++/* We need a version taking two PyObject* parameters so it's a valid ++ * PyCFunction to use in swigobject_methods[]. */ ++SWIGRUNTIME PyObject * ++SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) ++{ ++ return SwigPyObject_repr((SwigPyObject*)v); ++} ++ + SWIGRUNTIME int + SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) + { +@@ -594,11 +602,7 @@ SwigPyObject_append(PyObject* v, PyObject* next) + } + + SWIGRUNTIME PyObject* +-#ifdef METH_NOARGS +-SwigPyObject_next(PyObject* v) +-#else + SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +-#endif + { + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { +@@ -633,6 +637,20 @@ SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) + return SWIG_Py_Void(); + } + ++#ifdef METH_NOARGS ++static PyObject* ++SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) ++{ ++ return SwigPyObject_disown(v); ++} ++ ++static PyObject* ++SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) ++{ ++ return SwigPyObject_acquire(v); ++} ++#endif ++ + SWIGINTERN PyObject* + SwigPyObject_own(PyObject *v, PyObject *args) + { +@@ -673,12 +691,12 @@ SwigPyObject_own(PyObject *v, PyObject *args) + #ifdef METH_O + static PyMethodDef + swigobject_methods[] = { +- {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, +- {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, ++ {(char *)"disown", (PyCFunction)SwigPyObject_disown2, METH_NOARGS, (char *)"releases ownership of the pointer"}, ++ {(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, +- {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, ++ {(char *)"__repr__",(PyCFunction)SwigPyObject_repr2, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} + }; + #else +@@ -689,7 +707,7 @@ swigobject_methods[] = { + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, +- {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, ++ {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} + }; + #endif +diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx +index a6801fc..72eaa77 100644 +--- a/Source/Modules/python.cxx ++++ b/Source/Modules/python.cxx +@@ -1109,7 +1109,7 @@ public: + * ------------------------------------------------------------ */ + int add_pyinstancemethod_new() { + String *name = NewString("SWIG_PyInstanceMethod_New"); +- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, NULL},\n", name, name); ++ Printf(methods, "\t { \"%s\", %s, METH_O, NULL},\n", name, name); + Delete(name); + return 0; + } +@@ -2479,17 +2479,17 @@ public: + if (!kw) { + if (n && funpack) { + if (num_required == 0 && num_arguments == 0) { +- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_NOARGS, ", name, function); ++ Printf(methods, "\t { \"%s\", %s, METH_NOARGS, ", name, function); + } else if (num_required == 1 && num_arguments == 1) { +- Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, ", name, function); ++ Printf(methods, "\t { \"%s\", %s, METH_O, ", name, function); + } else { +- Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function); ++ Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function); + } + } else { +- Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function); ++ Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function); + } + } else { +- Printf(methods, "\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function); ++ Printf(methods, "\t { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, ", name, function); + } + + if (!n) { +@@ -3857,7 +3857,7 @@ public: + if (shadow) { + if (builtin) { + String *rname = SwigType_namestr(real_classname); +- Printf(builtin_methods, " { \"__disown__\", (PyCFunction) Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname); ++ Printf(builtin_methods, " { \"__disown__\", Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname); + Delete(rname); + } else { + String *symname = Getattr(n, "sym:name"); +@@ -4694,13 +4694,13 @@ public: + int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2; + String *ds = have_docstring(n) ? cdocstring(n, AUTODOC_FUNC) : NewString(""); + if (check_kwargs(n)) { +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS|METH_KEYWORDS, (char *) \"%s\" },\n", symname, wname, ds); ++ Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, \"%s\" },\n", symname, wname, ds); + } else if (argcount == 0) { +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_NOARGS, (char *) \"%s\" },\n", symname, wname, ds); ++ Printf(builtin_methods, " { \"%s\", %s, METH_NOARGS, \"%s\" },\n", symname, wname, ds); + } else if (argcount == 1) { +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_O, (char *) \"%s\" },\n", symname, wname, ds); ++ Printf(builtin_methods, " { \"%s\", %s, METH_O, \"%s\" },\n", symname, wname, ds); + } else { +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, METH_VARARGS, (char *) \"%s\" },\n", symname, wname, ds); ++ Printf(builtin_methods, " { \"%s\", %s, METH_VARARGS, \"%s\" },\n", symname, wname, ds); + } + Delete(fullname); + Delete(wname); +@@ -4801,10 +4801,10 @@ public: + Append(pyflags, "METH_VARARGS"); + if (have_docstring(n)) { + String *ds = cdocstring(n, AUTODOC_STATICFUNC); +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, (char *) \"%s\" },\n", symname, wname, pyflags, ds); ++ Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, %s, \"%s\" },\n", symname, wname, pyflags, ds); + Delete(ds); + } else { +- Printf(builtin_methods, " { \"%s\", (PyCFunction) %s, %s, \"\" },\n", symname, wname, pyflags); ++ Printf(builtin_methods, " { \"%s\", (PyCFunction)%s, %s, \"\" },\n", symname, wname, pyflags); + } + Delete(fullname); + Delete(wname); +-- +2.7.4 + diff --git a/external/poky/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch b/external/poky/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch new file mode 100644 index 00000000..10e4afd1 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig/swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch @@ -0,0 +1,36 @@ +From 9825fcbab5c4ddd867432f9922bebfbec7b78af0 Mon Sep 17 00:00:00 2001 +From: Mark Dufour <m.dufour@kopano.com> +Date: Tue, 14 Feb 2017 10:34:37 +0100 +Subject: [PATCH] [Coverity] fix issue reported for SWIG_Python_FixMethods + +Fix Coverity issue reported for SWIG_Python_FixMethods: + +"buffer_size: Calling strncpy with a source string whose length +(10 chars) is greater than or equal to the size argument (10) +will fail to null-terminate buff." + +The issue is only reported for the "swig_ptr: " line, but for +consistency we replace both occurrences of strncpy with memcpy. +--- +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Backport [https://github.com/swig/swig/pull/898] + + Lib/python/pyinit.swg | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: swig-3.0.12/Lib/python/pyinit.swg +=================================================================== +--- swig-3.0.12.orig/Lib/python/pyinit.swg ++++ swig-3.0.12/Lib/python/pyinit.swg +@@ -306,9 +306,9 @@ SWIG_Python_FixMethods(PyMethodDef *meth + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; +- strncpy(buff, methods[i].ml_doc, ldoc); ++ memcpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; +- strncpy(buff, "swig_ptr: ", 10); ++ memcpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; diff --git a/external/poky/meta/recipes-devtools/swig/swig_3.0.12.bb b/external/poky/meta/recipes-devtools/swig/swig_3.0.12.bb new file mode 100644 index 00000000..fe9d0747 --- /dev/null +++ b/external/poky/meta/recipes-devtools/swig/swig_3.0.12.bb @@ -0,0 +1,11 @@ +require ${BPN}.inc + +SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ + file://0001-configure-use-pkg-config-for-pcre-detection.patch \ + file://0001-Add-Node-7.x-aka-V8-5.2-support.patch \ + file://swig-3.0.12-Coverity-fix-issue-reported-for-SWIG_Python_FixMetho.patch \ + file://Python-Fix-new-GCC8-warnings-in-generated-code.patch \ + " +SRC_URI[md5sum] = "82133dfa7bba75ff9ad98a7046be687c" +SRC_URI[sha256sum] = "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d" + |