-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.sh
executable file
·118 lines (94 loc) · 2.08 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
echo "Executing $(pwd)/update.sh"
PROJECT_DIR=$(pwd)
# sanity check: executed in the root folder?
if [ ! -f include/jsobjects.hpp ]; then
echo "jsobjects/update.sh must be executed in the root dir of the repository."
exit -1
fi
##########################
# command line options
#
EXTERNALS=/tmp/jsobjects
ENABLE_TESTING=no
ENABLE_CPP=no
VERBOSE=0
readopts() {
while ((OPTIND<=$#)); do
if getopts ":d:t:c:hv" opt; then
case $opt in
d) EXTERNALS=$OPTARG;;
t) ENABLE_TESTING=$OPTARG;;
c) ENABLE_CPP=$OPTARG;;
v) VERBOSE=1;;
h) echo "Usage: update.sh [-d <directory>] [-c yes|no] [-t yes|no] [-v]" $$ exit;;
*) ;;
esac
else
let OPTIND++
fi
done
}
OPTIND=1
readopts "$@"
if [ $VERBOSE == 1 ]; then
echo "Storing into directory: $EXTERNALS"
echo "Enable testing? $ENABLE_TESTING"
echo "Enable cpp adapter? $ENABLE_CPP"
fi
#############################
# create output folder
#
if [ -z "$1" ]; then
EXTERNALS=/tmp/jsobjects_externals
fi
if [ ! -d $EXTERNALS ]; then
mkdir $EXTERNALS
fi
cd $EXTERNALS
######################
# boost
#
boost_modules="config detail exception smart_ptr algorithm iterator mpl range type_traits preprocessor utility concept function bind format optional"
if [ ! -d boost ]; then
svn co --depth files http://svn.boost.org/svn/boost/tags/release/Boost_1_50_0/boost
cd boost
svn update $boost_modules
cd ..
fi
######################
# gtest 1.6
if [ $ENABLE_TESTING == yes ]; then
if [ ! -d gtest ]; then
svn co "http://googletest.googlecode.com/svn/tags/release-1.6.0" gtest
fi
if [ ! -f gtest/Makefile ]; then
cd gtest
cmake .
cd ..
fi
if [ ! -f gtest/libgtest.a ]; then
cd gtest
make
cd ..
fi
fi
######################
# rapidjson
if [ $ENABLE_CPP == yes ]; then
if [ ! -d rapidjson ]; then
svn co "http://rapidjson.googlecode.com/svn/trunk" rapidjson
fi
fi
######################
# build jsobjects
cd $PROJECT_DIR
git pull
if [ ! -d build ]; then
mkdir build
fi
cd build
if [ ! -f CMakeCache.txt ]; then
cmake -DEXTERNALS_DIR=$EXTERNALS ..
fi
make