set a bunch of svn:executable properties
[couchdbimport.git] / CouchProjects / build.sh
blob943631114b56e7a1058bdff574e9dc18c32ea3cb
1 #!/bin/sh
2 HOST=`uname`
3 export HOST
5 GCC=`which gcc`
6 export GCC
8 CPP=`which g++`
9 export CPP
11 MAKE=`which make`
12 export MAKE
14 JAVA=`which java`
15 export JAVA
17 BUILD_DIR=build
18 export BUILD_DIR
20 COUCHDB_VERSION=`cat ./version`
21 export COUCHDB_VERSION
23 COUCH_DIR=build/couch-$COUCHDB_VERSION/ebin
24 COUCHDB_INSTALL_DIR=/usr/local/
26 INSTALL_COUCHDB=false
27 BUILD_FABRIC_TESTS=false
28 # taken from autoconf
29 while test $# != 0; do
30 case $1 in
31 --*=*)
32 ac_option=`expr "x$1" : 'x\([^=]*\)='`
33 ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
34 ac_shift=:
36 -*)
37 ac_option=$1
38 ac_optarg=$2
39 ac_shift=shift
41 *) # This is not an option, so the user has probably given explicit
42 # arguments.
43 ac_option=$1
44 ac_need_defaults=false;;
45 esac
47 case $ac_option in
48 --with-fabric-tests)
49 echo "Building CouchDb with Fabric Tests"
50 BUILD_FABRIC_TESTS=true
53 --install)
54 INSTALL_COUCHDB=true
55 COUCHDB_INSTALL_DIR=$ac_optarg
58 --help)
59 echo "The only available options at the moment are --install which installs CouchDb and --with-fabric-tests that additionally builds the FabricTests"
60 exit 0;
63 -*)
64 echo "Unkown option. Try --help"
65 exit 1;
66 esac
67 shift
68 done
70 if [ -z "$ERLC" ]; then
71 ERLC=`which erlc`
72 export ERLC
75 if [ ! -x "$ERLC" ]; then
76 echo "Cannot find erlc. Please set ERLC manually. (e.g. export ERLC=/usr/local/erlang/bin/erlc)"
77 exit 1
80 if [ ! -x "$JAVA" ]; then
81 echo "Cannot find java. Please put the directory where java resides into your PATH. (e.g. export PATH=$PATH:/usr/local/java/bin/)"
82 exit 1
85 if [ ! -e "$ERLANG_INCLUDE_DIR/erl_driver.h" ]; then
86 echo "Cannot find erl_driver.h. Please set ERLANG_INCLUDE_DIR manually. (e.g. export ERLANG_INCLUDE_DIR=/usr/local/erlang/lib/usr/include)"
87 exit 1
90 if [ ! -d "$COUCH_DIR" ]; then
91 mkdir -p $COUCH_DIR
95 if [ "$BUILD_FABRIC_TESTS" = "true" ]; then
96 $MAKE $BUILD_DIR/FabricTests
97 exit 0
100 if [ "$INSTALL_COUCHDB" = "true" ]; then
101 echo "Installing CouchDb into $COUCHDB_INSTALL_DIR"
103 if [ -d "$COUCHDB_INSTALL_DIR/couchdb" ]; then
104 rm -rf "$COUCHDB_INSTALL_DIR/old.couchdb"
105 mv "$COUCHDB_INSTALL_DIR/couchdb" "$COUCHDB_INSTALL_DIR/old.couchdb"
108 mkdir -p $COUCHDB_INSTALL_DIR/couchdb
111 COUCHDB_INSTALL_DIR=$COUCHDB_INSTALL_DIR/couchdb
112 export COUCHDB_INSTALL_DIR
114 $MAKE install
115 exit 0
118 $MAKE couchdb