couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1064399 - in /couchdb/trunk: CHANGES INSTALL.Unix NEWS bin/couchjs.tpl.in configure.ac src/couchdb/priv/couch_js/http.c src/couchdb/priv/couch_js/main.c test/javascript/run.tpl
Date Fri, 28 Jan 2011 01:06:43 GMT
Author: davisp
Date: Fri Jan 28 01:06:42 2011
New Revision: 1064399

URL: http://svn.apache.org/viewvc?rev=1064399&view=rev
Log:
CouchDB no longer requires cURL to build.

cURL is only used by the command line JavaScript test suite
which is not run by a large number of users. This change
no longer requires cURL to be available for all CouchDB
installations.

Thanks to Randall Leeds for the patch.
Closes COUCHDB-1042


Modified:
    couchdb/trunk/CHANGES
    couchdb/trunk/INSTALL.Unix
    couchdb/trunk/NEWS
    couchdb/trunk/bin/couchjs.tpl.in
    couchdb/trunk/configure.ac
    couchdb/trunk/src/couchdb/priv/couch_js/http.c
    couchdb/trunk/src/couchdb/priv/couch_js/main.c
    couchdb/trunk/test/javascript/run.tpl

Modified: couchdb/trunk/CHANGES
URL: http://svn.apache.org/viewvc/couchdb/trunk/CHANGES?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/CHANGES (original)
+++ couchdb/trunk/CHANGES Fri Jan 28 01:06:42 2011
@@ -6,6 +6,13 @@ Version 1.2.0
 
 This version has not been released yet.
 
+Build System:
+
+ * cURL is no longer required to build CouchDB as it is only
+   used by the command line JS test runner. If cURL is available
+   when building CouchJS you can enable the HTTP bindings by
+   passing -H on the command line.
+
 OAuth:
 
  * Updated budled erlang_oauth library to the latest version.

