Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E83E511837 for ; Sat, 19 Apr 2014 02:38:39 +0000 (UTC) Received: (qmail 53867 invoked by uid 500); 19 Apr 2014 02:38:39 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 53738 invoked by uid 500); 19 Apr 2014 02:38:38 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 53731 invoked by uid 99); 19 Apr 2014 02:38:37 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Apr 2014 02:38:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F17B3993AA7; Sat, 19 Apr 2014 02:38:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wohali@apache.org To: commits@couchdb.apache.org Message-Id: <5c6f1a93b23c4b09ba1ec0143906b2b2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couch commit: updated refs/heads/1994-merge-rcouch to f979b74 Date: Sat, 19 Apr 2014 02:38:36 +0000 (UTC) Repository: couchdb-couch Updated Branches: refs/heads/1994-merge-rcouch f9e309519 -> f979b74f5 Support Windows build, use official JS src (for now) Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/f979b74f Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/f979b74f Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/f979b74f Branch: refs/heads/1994-merge-rcouch Commit: f979b74f5cc1b5eff16a4bac0f825c51562852f1 Parents: f9e3095 Author: Joan Touzet Authored: Fri Apr 18 22:38:13 2014 -0400 Committer: Joan Touzet Committed: Fri Apr 18 22:38:13 2014 -0400 ---------------------------------------------------------------------- .gitattributes | 2 ++ .gitignore | 2 ++ build_spidermonkey.ps1 | 70 +++++++++++++++++++++++++++++++++++++++++++++ build_spidermonkey.sh | 6 ++-- c_src/couch_js/http.c | 4 ++- rebar.config.script | 32 +++++++++++++++++---- 6 files changed, 107 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/.gitattributes ---------------------------------------------------------------------- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1135ec5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* -text + http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8c21e0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +c_src/couch_js/config.h +*~ http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/build_spidermonkey.ps1 ---------------------------------------------------------------------- diff --git a/build_spidermonkey.ps1 b/build_spidermonkey.ps1 new file mode 100644 index 0000000..21c7aea --- /dev/null +++ b/build_spidermonkey.ps1 @@ -0,0 +1,70 @@ +param([switch]$clean) + +$JS_ZIP = "js185-1.0.0-win32.zip" +$JS_URL="http://www.atypical.net/apache" + +$DISTDIR="${pwd}\.dists" +$JSLIBS="${pwd}\.libs\js" + +# +# improved remove-item -recurse -force +# thanks to http://serverfault.com/questions/199921/powershell-remove-force +# +function rmrf($directory = $(throw "Required parameter missing")) { + if ((test-path $directory) -and -not + (gi $directory | ? { $_.PSIsContainer })) { + throw ("rmrf called on non-directory."); + } + + $finished = $false; + $attemptsLeft = 3; + + do { + if (test-path $directory) { + rm $directory -recurse -force 2>&1 | out-null + } + if (test-path $directory) { + Start-Sleep -Milliseconds 500 + $attemptsLeft = $attemptsLeft - 1 + } else { + $finished = $true + } + } while (-not $finished -and $attemptsLeft -gt 0) + + if (test-path $directory) { + throw ("Unable to fully remove directory " + $directory) + } +} + + +# +# main +# +if ($clean -eq $true) { + write-host "==> spidermonkey (clean)" + rmrf($JSLIBS) + rmrf($DISTDIR) +} else { + write-host "==> spidermonkey (binary-download)" + rmrf($JSLIBS) + rmrf($DISTDIR) + md $JSLIBS -ea silentlycontinue | out-null + md $DISTDIR -ea silentlycontinue | out-null + + # download the zip + $source = "${JS_URL}/${JS_ZIP}" + $dest = "${DISTDIR}\${JS_ZIP}" + if (-not (test-path $dest)) { + write-host "==> Fetch ${JS_ZIP} to ${dest}" + $wc = New-Object System.Net.WebClient + $wc.DownloadFile($source, $dest) + } + + # unpack the zip + $shell = new-object -com shell.application + $zip = $shell.NameSpace($dest) + foreach($item in $zip.items()) + { + $shell.Namespace($JSLIBS).copyhere($item) + } +} http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/build_spidermonkey.sh ---------------------------------------------------------------------- diff --git a/build_spidermonkey.sh b/build_spidermonkey.sh index 95a15dd..a1d4efc 100755 --- a/build_spidermonkey.sh +++ b/build_spidermonkey.sh @@ -20,13 +20,13 @@ DISTDIR=$CORE_TOP/.dists # nspr sources NSPR_VER=4.8.8 NSPR_DISTNAME=nspr-$NSPR_VER.tar.gz -NSPR_SITE=http://dl.refuge.io +NSPR_SITE=http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.8/src/ # spidermonkey js sources JS_VER=185-1.0.0 JS_REALVER=1.8.5 JS_DISTNAME=js$JS_VER.tar.gz -JS_SITE=http://dl.refuge.io +JS_SITE=http://ftp.mozilla.org/pub/mozilla.org/js JSDIR=$STATICLIBS/js-$JS_REALVER JS_LIBDIR=$STATICLIBS/js/lib JS_INCDIR=$STATICLIBS/js/include @@ -155,7 +155,7 @@ build_js() cp $JSDIR/js/src/*.h $JS_INCDIR cp $JSDIR/js/src/*.tbl $JS_INCDIR cp $JSDIR/js/src/libjs_static.a $JS_LIBDIR -} + do_setup() http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/c_src/couch_js/http.c ---------------------------------------------------------------------- diff --git a/c_src/couch_js/http.c b/c_src/couch_js/http.c index 3baa59d..f87b635 100644 --- a/c_src/couch_js/http.c +++ b/c_src/couch_js/http.c @@ -15,7 +15,9 @@ #include #include #include -#include +#ifndef _WIN32 + #include +#endif #include #include "utf8.h" #include "util.h" http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f979b74f/rebar.config.script ---------------------------------------------------------------------- diff --git a/rebar.config.script b/rebar.config.script index 0a79ced..a9e436b 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -69,11 +69,10 @@ GetFlag = fun(Name, Default) -> end end, +{ok, Cwd} = file:get_cwd(), - -PortEnv = case os:getenv("COUCHDB_STATIC") of +PortEnvUnix = case os:getenv("COUCHDB_STATIC") of "1" -> - {ok, Cwd} = file:get_cwd(), IncJs = filename:join([Cwd, ".libs", "js", "include"]), IncNspr= filename:join([Cwd, ".libs", "nsprpub", "include"]), StaticJs = filename:join([Cwd, ".libs", "js", "lib", @@ -134,6 +133,19 @@ PortEnv = case os:getenv("COUCHDB_STATIC") of ] end, +% no support for static link on Win32/Win64 +PortEnv = case os:type() of + {win32, nt} -> + IncJS = filename:join([Cwd, ".libs", "js", "include", "js"]), + [ + {"CFLAGS", "$CFLAGS /I" ++ IncJS ++ + " /DXP_WIN /DWITHOUT_CURL /O2 /Ot /favor:blend /c /Wall"}, + {"LDFLAGS", "$LDFLAGS .libs\\js\\lib\\mozjs185-1.0.lib"} + ]; + _ -> + PortEnvUnix +end, + PortSpecs0 = [{filename:join(["priv", CouchJSName]), ["c_src/couch_js/*.c"]}], PortSpecs = case os:type() of @@ -149,7 +161,17 @@ PortSpecs = case os:type() of PortInfo = [{port_env, PortEnv}, {port_specs, PortSpecs}, - {pre_hooks, [{compile, "./build_spidermonkey.sh"}]}, - {post_hooks, [{clean, "./build_spidermonkey.sh clean"}]}], + {pre_hooks, [ + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", + compile, "./build_spidermonkey.sh"}, + {"(win32|win64)", compile, + "powershell ./build_spidermonkey.ps1"} + ]}, + {post_hooks, [ + {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", + clean, "./build_spidermonkey.sh clean"}, + {"(win32|win64)", clean, + "powershell ./build_spidermonkey.ps1 -clean"} + ]}], lists:keymerge(1,lists:keysort(1, PortInfo), lists:keysort(1, CONFIG)).