summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorjiangph <jiangph@cn.ibm.com>2019-12-03 10:47:02 +0800
committerjiangph <jiangph@cn.ibm.com>2019-12-20 22:46:36 +0800
commitec416c39285b248cf78c8a21403e61a5d6686da6 (patch)
treea01fef3aaf2434e487afd4e156669c1b569ab370 /support
parent227f1d657720d97148f09536762b5c7bdebeee8f (diff)
downloadcouchdb-ec416c39285b248cf78c8a21403e61a5d6686da6.tar.gz
Add Javascript to support Spidermonkey 60sm60-davisp
Co-Authored-By: Paul J. Davis <paul.joseph.davis@gmail.com>
Diffstat (limited to 'support')
-rw-r--r--support/build_js.escript79
1 files changed, 55 insertions, 24 deletions
diff --git a/support/build_js.escript b/support/build_js.escript
index e4cb282ee..90ad3168f 100644
--- a/support/build_js.escript
+++ b/support/build_js.escript
@@ -19,28 +19,59 @@
main([]) ->
- JsFiles = ["share/server/json2.js",
- "share/server/dreyfus.js",
- "share/server/filter.js",
- "share/server/mimeparse.js",
- "share/server/render.js",
- "share/server/state.js",
- "share/server/util.js",
- "share/server/validate.js",
- "share/server/views.js",
- "share/server/loop.js"],
-
- CoffeeFiles = ["share/server/json2.js",
- "share/server/dreyfus.js",
- "share/server/filter.js",
- "share/server/mimeparse.js",
- "share/server/render.js",
- "share/server/state.js",
- "share/server/util.js",
- "share/server/validate.js",
- "share/server/views.js",
- "share/server/coffee-script.js",
- "share/server/loop.js"],
+
+ CouchConfig = case filelib:is_file(os:getenv("COUCHDB_CONFIG")) of
+ true ->
+ {ok, Result} = file:consult(os:getenv("COUCHDB_CONFIG")),
+ Result;
+ false ->
+ []
+ end,
+
+ SMVsn = case lists:keyfind(spidermonkey_version, 1, CouchConfig) of
+ {_, Vsn} -> Vsn;
+ undefined -> "1.8.5"
+ end,
+
+ JsFiles = [
+ "share/server/json2.js",
+ "share/server/dreyfus.js",
+ "share/server/filter.js",
+ "share/server/mimeparse.js",
+ "share/server/render.js",
+ "share/server/state.js",
+ "share/server/util.js",
+ "share/server/validate.js",
+ "share/server/views.js",
+ "share/server/loop.js"
+ ],
+
+ CoffeeFiles = [
+ "share/server/json2.js",
+ "share/server/dreyfus.js",
+ "share/server/filter.js",
+ "share/server/mimeparse.js",
+ "share/server/render.js",
+ "share/server/state.js",
+ "share/server/util.js",
+ "share/server/validate.js",
+ "share/server/views.js",
+ "share/server/coffee-script.js",
+ "share/server/loop.js"
+ ],
+
+ ExtraFiles = case SMVsn of
+ "1.8.5" ->
+ [
+ "share/server/rewrite_fun.js"
+ ];
+ "60" ->
+ [
+ "share/server/60/esprima.js",
+ "share/server/60/escodegen.js",
+ "share/server/60/rewrite_fun.js"
+ ]
+ end,
Pre = "(function () {\n",
Post = "})();\n",
@@ -54,6 +85,6 @@ main([]) ->
file:write_file(To, FinalBin)
end,
- ok = Concat(JsFiles, "share/server/main.js"),
- ok = Concat(CoffeeFiles, "share/server/main-coffee.js"),
+ ok = Concat(ExtraFiles ++ JsFiles, "share/server/main.js"),
+ ok = Concat(ExtraFiles ++ CoffeeFiles, "share/server/main-coffee.js"),
ok.