[erlang-js] Fix failure during tests if built with js-1.7.0 (EL5 & EL6)
Peter Lemenkov
peter at fedoraproject.org
Sun Sep 23 08:49:30 UTC 2012
commit 652b8e6b7864b67d4b5d466b55b42d085efdfc62
Author: Peter Lemenkov <lemenkov at gmail.com>
Date: Sun Sep 23 12:49:00 2012 +0400
Fix failure during tests if built with js-1.7.0 (EL5 & EL6)
Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
erlang-js-0002-Build-with-js-1.7.0.patch | 63 ++++++++++++++++--------------
erlang-js.spec | 6 ++-
2 files changed, 38 insertions(+), 31 deletions(-)
---
diff --git a/erlang-js-0002-Build-with-js-1.7.0.patch b/erlang-js-0002-Build-with-js-1.7.0.patch
index 2fe94fb..52a1847 100644
--- a/erlang-js-0002-Build-with-js-1.7.0.patch
+++ b/erlang-js-0002-Build-with-js-1.7.0.patch
@@ -1,29 +1,50 @@
-From 7bd3efed69a742ed4db84a850550a08ade387595 Mon Sep 17 00:00:00 2001
+From 1d602071ffc7b886f1073933cc6525de47268f51 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov at gmail.com>
Date: Thu, 28 Oct 2010 12:29:26 +0400
-Subject: [PATCH 2/5] Build with js-1.7.0
+Subject: [PATCH 2/6] Build with js-1.7.0
Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
---
- c_src/spidermonkey.c | 10 ++++++----
+ c_src/spidermonkey.c | 16 ++++++++++++----
c_src/spidermonkey.h | 3 ++-
- 2 files changed, 8 insertions(+), 5 deletions(-)
+ 2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/c_src/spidermonkey.c b/c_src/spidermonkey.c
-index 623c109..b485c6b 100644
+index 623c109..baf7ec2 100644
--- a/c_src/spidermonkey.c
+++ b/c_src/spidermonkey.c
-@@ -25,6 +25,9 @@
-
- void free_error(spidermonkey_state *state);
+@@ -23,6 +23,16 @@
+ #include "spidermonkey.h"
+ #include "erl_compatibility.h"
+#define JS_SET_RVAL(cx,vp,v) (*(vp) = (v))
-+#define JS_ARGV(cx,vp) ((vp) + 2)
+
++#ifndef JSVERSION_LATEST
++#define JSVERSION_LATEST JSVERSION_1_7
++#endif
++
++#ifndef JSFUN_FAST_NATIVE
++#define JSFUN_FAST_NATIVE JSFUN_INTERPRETED
++#endif
++
+ void free_error(spidermonkey_state *state);
+
/* The class of the global object. */
- static JSClass global_class = {
- "global", JSCLASS_GLOBAL_FLAGS,
-@@ -134,7 +137,7 @@ JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
+@@ -108,12 +118,11 @@ void write_timestamp(FILE *fd) {
+ tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+ }
+
+-JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
++JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp) {
+ if (argc != 2) {
+ JS_SET_RVAL(cx, vp, JSVAL_FALSE);
+ }
+ else {
+- jsval *argv = JS_ARGV(cx, vp);
+ jsval jsfilename = argv[0];
+ jsval jsoutput = argv[1];
+ char *filename = JS_GetStringBytes(JS_ValueToString(cx, jsfilename));
+@@ -134,7 +143,7 @@ JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
}
void sm_configure_locale(void) {
@@ -32,7 +53,7 @@ index 623c109..b485c6b 100644
}
spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
-@@ -148,13 +151,12 @@ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
+@@ -148,7 +157,6 @@ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
JS_SetGCParameter(vm->runtime, JSGC_MAX_BYTES, heap_size);
JS_SetGCParameter(vm->runtime, JSGC_MAX_MALLOC_BYTES, gc_size);
vm->context = JS_NewContext(vm->runtime, 8192);
@@ -40,22 +61,6 @@ index 623c109..b485c6b 100644
begin_request(vm);
JS_SetOptions(vm->context, JSOPTION_VAROBJFIX);
- JS_SetOptions(vm->context, JSOPTION_STRICT);
- JS_SetOptions(vm->context, JSOPTION_COMPILE_N_GO);
-- JS_SetOptions(vm->context, JSVERSION_LATEST);
-+ JS_SetOptions(vm->context, JSVERSION_1_7);
- vm->global = JS_NewObject(vm->context, &global_class, NULL, NULL);
- JS_InitStandardClasses(vm->context, vm->global);
- JS_SetErrorReporter(vm->context, on_error);
-@@ -162,7 +164,7 @@ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
- JS_SetContextPrivate(vm->context, state);
- JSNative funptr = (JSNative) &js_log;
- JS_DefineFunction(vm->context, JS_GetGlobalObject(vm->context), "ejsLog", funptr,
-- 0, JSFUN_FAST_NATIVE);
-+ 0, JSFUN_INTERPRETED);
- end_request(vm);
-
- return vm;
diff --git a/c_src/spidermonkey.h b/c_src/spidermonkey.h
index e68aecf..ce1bfeb 100644
--- a/c_src/spidermonkey.h
diff --git a/erlang-js.spec b/erlang-js.spec
index 4433340..dcf1f60 100644
--- a/erlang-js.spec
+++ b/erlang-js.spec
@@ -10,7 +10,7 @@
Name: erlang-js
Version: 1.2.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A Friendly Erlang to Javascript Binding
Group: Development/Libraries
License: ASL 2.0
@@ -90,6 +90,9 @@ rebar eunit -v
%changelog
+* Sun Sep 23 2012 Peter Lemenkov <lemenkov at gmail.com> - 1.2.1-2
+- Fix failure during tests if built with js-1.7.0 (EL5 & EL6)
+
* Sat Sep 22 2012 Peter Lemenkov <lemenkov at gmail.com> - 1.2.1-1
- Ver. 1.2.1
- Drop upstreamed patches
@@ -125,4 +128,3 @@ rebar eunit -v
* Fri Sep 10 2010 Peter Lemenkov <lemenkov at gmail.com> - 0.4-1
- Initial build
-
More information about the scm-commits
mailing list