You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2019/12/02 20:58:26 UTC

[couchdb] 04/04: Allow configuring the use of SpiderMonkey 60

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch sm60-davisp
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 466d1d9e6107cdef8e49315837e7e3ea52aa747e
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Mon Dec 2 14:55:06 2019 -0600

    Allow configuring the use of SpiderMonkey 60
---
 src/couch/rebar.config.script | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/src/couch/rebar.config.script b/src/couch/rebar.config.script
index f4c0705..e384a83 100644
--- a/src/couch/rebar.config.script
+++ b/src/couch/rebar.config.script
@@ -57,6 +57,8 @@ end.
 SMVsn = case lists:keyfind(spidermonkey_version, 1, CouchConfig) of
     {_, "1.8.5"} ->
         "1.8.5";
+    {_, "60"} ->
+        "60";
     undefined ->
         "1.8.5";
     {_, Unsupported} ->
@@ -92,12 +94,22 @@ end,
     {win32, _} when SMVsn == "1.8.5" ->
         {
             "/DXP_WIN /IC:\\relax\\js-1.8.5\\js\\src",
-            "/LIBPATH:C:\\relax\\js-1.8.5\\js\\src mozjs185-1.0.lib"
+            "/LIBPATH:C:\\relax\\js-1.8.5\\js\\src mozjs60.lib"
         };
-    _ when SMVsn == "1.8.5" ->
+    {unix, _} when SMVsn == "1.8.5" ->
         {
-            "-DXP_UNIX -I/usr/inlude/js -I/usr/local/include/js",
+            "-DXP_UNIX -I/usr/include/js -I/usr/local/include/js",
             "-L/usr/local/lib -lmozjs185 -lm"
+        };
+    {win32, _} when SMVsn == "60" ->
+        {
+            "/DXP_WIN /IC:\\relax\\js-60\\js\\src",
+            "/LIBPATH:C:\\relax\\js-60\\js\\src mozjs60.0.lib"
+        };
+    {unix, _} when SMVsn == "60" ->
+        {
+            "-DXP_UNIX -I/usr/include/mozjs-60 -I/usr/local/include/mozjs-60 -std=c++14",
+            "-L/usr/local/lib -std=c++14 -lmozjs-60 -lm"
         }
 end.
 
@@ -125,9 +137,23 @@ end.
 end,
 
 CouchJSSrc = case SMVsn of
-    "1.8.5" -> ["priv/couch_js/1.8.5/*.c"]
+    "1.8.5" -> ["priv/couch_js/1.8.5/*.c"];
+    "60" -> ["priv/couch_js/60/*.cpp"]
 end.
 
+CouchJSEnv = case SMVsn of
+    "1.8.5" ->
+        [
+            {"CFLAGS", JS_CFLAGS ++ " " ++ CURL_CFLAGS},
+            {"LDFLAGS", JS_LDFLAGS ++ " " ++ CURL_LDFLAGS}
+        ];
+    "60" ->
+        [
+            {"CXXFLAGS", JS_CFLAGS ++ " " ++ CURL_CFLAGS},
+            {"LDFLAGS", JS_LDFLAGS ++ " " ++ CURL_LDFLAGS}
+        ]
+end,
+
 IcuPath = "priv/couch_icu_driver.so",
 IcuSrc = ["priv/icu_driver/*.c"],
 IcuEnv = [{"DRV_CFLAGS",  "$DRV_CFLAGS -DPIC -O2 -fno-common"},
@@ -144,7 +170,7 @@ CompareSrc = ["priv/couch_ejson_compare/*.c"],
 
 BaseSpecs = [
         %% couchjs
-        {".*", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " " ++ CURL_CFLAGS}, {"LDFLAGS", JS_LDFLAGS ++ " " ++ CURL_LDFLAGS}]}]},
+        {".*", CouchJSPath, CouchJSSrc, [{env, CouchJSEnv}]},
         % ICU
         {"darwin", IcuPath, IcuSrc, [{env, IcuEnv ++ IcuDarwinEnv}]},
         {"linux",  IcuPath, IcuSrc, [{env, IcuEnv}]},