-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauto_build.sh
executable file
·387 lines (316 loc) · 8.58 KB
/
auto_build.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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
#!/bin/bash
# Get full path to this script
cd `dirname $0`
script_dir=`pwd`
# Get build options
source $script_dir/build_options.sh
if [ -z "$base" ]; then
echo "build_options.sh did not specify base directory"
exit 1
fi
install_base=$base/install
xinstall_base=$base/install/cross
git_install_dir=$install_base/git-1.7.3
cmake_install_dir=$install_base/cmake-2.8.3
osmesa_install_dir=$install_base/osmesa-7.6.1
osmesa_xinstall_dir=$xinstall_base/osmesa-7.6.1
python_install_dir=$install_base/python-2.5.2
python_xinstall_dir=$xinstall_base/python-2.5.2
paraview_install_dir=$install_base/paraview
paraview_xinstall_dir=$xinstall_base/paraview
qt_install_dir=$install_base/qt-4.6.3
git_command=$git_install_dir/bin/git
cmake_command=$cmake_install_dir/bin/cmake
toolchain_file=$base/toolchains/$toolchain_file
setup_native_compilers()
{
module unload PrgEnv-pgi PrgEnv-gnu Base-opts
}
setup_cross_compilers()
{
module load Base-opts PrgEnv-gnu
}
grab()
{
url=$1
file=$2
cp $script_dir/$file ./
}
do_git()
{
rm -rf $base/source/git
mkdir -p $base/source/git
cd $base/source/git
package=git-1.7.3
grab http://kernel.org/pub/software/scm/git $package.tar.gz
tar -zxf $package.tar.gz
cd $package
./configure --prefix=$git_install_dir
$make_command && make install
}
do_qt_git()
{
rm -rf $base/source/qt
mkdir -p $base/source/qt
cd $base/source/qt
$git_command clone git://gitorious.org/qt/qt.git
cd qt
$git_command checkout v4.6.3
sed -i s:OPT_CONFIRM_LICENSE=no:OPT_CONFIRM_LICENSE=yes:g configure
./configure -opensource -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg --prefix=$qt_install_dir
$make_command && $make_command install
}
do_cmake()
{
rm -rf $base/source/cmake
mkdir -p $base/source/cmake
cd $base/source/cmake
package=cmake-2.8.3
grab http://www.cmake.org/files/v2.8 $package.tar.gz
tar -zxf $package.tar.gz
mkdir build
cd build
../$package/bootstrap --prefix=$cmake_install_dir
$make_command && make install
# install extra platform files
cp $script_dir/cmake-platform-files/* $cmake_install_dir/share/cmake-2.8/Modules/Platform/
}
do_cmake_git()
{
rm -rf $base/source/cmake
mkdir -p $base/source/cmake
cd $base/source/cmake
$git_command clone -b next git://cmake.org/cmake.git CMakeNext
mkdir build
cd build
../CMakeNext/bootstrap --prefix=$cmake_install_dir
$make_command && make install
# install extra platform files
cp $script_dir/cmake-platform-files/* $cmake_install_dir/share/cmake-2.8/Modules/Platform/
}
do_toolchains()
{
rm -rf $base/toolchains
mkdir -p $base/toolchains
cd $base/toolchains
fname=`basename $toolchain_file`
cp $script_dir/toolchains/$fname ./
sed -i -e "s|XINSTALL_DIR|$xinstall_base|g" $toolchain_file
}
do_python_download()
{
mkdir -p $base/source/python
cd $base/source/python
package=Python-2.5.2
grab http://www.python.org/ftp/python/2.5.2 $package.tgz
rm -rf $package
tar -zxf $package.tgz
}
do_python_build_native()
{
cd $base/source/python
source=Python-2.5.2
rm -rf build-native
mkdir build-native
cd build-native
../$source/configure --prefix=$python_install_dir --enable-shared
$make_command && make install
}
do_python_build_cross()
{
cd $base/source/python
source=Python-2.5.2
rm -rf $source-cmakeified
cp -r $source $source-cmakeified
source=$source-cmakeified
cp $script_dir/add_cmake_files_to_python2-5-2.patch ./
patch -p1 -d $source < add_cmake_files_to_python2-5-2.patch
rm -rf build-cross
mkdir build-cross
cd build-cross
# todo - remove PYTHON_BUILD_LIB_SHARED=0
# it is here for bg/p which finds libdl and sets
# build shared default to true, should key off TARGET_SUPPORTS_SHARED_LIBS
$cmake_command \
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DPYTHON_BUILD_LIB_SHARED:BOOL=0 \
-DWITH_THREAD:BOOL=0 \
-DHAVE_GETGROUPS:BOOL=0 \
-DHAVE_SETGROUPS:BOOL=0 \
-DENABLE_IPV6:BOOL=0 \
-DCMAKE_INSTALL_PREFIX=$python_xinstall_dir \
-C ../$source/CMake/TryRunResults-Python-bgl-gcc.cmake \
../$source
$make_command && make install
}
do_osmesa_download()
{
mkdir -p $base/source/mesa
cd $base/source/mesa
package=MesaLib-7.6.1
grab ftp://ftp.freedesktop.org/pub/mesa/7.6.1 $package.tar.gz
rm -rf Mesa-7.6.1
tar -zxf $package.tar.gz
}
do_osmesa_build_native()
{
cd $base/source/mesa
rm -rf build-native
cp -r Mesa-7.6.1 build-native
cd build-native
cp configs/linux-osmesa configs/linux-osmesa.original
cp $script_dir/linux-osmesa configs/linux-osmesa
sed -i.original -e 's|INSTALL_DIR = /usr/local|INSTALL_DIR = '$osmesa_install_dir'|g' configs/default
$make_command linux-osmesa && make install
}
do_osmesa_build_cross()
{
cd $base/source/mesa
rm -rf build-cross
cp -r Mesa-7.6.1 build-cross
cd build-cross
cp $script_dir/$osmesa_config_name configs/
sed -i.original -e 's|linux-osmesa-static|'$osmesa_config_name'|g' Makefile
sed -i.original -e 's|INSTALL_DIR = /usr/local|INSTALL_DIR = '$osmesa_xinstall_dir'|g' configs/default
$make_command $osmesa_config_name && make install
}
do_paraview_download()
{
mkdir -p $base/source/paraview
cd $base/source/paraview
rm -rf ParaView
package=ParaView-3.8.0
grab http://paraview.org/files/v3.8/ParaView-3.8.0.tar.gz $package.tar.gz
tar -zxf $package.tar.gz
mv $package ParaView
}
do_paraview_download_git()
{
mkdir -p $base/source/paraview
cd $base/source/paraview
rm -rf ParaView
paraview_git_url=git://paraview.org/ParaView.git
$git_command clone --recursive $paraview_git_url
cd ParaView
# avoid hooks
mkdir -p .git/hooks/.git
touch .git/hooks/.git/config
mkdir -p VTK/.git/hooks/.git
touch VTK/.git/hooks/.git/config
# get livedata branch
livedata_paraview_url=git://github.com/patmarion/ParaView.git
livedata_vtk_url=git://github.com/patmarion/VTK.git
$git_command remote add livedata $livedata_paraview_url
$git_command fetch livedata
cd VTK
$git_command remote add livedata $livedata_vtk_url
$git_command fetch livedata
cd ..
$git_command checkout -t livedata/live-data --force
$git_command submodule update
# this submodule appeared in the latest git master
rm -rf Utilities/VisItBridge
if [ $platform = bgp ]; then
# Apply patch to workaround ostream problem
patch_file=paraview-fix-cswrapper.patch
cp $script_dir/$patch_file ./
$git_command apply $patch_file
# Don't disable HAVE_PTHREAD on bgp
patch_file=paraview-bgp-have-pthread.patch
cp $script_dir/$patch_file ./
$git_command apply $patch_file
fi
}
do_paraview_configure_native()
{
rm -rf $base/source/paraview/build-native
mkdir -p $base/source/paraview/build-native
cd $base/source/paraview/build-native
bash $script_dir/configure_paraview_native.sh ../ParaView $paraview_install_dir $osmesa_install_dir $python_install_dir $cmake_command
}
do_paraview_configure_native_gui()
{
rm -rf $base/source/paraview/build-native
mkdir -p $base/source/paraview/build-native
cd $base/source/paraview/build-native
bash $script_dir/configure_paraview_native_gui.sh ../ParaView $paraview_install_dir $osmesa_install_dir $python_install_dir $cmake_command $qt_install_dir
}
do_paraview_configure_hosttools()
{
rm -rf $base/source/paraview/build-hosttools
mkdir -p $base/source/paraview/build-hosttools
cd $base/source/paraview/build-hosttools
bash $script_dir/configure_paraview_hosttools.sh ../ParaView $paraview_install_dir $osmesa_install_dir $python_install_dir $cmake_command
}
do_paraview_configure_cross()
{
rm -rf $base/source/paraview/build-cross
mkdir -p $base/source/paraview/build-cross
cd $base/source/paraview/build-cross
bash $script_dir/configure_paraview_cross.sh ../ParaView $paraview_xinstall_dir $osmesa_xinstall_dir $python_xinstall_dir $cmake_command $toolchain_file $base/source/paraview/build-hosttools "$paraview_cross_cxx_flags"
}
do_paraview_build_native()
{
cd $base/source/paraview/build-native
$make_command
}
do_paraview_build_hosttools()
{
cd $base/source/paraview/build-hosttools
$make_command pvHostTools
}
do_paraview_build_cross()
{
cd $base/source/paraview/build-cross
$make_command
}
do_paraview_native_prereqs()
{
do_git
do_cmake
#do_cmake_git
do_python_download
do_python_build_native
do_osmesa_download
do_osmesa_build_native
#do_paraview_download
do_paraview_download_git
}
do_native()
{
do_paraview_native_prereqs
do_paraview_configure_native
do_paraview_build_native
}
do_native_gui()
{
do_paraview_native_prereqs
do_qt_git
do_paraview_configure_native_gui
do_paraview_build_native
}
do_cross()
{
#setup_native_compilers
do_paraview_native_prereqs
do_paraview_configure_hosttools
do_paraview_build_hosttools
#setup_cross_compilers
do_toolchains
do_python_build_cross
do_osmesa_build_cross
do_paraview_configure_cross
do_paraview_build_cross
}
# this line is needed so that the "module" command will work
#source /opt/modules/default/init/bash
if [ -z $1 ]
then
set -x
echo "Please specify a build step."
exit 1
else
set -x
$1
fi