Skip to contentSkip to conversation

swig: enable support for Node.js >= 7.x

PATCH New yegorslists at googlemail.com 2 participants 4 messages Sep 29, 2017 – Oct 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swig: enable support for Node.js >= 7.x

From: Yegor Yefremov <[email protected]>

Recent Node.js versions have removed some depreciated API calls, that swig still relies on. Patches taken from this PR [1] fix this issue.

[1] https://github.com/swig/swig/pull/968

---
 .../0001-Add-Node-7.x-aka-V8-5.2-support.patch     | 328 +++++++++++++++++++++
 ...e-warnings-on-Node-6.x-aka-V8-5.0-and-5.1.patch | 222 ++++++++++++++
 2 files changed, 550 insertions(+)
 create mode 100644 package/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch
 create mode 100644 package/swig/0002-Remove-warnings-on-Node-6.x-aka-V8-5.0-and-5.1.patch
package/swig/0001-Add-Node-7.x-aka-V8-5.2-support.patch new file +328 -0
new file mode 100644
index 0000000..7f3002d
@@ -0,0 +1,328 @@
+From f08d7a63a92a3ba89d97bdfcc206e1e1c4804c0f Mon Sep 17 00:00:00 2001
+From: Patrick Schneider <[email protected]>
+Date: Thu, 13 Apr 2017 15:02:53 +0200
+Subject: [PATCH 1/2] 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
+
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ 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.1.4
+
package/swig/0002-Remove-warnings-on-Node-6.x-aka-V8-5.0-and-5.1.patch new file +222 -0

222 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 swig: enable support for Node.js >= 7.x

Hello,

Quoted 6 lines · yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

Recent Node.js versions have removed some depreciated API calls, that swig still relies on. Patches taken from this PR [1] fix this issue.

Quoted 6 lines

[1] https://github.com/swig/swig/pull/968

---
 .../0001-Add-Node-7.x-aka-V8-5.2-support.patch     | 328 +++++++++++++++++++++
 ...e-warnings-on-Node-6.x-aka-V8-5.0-and-5.1.patch | 222 ++++++++++++++

Applied to master.

To be honest, I hesitated a bit, those patches are a bit big and invasive, and have not been merged upstream yet. I've merged anyway, but we might need to drop them at the next swig bump if they haven't been merged upstream.

Also, how do you in practice build swig with nodejs support? There is no dependency between host-swig and host-nodejs.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 swig: enable support for Node.js >= 7.x

Hi Thomas,

Quoted 16 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

Recent Node.js versions have removed some depreciated API calls, that swig still relies on. Patches taken from this PR [1] fix this issue.

Quoted 6 lines

[1] https://github.com/swig/swig/pull/968

---
 .../0001-Add-Node-7.x-aka-V8-5.2-support.patch     | 328 +++++++++++++++++++++
 ...e-warnings-on-Node-6.x-aka-V8-5.0-and-5.1.patch | 222 ++++++++++++++
Quoted 6 lines

Applied to master.

To be honest, I hesitated a bit, those patches are a bit big and invasive, and have not been merged upstream yet. I've merged anyway, but we might need to drop them at the next swig bump if they haven't been merged upstream.

Thanks for merging. The problem is that the project lacks a Node.js maintainer. That's why none has applied the patch.

Quoted 2 lines

Also, how do you in practice build swig with nodejs support? There is no dependency between host-swig and host-nodejs.

SWIG as such has nothing to do with Node.js directly, but it creates code, that will be compiled against node.js via node-gyp utility [1]. BR uses newest Node.js version with removed obsolete APIs. That's why we need this patch, but SWIG has no direct dependency to host-nodejs.

[1] https://github.com/nodejs/node-gyp

Yegor

#3 lore raw

PATCH 1/1 swig: enable support for Node.js >= 7.x

Hello,

Quoted 7 lines · Yegor Yefremov
Quoted 4 lines

To be honest, I hesitated a bit, those patches are a bit big and invasive, and have not been merged upstream yet. I've merged anyway, but we might need to drop them at the next swig bump if they haven't been merged upstream.

Thanks for merging. The problem is that the project lacks a Node.js maintainer. That's why none has applied the patch.

Hopefully with all the comments received in the github PR, the Node.js maintainers will apply those patches.

Quoted 4 lines

SWIG as such has nothing to do with Node.js directly, but it creates code, that will be compiled against node.js via node-gyp utility [1]. BR uses newest Node.js version with removed obsolete APIs. That's why we need this patch, but SWIG has no direct dependency to host-nodejs.

OK, makes sense. Thanks for the explanation!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com