support jenkins

- remove dependencies on $COUCH_TOP
- accept parameters via non-interactive mode
diff --git a/bin/couchdb_build.sh b/bin/couchdb_build.sh
index a20ad48..0919000 100755
--- a/bin/couchdb_build.sh
+++ b/bin/couchdb_build.sh
@@ -28,7 +28,7 @@
 echo DONE.
 echo to move build files to release area run the following:
 echo PATCH=_otp_$OTP_REL.exe
-echo DEST=/relax/release/CouchDB/Snapshots/`date +%Y%m%d`
+echo DEST=/cygdrive/c/jenkins/release/CouchDB/Snapshots/`date +%Y%m%d`
 echo pushd $COUCH_TOP/etc/windows/
 echo rename .exe \$PATCH setup-couchdb-*
 echo WINCOUCH=\`ls -1 setup-*.exe\`
diff --git a/bin/couchdb_config.sh b/bin/couchdb_config.sh
index d3da8ae..fe1412a 100755
--- a/bin/couchdb_config.sh
+++ b/bin/couchdb_config.sh
@@ -1,19 +1,19 @@
 #!/bin/sh
 COUCH_TOP=`pwd`
 export COUCH_TOP
+export RELAX=`cygpath $RELAX`
 
 echo ============= COUCHDB_CONFIG CONFIGURE ===================
 ./configure \
 --prefix=$ERL_TOP/release/win32 \
 --with-erlang=$ERL_TOP/release/win32/usr/include \
---with-win32-icu-binaries=$COUCH_TOP/../icu \
---with-openssl-bin-dir=$COUCH_TOP/../openssl/bin \
+--with-win32-icu-binaries=$RELAX/icu \
+--with-openssl-bin-dir=$RELAX/openssl/bin \
 --with-msvc-redist-dir=$ERL_TOP/.. \
---with-js-lib=$COUCH_TOP/../js-1.8.5/js/src/dist/lib \
---with-js-include=$COUCH_TOP/../js-1.8.5/js/src/dist/include \
+--with-js-lib=$RELAX/js-1.8.5/js/src/dist/lib \
+--with-js-include=$RELAX/js-1.8.5/js/src/dist/include \
 --disable-init \
 --disable-launchd \
---disable-docs \
 #--with-win32-curl=$COUCH_TOP/../curl \
 2>&1 | tee $COUCH_TOP/build_configure.txt
 
diff --git a/bin/shell.cmd b/bin/shell.cmd
index 646a790..a2c1cff 100755
--- a/bin/shell.cmd
+++ b/bin/shell.cmd
@@ -17,6 +17,11 @@
 if not defined ZLIB_PATH set ZLIB_PATH=%RELAX%\zlib

 

 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: haul in MSVC compiler configuration

+:: TODO remove dependency on x86 flag

+call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release

+

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 :: LIB and INCLUDE are preset by Windows SDK and/or Visual C++ shells

 :: however VC++ uses LIB & INCLUDE and SDK uses Lib & Include. In Cygwin

 :: these are *NOT* the same but when we shell out to CL.exe and LINK.exe

@@ -38,8 +43,14 @@
 set LIB=%LIB%;%SSL_PATH%\lib;%CURL_PATH%\lib;%ICU_PATH%\lib;

 

 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-::check which version of erlang setup we want

+:: check which version of erlang setup we want

+:: pick up from jenkins if required

+if not defined BUILD_WITH_JENKINS goto select

+if not defined OTP_REL goto select

+goto %OTP_REL%

+:: no default, so let's ask the user instead!

 :: choice.exe exists on all windows platforms since MSDOS but not on XP

+:select

 echo select:

 echo       3 for R15b03-1

 echo       4 for R14b04

diff --git a/bin/shell.sh b/bin/shell.sh
index fcb6a5f..200be8d 100755
--- a/bin/shell.sh
+++ b/bin/shell.sh
@@ -87,4 +87,14 @@
 echo Ready to build Erlang and CouchDB using Erlang $ERTS_VSN OTP $OTP_VER in $ERL_TOP
 echo Time to Relax.
 
-bash -i
+if [ -z "$BUILD_WITH_JENKINS" ] ; then
+  bash -i
+else
+	cd $WORKSPACE
+	git clean -fdx
+	git reset --hard
+	./bootstrap
+	/relax/bin/couchdb_config.sh
+	/relax/bin/couchdb_build.sh
+fi
+