Repository: couchdb-couch Updated Branches: refs/heads/master 9d4b0fe72 -> 9aff2f663
Add libcurl support for Windows Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/9aff2f66 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/9aff2f66 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/9aff2f66 Branch: refs/heads/master Commit: 9aff2f663cd4a90e7b99aecb8044809f1af46922 Parents: 9d4b0fe Author: Joan Touzet <woh...@apache.org> Authored: Wed Sep 9 14:41:03 2015 -0400 Committer: Joan Touzet <woh...@apache.org> Committed: Wed Sep 9 14:41:20 2015 -0400 ---------------------------------------------------------------------- priv/couch_js/http.c | 2 ++ rebar.config.script | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9aff2f66/priv/couch_js/http.c ---------------------------------------------------------------------- diff --git a/priv/couch_js/http.c b/priv/couch_js/http.c index c5d5e88..c4b3896 100644 --- a/priv/couch_js/http.c +++ b/priv/couch_js/http.c @@ -83,7 +83,9 @@ http_uri(JSContext* cx, JSObject* req, couch_args* args, jsval* uri_val) #else #include <curl/curl.h> +#ifndef XP_WIN #include <unistd.h> +#endif void http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9aff2f66/rebar.config.script ---------------------------------------------------------------------- diff --git a/rebar.config.script b/rebar.config.script index 6d4968d..53b3ca9 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -62,9 +62,19 @@ ok = CopyIfDifferent(CouchJSConfig, ConfigBin), %% TODO support curl on Windows {JS_CFLAGS, JS_LDFLAGS} = case lists:keyfind(with_curl, 1, CouchConfig) of {with_curl, true} -> - {"-DHAVE_CURL ", "-DHAVE_CURL -lmozjs185 -lcurl"}; + case os:type() of + {win32, _} -> + {"/DHAVE_CURL /IC:\\relax\\curl\\include", "/LIBPATH:C:\\relax\\js-1.8.5\\js\\src /LIBPATH:C:\\Relax\\curl\\lib\\release-ssl mozjs185-1.0.lib libcurl_imp.lib"}; + _ -> + {"-DHAVE_CURL", "-DHAVE_CURL -lmozjs185 -lcurl"} + end; _ -> - {"", "-lmozjs185"} + case os:type() of + {win32, _} -> + {"", "/LIBPATH:C:\\relax\\js-1.8.5\\js\\src mozjs185-1.0.lib"}; + _ -> + {"", "-lmozjs185"} + end end, CouchJSSrc = ["priv/couch_js/*.c"], @@ -85,20 +95,20 @@ CompareSrc = ["priv/couch_ejson_compare/*.c"], BaseSpecs = [ %% couchjs - {"darwin", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -L/usr/local/lib"}]}]}, - {"linux", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]}, - {"bsd", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -L/usr/local/lib -lm"}]}]}, - {"win32", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", "/DXP_WIN /IC:\\relax\\js-1.8.5\\js\\src"}, {"LDFLAGS", "/LIBPATH:C:\\relax\\js-1.8.5\\js\\src mozjs185-1.0.lib"}]}]}, + {"darwin", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -L/usr/local/lib"}]}]}, + {"linux", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]}, + {"bsd", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -L/usr/local/lib -lm"}]}]}, + {"win32", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " /DXP_WIN /IC:\\relax\\js-1.8.5\\js\\src"}, {"LDFLAGS", JS_LDFLAGS}]}]}, % ICU {"darwin", IcuPath, IcuSrc, [{env, IcuEnv ++ IcuDarwinEnv}]}, {"linux", IcuPath, IcuSrc, [{env, IcuEnv}]}, {"bsd", IcuPath, IcuSrc, [{env, IcuEnv ++ IcuBsdEnv}]}, - {"win32", IcuPath, IcuSrc, [{env, IcuEnv ++ IcuWinEnv}]}, + {"win32", IcuPath, IcuSrc, [{env, IcuWinEnv}]}, % ejson_compare {"darwin", ComparePath, CompareSrc, [{env, IcuEnv ++ IcuDarwinEnv}]}, {"linux", ComparePath, CompareSrc, [{env, IcuEnv}]}, {"bsd", ComparePath, CompareSrc, [{env, IcuEnv ++ IcuBsdEnv}]}, - {"win32", ComparePath, CompareSrc, [{env, IcuEnv ++ IcuWinEnv}]} + {"win32", ComparePath, CompareSrc, [{env, IcuWinEnv}]} ], SpawnSpec = [