build_cots.sh
7.05 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/bin/bash
COTS_DIR="`pwd`"
buildCOTS() {
COTS_WHAT=$1
COTS_CONFIGURE_OPTIONS=$2
COTS_MAKE_OPTIONS=$3
cd $COTS_DIR
# extraction
if [ ! -d ${COTS_WHAT} ]; then
tar xfz "${COTS_WHAT}.tar.gz"
if [ ${?} -ne 0 ]; then
echo "Cannot extract COTS ${COTS_WHAT}"
return 1
fi
fi
cd ${COTS_WHAT}
# remove cache
if [ -f config.cache ]; then
rm config.cache
fi
# configuration
./configure ${COTS_CONFIGURE_OPTIONS} 2>&1
if [ ${?} -ne 0 ]; then
echo "Error during the configuration of ${COTS_WHAT}."
return 1
fi
# clean old compilation
make clean 2>&1 >/dev/null
# compilation
make ${COTS_MAKE_OPTIONS} 2>&1
if [ ${?} -ne 0 ]; then
echo "Error during the compilation of ${COTS_WHAT}."
return 1
fi
# installation
make install 2>&1
if [ ${?} -ne 0 ]; then
echo "Error during the installation of ${COTS_WHAT}."
return 1
fi
return 0
}
if [ -z "${TREPS_COTS_INSTALL_DIR}" ]; then
echo "Environment variable TREPS_COTS_INSTALL_DIR not defined"
exit 1
fi
#Build COTS in relation to the validation process?
if [ -z "${1}" ]; then
TREPS_VALIDATION=0
else
TREPS_VALIDATION=${1}
fi;
#generic options for COTS compilation
MAKE_OPTIONS=""
#Installation of 'Apache Portable Runtime' library - Dependency of log4cxx
APR_NAME="apr-1.5.0"
APR_DIR=${TREPS_COTS_INSTALL_DIR}/apr
APR_CONF_OPT="--prefix=${APR_DIR}"
buildCOTS ${APR_NAME} "${APR_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'Apache Portable Runtime Utility' library - Dependency of log4cxx
APR_UTIL_NAME="apr-util-1.5.3"
APR_UTIL_DIR=${TREPS_COTS_INSTALL_DIR}/apr-util
APR_UTIL_CONF_OPT="--prefix=${APR_UTIL_DIR} --with-apr=${APR_DIR}"
buildCOTS ${APR_UTIL_NAME} "${APR_UTIL_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'log4cxx' library - C++ logger used by TREPS
LOG4CXX_NAME="apache-log4cxx-0.10.0"
LOG4CXX_DIR=${TREPS_COTS_INSTALL_DIR}/log4cxx
LOG4CXX_CONF_OPT="--prefix=${LOG4CXX_DIR} --with-apr=${APR_DIR} --with-apr-util=${APR_UTIL_DIR}"
buildCOTS ${LOG4CXX_NAME} "${LOG4CXX_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'CPPUnit' library - C++ unit testing framework used by TREPS
CPPUNIT_NAME="cppunit-1.12.1"
CPPUNIT_DIR=${TREPS_COTS_INSTALL_DIR}/cppunit
CPPUNIT_CONF_OPT="--prefix=${CPPUNIT_DIR}"
buildCOTS ${CPPUNIT_NAME} "${CPPUNIT_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'file' library - Only used to get MIME type of a file by TREPS
FILE_NAME="file-5.15"
FILE_DIR=${TREPS_COTS_INSTALL_DIR}/file
FILE_CONF_OPT="--prefix=${FILE_DIR}"
buildCOTS ${FILE_NAME} "${FILE_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'gsoap' library - Used by TREPS to build a client to the 3DView Web Service
GSOAP_NAME="gsoap-2.8.17"
GSOAP_DIR=${TREPS_COTS_INSTALL_DIR}/gsoap
GSOAP_CONF_OPT="--prefix=${GSOAP_DIR} --disable-ssl"
buildCOTS ${GSOAP_NAME} "${GSOAP_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'netcdf library' - To allow TREPS to read and write netCDF files
NETCDF_NAME="netcdf-4.3.0"
NETCDF_DIR=${TREPS_COTS_INSTALL_DIR}/netcdf
NETCDF_CONF_OPT="--prefix=${NETCDF_DIR} --disable-netcdf-4 --disable-dap"
buildCOTS ${NETCDF_NAME} "${NETCDF_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of 'cdf library' - To allow TREPS to read and write CDF files
CDF_NAME="cdf35_0-dist"
CDF_DIR=${TREPS_COTS_INSTALL_DIR}/cdf
cd $COTS_DIR
if [ ! -d ${CDF_NAME} ]; then
tar xfz "${CDF_NAME}-cdf.tar.gz"
if [ ${?} -ne 0 ]; then
echo "Cannot extract cdf archive"
exit 1
fi
fi
cd ${CDF_NAME}
make "OS=linux" "ENV=gnu" "CURSES=no" all
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
make "INSTALLDIR=${CDF_DIR}" install
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
if [ ${TREPS_VALIDATION} -eq 0 ]; then
echo 'Do not install COTS in relation to validation process'
exit 0
fi
#=================================================================
# COTS below this line is used for the validation process
#=================================================================
#Installation of 'Fitnesse', used for acceptance tests
FITNESSE_DIR=${TREPS_COTS_INSTALL_DIR}/fitnesse
FITNESSE_PORT=8081
if [ ! -d ${FITNESSE_DIR} ]; then
mkdir -p ${FITNESSE_DIR}
fi
cp ${COTS_DIR}/fitnesse.jar ${FITNESSE_DIR}
#Installation of 'CPPUTest' library - Dependency for CSlim
CPPUTEST_NAME="cpputest-3.5"
CPPUTEST_DIR=${FITNESSE_DIR}/cpputest
CPPUTEST_CONF_OPT="--prefix=${CPPUTEST_DIR}"
buildCOTS ${CPPUTEST_NAME} "${CPPUTEST_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
export CPPUTEST_HOME=${COTS_DIR}/${CPPUTEST_NAME}
#Installation of 'CSlim' library - Use by TREPS CSlimServer for validation test
CSLIM_NAME="cslim"
CSLIM_DIR=${FITNESSE_DIR}/cslim
cd $COTS_DIR
if [ ! -d ${CSLIM_NAME} ]; then
tar xfz "${CSLIM_NAME}.tar.gz"
if [ ${?} -ne 0 ]; then
echo "Cannot extract CSLIM"
exit 1
fi
fi
cd ${CSLIM_NAME}
export CPPUTEST_HOME=${COTS_DIR}/${CPPUTEST_NAME}
make
if [ ! -d ${CSLIM_DIR}/include ]; then
mkdir -p ${CSLIM_DIR}/include
fi
if [ ! -d ${CSLIM_DIR}/lib ]; then
mkdir -p ${CSLIM_DIR}/lib
fi
cp -r include/Com/ ${CSLIM_DIR}/include/
cp -r include/CSlim/ ${CSLIM_DIR}/include/
cp -r lib/* ${CSLIM_DIR}/lib/
#Installation of Valgrind tool - Use to detect buffer overflow & memory leaks
VALGRIND_NAME="valgrind-3.9.0"
VALGRIND_DIR=${TREPS_COTS_INSTALL_DIR}/valgrind
VALGRIND_CONF_OPT="--prefix=${VALGRIND_DIR}"
buildCOTS ${VALGRIND_NAME} "${VALGRIND_CONF_OPT}" "${MAKE_OPTIONS}"
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of cppcheck - Use for code analysis
#Note - We just build cppcheck, without any dependencies
CPPCHECK_NAME="cppcheck-1.63"
CPPCHECK_DIR=${TREPS_COTS_INSTALL_DIR}/cppcheck
cd ${COTS_DIR}
tar xzf ${CPPCHECK_NAME}.tar.gz
cd ${COTS_DIR}/${CPPCHECK_NAME}
g++ -o cppcheck -Ilib -Iexternals/tinyxml cli/*.cpp lib/*.cpp externals/tinyxml/tinyxml2.cpp
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
if [ ! -d ${CPPCHECK_DIR} ]; then
mkdir -p ${CPPCHECK_DIR}
fi
cp cppcheck ${CPPCHECK_DIR}
cp -Rf cfg/ ${CPPCHECK_DIR}
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of sonar -
SONAR_NAME="sonarqube-4.0"
SONAR_DIR=${TREPS_COTS_INSTALL_DIR}/sonar
cd ${COTS_DIR}
tar xzf ${SONAR_NAME}.tar.gz
cp -r ${SONAR_NAME}/ ${SONAR_DIR}/
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
#Installation of c++ pluggin for sonar
SONAR_PLUGIN_DIR=${SONAR_DIR}/extensions/plugins
SONAR_CPP_PLUGIN="sonar-cxx-plugin-0.9.jar"
cd ${COTS_DIR}
cp ${SONAR_CPP_PLUGIN} ${SONAR_PLUGIN_DIR}
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
chmod -Rf 775 ${SONAR_DIR}
#Installion of sonar-runner
SONARRUNNER_NAME="sonar-runner-2.3"
SONARRUNNER_DIR=${TREPS_COTS_INSTALL_DIR}/sonar-runner
cd ${COTS_DIR}
tar xzf ${SONARRUNNER_NAME}.tar.gz
cp -r ${SONARRUNNER_NAME}/ ${SONARRUNNER_DIR}/
[ ${?} -ne 0 ] && echo "Error detected." && exit 1
chmod -Rf 775 ${SONARRUNNER_DIR}
exit 0