33e631928e55174bddcc0355912331310e7de0b1
[swift-upb.git] / mfold / build.default.sh
1 #!/bin/bash
2
3 if ! which git || ! which g++ || ! which scons || ! which make ; then
4     sudo apt-get -y install make g++ scons git-core || exit -4
5 fi
6
7 if [ ! -e ~/include/gtest/gtest.h ]; then
8     echo installing gtest
9     mkdir tmp
10     cd tmp || exit -3
11     wget -c http://googletest.googlecode.com/files/gtest-1.4.0.tar.bz2 || exit -2
12     rm -rf gtest-1.4.0
13     tar -xjf gtest-1.4.0.tar.bz2 || exit -1
14     cd gtest-1.4.0 || exit 1
15     ./configure --prefix=$HOME || exit 2
16     make || exit 3
17     make install || exit 4
18     echo done gtest
19 fi
20
21 #if ! which pcregrep ; then
22 #    echo installing pcregrep
23 #    mkdir tmp
24 #    cd tmp
25 #    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.01.tar.gz || exit 5
26 #    tar -xzf pcre-8.01.tar.gz 
27 #    cd pcre-8.01
28 #    ./configure --prefix=$HOME || exit 6
29 #    make -j4 || exit 7
30 #    make install || exit 8
31 #    echo done pcregrep
32 #fi
33
34 if [ ! -e swift ]; then
35     echo clone the repo
36     git clone $ORIGIN || exit 6
37 fi
38 cd swift
39 echo pulling updates
40 git pull origin $BRANCH:$BRANCH || exit 5
41 echo switching the branch
42 git checkout $BRANCH || exit 5
43
44 echo building
45 CPPPATH=~/include LIBPATH=~/lib scons -j4 || exit 7
46 echo testing
47 tests/connecttest || exit 8
48 echo done