Modified: couchdb/trunk/INSTALL.Unix
URL: http://svn.apache.org/viewvc/couchdb/trunk/INSTALL.Unix?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/INSTALL.Unix (original)
+++ couchdb/trunk/INSTALL.Unix Fri Jan 28 01:06:42 2011
@@ -12,11 +12,17 @@ You will need the following installed:
  * ICU                        (http://icu.sourceforge.net/)
  * OpenSSL                    (http://www.openssl.org/)
  * Mozilla SpiderMonkey (1.8) (http://www.mozilla.org/js/spidermonkey/)
- * libcurl                    (http://curl.haxx.se/libcurl/)
  * GNU Make                   (http://www.gnu.org/software/make/)
  * GNU Compiler Collection    (http://gcc.gnu.org/)
 
 It is recommended that you install Erlang OTP R12B-5 or above where possible.
+ 
+Optional dependencies:
+ 
+ * libcurl                    (http://curl.haxx.se/libcurl/)
+
+This only affects the command line JavaScript test suite which
+most users do not use.
 
 Ubuntu
 ~~~~~~

Modified: couchdb/trunk/NEWS
URL: http://svn.apache.org/viewvc/couchdb/trunk/NEWS?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/NEWS (original)
+++ couchdb/trunk/NEWS Fri Jan 28 01:06:42 2011
@@ -13,6 +13,8 @@ Version 1.2.0
 This version has not been released yet.
 
  * Updated budled erlang_oauth library to the latest version.
+ * cURL is no longer required to build CouchDB as it is only
+   required by the command line JS test runner.
 
 Version 1.0.1
 -------------

Modified: couchdb/trunk/bin/couchjs.tpl.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/bin/couchjs.tpl.in?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/bin/couchjs.tpl.in (original)
+++ couchdb/trunk/bin/couchjs.tpl.in Fri Jan 28 01:06:42 2011
@@ -48,6 +48,8 @@ Options:
 
   -h  display a short help message and exit
   -V  display version information and exit
+  -H  install couchjs cURL bindings (only avaiable
+      if CouchDB was built with cURL available)
 
 Report bugs at <%bug_uri%>.
 EOF
@@ -68,7 +70,7 @@ run_couchjs () {
 
 parse_script_option_list () {
     set +e
-    options=`getopt hV $@`
+    options=`getopt hVH $@`
     if test ! $? -eq 0; then
         display_error
     fi
@@ -82,11 +84,12 @@ parse_script_option_list () {
             *) break;;
         esac
     done
-    option_list=`echo $@ | sed 's/--//'`
-    if test -z "$option_list"; then
+    script_name=`echo $@ | sed -e 's/.*--[[:blank:]]*//'`
+    if test -z "$script_name"; then
         display_error "You must specify a FILE."
     fi
-    run_couchjs $option_list
+    options=`echo $@ | sed -e 's/--//'`
+    run_couchjs $options
 }
 
 parse_script_option_list $@

Modified: couchdb/trunk/configure.ac
URL: http://svn.apache.org/viewvc/couchdb/trunk/configure.ac?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/configure.ac (original)
+++ couchdb/trunk/configure.ac Fri Jan 28 01:06:42 2011
@@ -207,6 +207,7 @@ AC_SUBST(ICU_LOCAL_CFLAGS)
 AC_SUBST(ICU_LOCAL_LDFLAGS)
 AC_SUBST(ICU_LOCAL_BIN)
 
+use_curl=yes
 AC_ARG_WITH([win32-curl], [AC_HELP_STRING([--with-win32-curl=PATH],
     [set PATH to the Win32 native curl directory])], [
     # default build on windows is a static lib, and that's what we want too
@@ -214,7 +215,11 @@ AC_ARG_WITH([win32-curl], [AC_HELP_STRIN
     CURL_LIBS="$withval/lib/libcurl"
     CURL_LDFLAGS="-l$CURL_LIBS -lWs2_32 -lkernel32 -luser32 -ladvapi32 -lWldap32"
 ], [
-    AC_CHECK_CURL([7.18.0])
+    AC_CHECK_CURL([7.18.0],
+        [AC_DEFINE([HAVE_CURL], [1], ["Provide HTTP support to couchjs"])], [
+        AC_MSG_WARN([You will be unable to run some JavaScript unit tests.])
+        use_curl=no
+    ])
     CURL_LDFLAGS=-lcurl
 ])
 
@@ -351,6 +356,7 @@ AM_CONDITIONAL([INIT], [test x${init_ena
 AM_CONDITIONAL([LAUNCHD], [test x${launchd_enabled} = xtrue])
 AM_CONDITIONAL([HELP2MAN], [test x${help2man_enabled} = xtrue])
 AM_CONDITIONAL([USE_NATIVE_MOCHIJSON], [test x${native_mochijson_enabled} = xyes])
+AM_CONDITIONAL([USE_CURL], [test x${use_curl} = xyes])
 
 AC_SUBST([package_author_name], ["LOCAL_PACKAGE_AUTHOR_NAME"])
 AC_SUBST([package_author_address], ["LOCAL_PACKAGE_AUTHOR_ADDRESS"])

Modified: couchdb/trunk/src/couchdb/priv/couch_js/http.c
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/priv/couch_js/http.c?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/priv/couch_js/http.c (original)
+++ couchdb/trunk/src/couchdb/priv/couch_js/http.c Fri Jan 28 01:06:42 2011
@@ -10,10 +10,27 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <jsapi.h>
+
+#ifndef HAVE_CURL
+
+// Soft dependency on cURL bindings because they're
+// only used when running the JS tests from the
+// command line which is rare.
+JSObject*
+install_http(JSContext* cx, JSObject* glbl)
+{
+    fprintf(stderr, "ERROR: couchjs was not built with cURL support.\n");
+    return NULL;
+}
+
+#else
+
 #include <curl/curl.h>
 
 #include "utf8.h"
@@ -673,3 +690,5 @@ str_from_binary(JSContext* cx, char* dat
 
     return ret;
 }
+
+#endif /* HAVE_CURL */

Modified: couchdb/trunk/src/couchdb/priv/couch_js/main.c
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/priv/couch_js/main.c?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/priv/couch_js/main.c (original)
+++ couchdb/trunk/src/couchdb/priv/couch_js/main.c Fri Jan 28 01:06:42 2011
@@ -272,14 +272,48 @@ static JSClass global_class = {
 };
 
 int
+usage()
+{
+    fprintf(stderr, "usage: couchjs [-H] [script_name]\n");
+    return 1;
+}
+
+int
 main(int argc, const char * argv[])
 {
     JSRuntime* rt = NULL;
     JSContext* cx = NULL;
     JSObject* global = NULL;
     JSFunctionSpec* sp = NULL;
+    char* script_name = NULL;
+    int use_http = 0;
     int i = 0;
-    
+
+    if(argc > 3)
+    {
+        fprintf(stderr, "ERROR: Too many arguments.\n");
+        return usage();
+    }
+    else if(argc == 3)
+    {
+        if(strcmp(argv[1], "-H"))
+        {
+            fprintf(stderr, "ERROR: Invalid option: %s\n", argv[1]);
+            return usage();
+        }
+        use_http = 1;
+        script_name = argv[2];
+    }
+    else if(argc == 2 && strcmp(argv[1], "-H") == 0)
+    {
+        use_http = 1;
+    }
+    else if (argc == 2)
+    {
+        script_name = argv[1];
+    }
+    // else argc == 1, use defaults
+
     rt = JS_NewRuntime(64L * 1024L * 1024L);
     if (!rt) return 1;
 
@@ -305,28 +339,13 @@ main(int argc, const char * argv[])
         }
     }
 
-    if(!install_http(cx, global))
+    if(use_http && !install_http(cx, global))
     {
-        return 1;
-    }
-    
-    JS_SetGlobalObject(cx, global);
-
-    if(argc > 2)
-    {
-        fprintf(stderr, "incorrect number of arguments\n\n");
-        fprintf(stderr, "usage: %s <scriptfile>\n", argv[0]);
         return 2;
     }
 
-    if(argc == 0)
-    {
-        execute_script(cx, global, NULL);
-    }
-    else
-    {
-        execute_script(cx, global, argv[1]);
-    }
+    JS_SetGlobalObject(cx, global);
+    execute_script(cx, global, script_name);
 
     FINISH_REQUEST(cx);
 

Modified: couchdb/trunk/test/javascript/run.tpl
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/javascript/run.tpl?rev=1064399&r1=1064398&r2=1064399&view=diff
==============================================================================
--- couchdb/trunk/test/javascript/run.tpl (original)
+++ couchdb/trunk/test/javascript/run.tpl Fri Jan 28 01:06:42 2011
@@ -27,4 +27,4 @@ cat $SCRIPT_DIR/json2.js \
 	$SCRIPT_DIR/test/*.js \
 	$JS_TEST_DIR/couch_http.js \
 	$JS_TEST_DIR/cli_runner.js \
-    | $COUCHJS -
+    | $COUCHJS -H -



Mime
View raw message