[erlang-js] Enable back building with js-1.7.0 (EL6)

Peter Lemenkov peter at fedoraproject.org
Thu Jul 5 12:05:17 UTC 2012


commit e0a581b2913661a3d81193a429add0558fc00515
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Thu Jul 5 16:05:10 2012 +0400

    Enable back building with js-1.7.0 (EL6)
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 erlang-js-0002-Build-with-js-1.7.0.patch |   75 ++++++++++++++++++++++++++++++
 erlang-js.spec                           |   10 ++++-
 2 files changed, 84 insertions(+), 1 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
new file mode 100644
index 0000000..ed58be5
--- /dev/null
+++ b/erlang-js-0002-Build-with-js-1.7.0.patch
@@ -0,0 +1,75 @@
+From 09df9796e4a220ace193658cbc2887171e92411a 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/7] Build with js-1.7.0
+
+Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
+---
+ c_src/spidermonkey.c |   10 ++++++----
+ c_src/spidermonkey.h |    3 ++-
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/c_src/spidermonkey.c b/c_src/spidermonkey.c
+index 667a8d4..bd4e1cc 100644
+--- a/c_src/spidermonkey.c
++++ b/c_src/spidermonkey.c
+@@ -23,6 +23,9 @@
+ 
+ void free_error(spidermonkey_state *state);
+ 
++#define JS_SET_RVAL(cx,vp,v)    (*(vp) = (v))
++#define JS_ARGV(cx,vp)          ((vp) + 2)
++
+ /* The class of the global object. */
+ static JSClass global_class = {
+     "global", JSCLASS_GLOBAL_FLAGS,
+@@ -132,7 +135,7 @@ JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
+ }
+ 
+ void sm_configure_locale() {
+-  JS_SetCStringsAreUTF8();
++	return;
+ }
+ 
+ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
+@@ -146,13 +149,12 @@ 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);
+-  JS_SetScriptStackQuota(vm->context, thread_stack);
+ 
+   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);
+@@ -160,7 +162,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 2ab583b..44ddc0d 100644
+--- a/c_src/spidermonkey.h
++++ b/c_src/spidermonkey.h
+@@ -16,7 +16,8 @@
+ #ifndef __SPIDERMONKEY_INTERFACE_
+ #define __SPIDERMONKEY_INTERFACE_
+ 
+-#include "jsapi.h"
++#include <jsapi.h>
++#include <jsfun.h>
+ 
+ typedef struct _spidermonkey_error_t {
+   unsigned int lineno;
+-- 
+1.7.10.4
+
diff --git a/erlang-js.spec b/erlang-js.spec
index c401c45..de9eaa7 100644
--- a/erlang-js.spec
+++ b/erlang-js.spec
@@ -10,7 +10,7 @@
 
 Name:		erlang-%{realname}
 Version:	1.0.2
-Release:	1%{?dist}
+Release:	2%{?dist}
 Summary:	A Friendly Erlang to Javascript Binding
 Group:		Development/Libraries
 License:	ASL 2.0
@@ -24,6 +24,7 @@ Patch4:		erlang-js-0004-Use-mochiweb-instead-of-a-bundled-copies.patch
 Patch5:		erlang-js-0005-Use-standard-layout-for-rebar.patch
 Patch6:		erlang-js-0006-Dont-treat-warnings-as-errors.patch
 Patch7:		erlang-js-0007-Start-erlang_js-explicitly.patch
+Patch9999:	erlang-js-0002-Build-with-js-1.7.0.patch
 BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 BuildRequires:	erlang-rebar
 BuildRequires:	erlang-mochiweb
@@ -41,7 +42,11 @@ A Friendly Erlang to Javascript Binding.
 %prep
 %setup -q -n %{upstream}-erlang_%{realname}-0bf5965
 %patch1 -p1 -b .bundled_libs
+%if 0%{?fedora}
 %patch2 -p1 -b .building_with_js_1_8_0
+%else
+%patch9999 -p1 -b .building_with_js_1_7_0
+%endif
 %patch3	-p1 -b .fix_deprecation_warning
 %patch4 -p1 -b .use_globally_available_mochiweb
 %patch5 -p1 -b .standard_layout_for_rebar
@@ -87,6 +92,9 @@ rebar eunit -v
 
 
 %changelog
+* Thu Jul 05 2012 Peter Lemenkov <lemenkov at gmail.com> - 1.0.2-2
+- Enable back building with js-1.7.0 (EL6)
+
 * Thu Jul 05 2012 Peter Lemenkov <lemenkov at gmail.com> - 1.0.2-1
 - Ver. 1.0.2
 


More information about the scm-commits mailing list