20 COUCHDB_VERSION
=`cat ./version`
21 export COUCHDB_VERSION
23 COUCH_DIR
=build
/couch-
$COUCHDB_VERSION/ebin
24 COUCHDB_INSTALL_DIR
=/usr
/local
/
30 BUILD_FABRIC_TESTS
=false
32 while test $# != 0; do
35 ac_option
=`expr "x$1" : 'x\([^=]*\)='`
36 ac_optarg
=`expr "x$1" : 'x[^=]*=\(.*\)'`
44 *) # This is not an option, so the user has probably given explicit
47 ac_need_defaults
=false
;;
52 echo "Building CouchDb with Fabric Tests"
53 BUILD_FABRIC_TESTS
=true
58 COUCHDB_INSTALL_DIR
=$ac_optarg
59 if [ -z "$COUCHDB_INSTALL_DIR" ]; then
60 COUCHDB_INSTALL_DIR
=/usr
/local
61 export COUCHDB_INSTALL_DIR
66 ERLANG_LIB_DIR
=$ac_optarg
71 echo "The only available options at the moment are --install which installs CouchDb and --with-fabric-tests that additionally builds the FabricTests"
76 echo "Unkown option $ac_option. Try --help"
84 if [ -z "$ERLC" ]; then
89 if [ ! -x "$ERLC" ]; then
90 echo "Cannot find erlc. Please set ERLC manually. (e.g. export ERLC=/usr/local/erlang/bin/erlc)"
94 if [ ! -x "$JAVA" ]; then
95 echo "Cannot find java. Please put the directory where java resides into your PATH. (e.g. export PATH=$PATH:/usr/local/java/bin/)"
99 if [ -z "$ERLANG_INCLUDE_DIR" ]; then
100 ERLANG_INCLUDE_DIR
=/usr
/include
101 export ERLANG_INCLUDE_DIR
104 if [ ! -e "$ERLANG_INCLUDE_DIR/erl_driver.h" ]; then
105 echo "Cannot find erl_driver.h. Please set ERLANG_INCLUDE_DIR manually. (e.g. export ERLANG_INCLUDE_DIR=/usr/local/erlang/lib/usr/include)"
109 if [ ! -d "$COUCH_DIR" ]; then
113 COUCH_BIG_ENDIAN
=`uname -a|grep powerpc`;
115 if [ ! -z "$COUCH_BIG_ENDIAN" ]; then
116 COUCH_BIG_ENDIAN
=true
117 export COUCH_BIG_ENDIAN
122 if [ "$BUILD_FABRIC_TESTS" = "true" ]; then
123 $MAKE $BUILD_DIR/FabricTests
127 if [ "$INSTALL_COUCHDB" = "true" ]; then
129 if [ $ERLANG_LIB_DIR = "false" ]; then
130 echo "Please specify the Erlang lib directory with the --with-erlang=/path/to/erlang option"
135 echo "Installing CouchDb into $COUCHDB_INSTALL_DIR"
137 if [ -d "$COUCHDB_INSTALL_DIR/couchdb" ]; then
138 rm -rf "$COUCHDB_INSTALL_DIR/old.couchdb"
139 mv "$COUCHDB_INSTALL_DIR/couchdb" "$COUCHDB_INSTALL_DIR/old.couchdb"
142 mkdir
-p $COUCHDB_INSTALL_DIR/couchdb
145 COUCHDB_INSTALL_DIR
=$COUCHDB_INSTALL_DIR/couchdb
146 export COUCHDB_INSTALL_DIR