1 | #!/bin/bash
|
---|
2 |
|
---|
3 | VISIT_VERSION="2.9.2"
|
---|
4 |
|
---|
5 | ################################################################################
|
---|
6 | ## DEFAULT VALUES FOR VARIABLES
|
---|
7 | ################################################################################
|
---|
8 |
|
---|
9 | # Global variables
|
---|
10 | ARCH=linux-ppc64_gcc-4.4
|
---|
11 | PREFIXARCH=linux-ppc64-BGQ
|
---|
12 | PREFIX="$PWD/$PREFIXARCH"
|
---|
13 |
|
---|
14 | BG_CC=bgxlc_r
|
---|
15 | BG_C_OPT_FLAGS="-qarch=qp -qtune=qp"
|
---|
16 | BG_CXX=bgxlC_r
|
---|
17 | BG_CXX_OPT_FLAGS="-qarch=qp -qtune=qp"
|
---|
18 |
|
---|
19 | # Compiler used for Mesa.
|
---|
20 | BG_GNU_CC=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gcc
|
---|
21 | BG_GNU_CXX=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-g++
|
---|
22 |
|
---|
23 | BG_MPI_GNU_CC=mpicc # not used
|
---|
24 | BG_MPI_GNU_CXX=mpicxx
|
---|
25 |
|
---|
26 | BG_MPI_CC=mpixlc_r
|
---|
27 | BG_MPI_C_OPT_FLAGS="-qarch=qp -qtune=qp"
|
---|
28 | BG_MPI_CXX=mpixlcxx_r
|
---|
29 | BG_MPI_CXX_OPT_FLAGS="-qarch=qp -qtune=qp"
|
---|
30 |
|
---|
31 | BUILD_MODE="Release"
|
---|
32 | CC=gcc
|
---|
33 | C_OPT_FLAGS=""
|
---|
34 | CXX=g++
|
---|
35 | CXX_OPT_FLAGS=""
|
---|
36 | EXTRA_ARGS=""
|
---|
37 | GROUP="bdiv"
|
---|
38 | INSTALLATION_BUILD_DIR="builds_static"
|
---|
39 | IO_PACKAGES="--szip --hdf5 --silo"
|
---|
40 | VISIT_SELECTED_DATABASE_PLUGINS="BOV;Cale;CaleHDF5;Curve2D;EnSight;Miranda;PDB;PlainText;SAMRAI;Silo;VTK"
|
---|
41 | MAKE=make
|
---|
42 | MAKE_OPT_FLAGS=""
|
---|
43 | NO_VISIT=""
|
---|
44 | DO_SVN=""
|
---|
45 | DO_SVN_ANON=""
|
---|
46 | SVN=""
|
---|
47 | TAR=tar
|
---|
48 | THIRD_PARTY_PATH="`pwd`/thirdparty_static"
|
---|
49 | TARBALL="--tarball visit${VISIT_VERSION}.tar.gz"
|
---|
50 |
|
---|
51 | export CMAKE_VERSION=3.0.2
|
---|
52 | export CMAKE_SHORT_VERSION=3.0
|
---|
53 |
|
---|
54 | export MESA_FILE=${MESA_FILE:-"MesaLib-7.8.2.tar.gz"}
|
---|
55 | export MESA_VERSION=${MESA_VERSION:-"7.8.2"}
|
---|
56 | export MESA_BUILD_DIR=${MESA_BUILD_DIR:-"Mesa-7.8.2"}
|
---|
57 | export MESA_URL="http://portal.nersc.gov/svn/visit/trunk/third_party"
|
---|
58 |
|
---|
59 | export ZLIB_FILE=${ZLIB_FILE:-"zlib-1.2.8.tar.gz"}
|
---|
60 | export ZLIB_VERSION=${ZLIB_VERSION:-"1.2.8"}
|
---|
61 | export ZLIB_BUILD_DIR=${ZLIB_BUILD_DIR:-"zlib-1.2.8"}
|
---|
62 | export ZLIB_URL="http://zlib.net/"
|
---|
63 |
|
---|
64 | export VTK_VERSION="6.1.0"
|
---|
65 |
|
---|
66 | ################################################################################
|
---|
67 | ## CODE BORROWED FROM build_visit
|
---|
68 | ################################################################################
|
---|
69 |
|
---|
70 | #First step download the support directory from svn repository..
|
---|
71 | bv_PATH=`dirname $0`
|
---|
72 |
|
---|
73 | bv_PREFIX=$bv_PATH/bv_support/
|
---|
74 |
|
---|
75 | function configure_support_files
|
---|
76 | {
|
---|
77 | if [ ! -d $bv_PREFIX ]; then
|
---|
78 | #check current directory
|
---|
79 | bv_PREFIX=$PWD/bv_support/
|
---|
80 |
|
---|
81 | if [ ! -d $bv_PREFIX ]; then
|
---|
82 |
|
---|
83 | for choice in `echo "curl wget svn"`
|
---|
84 | do
|
---|
85 | echo "Trying to fetch support files using: $choice"
|
---|
86 |
|
---|
87 | #if choice successful then exit, else try next..
|
---|
88 | webaddr="http://portal.nersc.gov/svn/visit/trunk/src/svn_bin/bv_support/"
|
---|
89 | tmp_choice=`which $choice`
|
---|
90 |
|
---|
91 | if [ $? != 0 ]; then
|
---|
92 | continue
|
---|
93 | fi
|
---|
94 | if [[ $choice == "curl" ]]; then
|
---|
95 | tmp_curl=`curl -s ${webaddr}/ | grep 'sh\|xml' | grep li|sed s/.*bv_/bv_/g | sed -e s/\.sh.*/\.sh/g | sed -e s/.*href\=\"//g;`
|
---|
96 |
|
---|
97 | if [ $? != 0 ]; then
|
---|
98 | continue
|
---|
99 | fi
|
---|
100 |
|
---|
101 | mkdir -p bv_support_tmp
|
---|
102 | is_successful=1
|
---|
103 | #fetch each file..
|
---|
104 | for curl_files in `echo $tmp_curl`
|
---|
105 | do
|
---|
106 | curl -s ${webaddr}/${curl_files} -o bv_support_tmp/$curl_files
|
---|
107 | if [ $? != 0 ]; then
|
---|
108 | is_successful=0
|
---|
109 | break
|
---|
110 | fi
|
---|
111 | done
|
---|
112 |
|
---|
113 | #if not successful cleanup and try next option..
|
---|
114 | if [ $is_successful == 0 ]; then
|
---|
115 | rm -fR bv_support_tmp
|
---|
116 | else
|
---|
117 | mv bv_support_tmp bv_support
|
---|
118 | fi
|
---|
119 | elif [[ $choice == "wget" ]]; then
|
---|
120 | wget -r -nH --cut-dirs=5 --no-parent --reject="index.html" -q ${webaddr}
|
---|
121 | else
|
---|
122 | svn co ${webaddr} bv_support
|
---|
123 | fi
|
---|
124 |
|
---|
125 | if [ ! -d $bv_PREFIX ]; then
|
---|
126 | echo "$choice failed to retrieve support files"
|
---|
127 | else
|
---|
128 | echo "Success. downloaded support, continuing"
|
---|
129 | break
|
---|
130 | fi
|
---|
131 | done
|
---|
132 | fi
|
---|
133 |
|
---|
134 | if [ ! -d $bv_PREFIX ]; then
|
---|
135 | echo "Failed to detect or fetch support files, please contact visit-users mailing list with error. Quitting..."
|
---|
136 | exit 2
|
---|
137 | fi
|
---|
138 | fi
|
---|
139 | }
|
---|
140 |
|
---|
141 | #configure the support files if needed..
|
---|
142 | configure_support_files
|
---|
143 |
|
---|
144 | #import initialize and run functions..
|
---|
145 | . $bv_PREFIX/bv_main.sh
|
---|
146 |
|
---|
147 | #import helper functions..
|
---|
148 | . $bv_PREFIX/helper_funcs.sh
|
---|
149 |
|
---|
150 | function banner
|
---|
151 | {
|
---|
152 | echo "===================================================================================="
|
---|
153 | echo "$1"
|
---|
154 | echo "===================================================================================="
|
---|
155 |
|
---|
156 | return 0
|
---|
157 | }
|
---|
158 |
|
---|
159 | ################################################################################
|
---|
160 | ## build_mesa_BGQ
|
---|
161 | ################################################################################
|
---|
162 |
|
---|
163 | function build_mesa_BGQ
|
---|
164 | {
|
---|
165 | PF=$THIRD_PARTY_PATH/mesa/$MESA_VERSION/${ARCH}_BGQ
|
---|
166 |
|
---|
167 | #
|
---|
168 | # Test whether Mesa has already been installed.
|
---|
169 | #
|
---|
170 | if test -d $PF ; then
|
---|
171 | return 0
|
---|
172 | fi
|
---|
173 |
|
---|
174 | #
|
---|
175 | # Download file if needed
|
---|
176 | #
|
---|
177 | if ! test -e $MESA_FILE ; then
|
---|
178 | download_file $MESA_FILE $MESA_URL
|
---|
179 | if [[ $? == 1 ]] ; then
|
---|
180 | warn "Unable to download Mesa sources $MESA_FILE. Giving Up!"
|
---|
181 | return 1
|
---|
182 | fi
|
---|
183 | fi
|
---|
184 |
|
---|
185 | #
|
---|
186 | # prepare build dir
|
---|
187 | #
|
---|
188 | prepare_build_dir $MESA_BUILD_DIR $MESA_FILE
|
---|
189 | untarred_mesa=$?
|
---|
190 |
|
---|
191 | if [[ $untarred_mesa == -1 ]] ; then
|
---|
192 | warn "Unable to prepare Mesa build directory. Giving Up!"
|
---|
193 | return 1
|
---|
194 | fi
|
---|
195 |
|
---|
196 | if test -e $MESA_BUILD_DIR ; then
|
---|
197 | echo "Moving $MESA_BUILD_DIR into ${INSTALLATION_BUILD_DIR}_BGQ"
|
---|
198 | if test -e ${INSTALLATION_BUILD_DIR}_BGQ/$MESA_BUILD_DIR ; then
|
---|
199 | rm -rf ${INSTALLATION_BUILD_DIR}_BGQ/$MESA_BUILD_DIR
|
---|
200 | fi
|
---|
201 | mv $MESA_BUILD_DIR ${INSTALLATION_BUILD_DIR}_BGQ/$MESA_BUILD_DIR
|
---|
202 | cd ${INSTALLATION_BUILD_DIR}_BGQ
|
---|
203 | fi
|
---|
204 |
|
---|
205 | #
|
---|
206 | # Build bluegene-visit-osmesa config.
|
---|
207 | #
|
---|
208 | banner "Building Mesa (Compute Node)"
|
---|
209 | cd $MESA_BUILD_DIR || error "Couldn't cd to mesa build dir."
|
---|
210 | if test -e configs/bluegene-visit-osmesa ; then
|
---|
211 | rm -f configs/bluegene-visit-osmesa
|
---|
212 | fi
|
---|
213 | cat << \EOF > configs/bluegene-visit-osmesa
|
---|
214 | include $(TOP)/configs/default
|
---|
215 | CONFIG_NAME = bluegene-visit-osmesa
|
---|
216 | # Compiler and flags
|
---|
217 | APP_CC = gcc
|
---|
218 | APP_CXX = g++
|
---|
219 | CFLAGS = -O3 -DNDEBUG -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
---|
220 | CXXFLAGS = -O3 -DNDEBUG -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
---|
221 | MKLIB_OPTIONS = -static
|
---|
222 | GL_LIB_NAME = libUsedToBeCalledGL.a
|
---|
223 | GLU_LIB_NAME = libGLU.a
|
---|
224 | GLUT_LIB_NAME = libglut.a
|
---|
225 | GLW_LIB_NAME = libGLw.a
|
---|
226 | OSMESA_LIB = OSMesa
|
---|
227 | OSMESA_LIB_NAME = libOSMesa.a
|
---|
228 | # Directories
|
---|
229 | SRC_DIRS = glsl mesa glu
|
---|
230 | DRIVER_DIRS = osmesa
|
---|
231 | PROGRAM_DIRS = osdemos
|
---|
232 | # Dependencies
|
---|
233 | GL_LIB_DEPS =
|
---|
234 | OSMESA_LIB_DEPS = -lm
|
---|
235 | GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
---|
236 | GLUT_LIB_DEPS =
|
---|
237 | GLW_LIB_DEPS =
|
---|
238 | APP_LIB_DEPS = -lOSMesa -lGLU -lm
|
---|
239 | EOF
|
---|
240 |
|
---|
241 | # Append the bluegene compilers and install location.
|
---|
242 | echo "CC=$BG_GNU_CC" >> configs/bluegene-visit-osmesa
|
---|
243 | echo "CXX=$BG_GNU_CXX" >> configs/bluegene-visit-osmesa
|
---|
244 | echo "INSTALL_DIR=$PF" >> configs/bluegene-visit-osmesa
|
---|
245 |
|
---|
246 | sed "s/bluegene-osmesa/bluegene-osmesa bluegene-visit-osmesa/g" Makefile > Makefile.visit
|
---|
247 | mv Makefile.visit Makefile
|
---|
248 |
|
---|
249 | cat configs/bluegene-visit-osmesa
|
---|
250 |
|
---|
251 | #
|
---|
252 | # Build Mesa.
|
---|
253 | #
|
---|
254 | info "Building OSMesa as libGL replacement ..."
|
---|
255 | ${MAKE} bluegene-visit-osmesa ${MAKE_OPT_FLAGS}
|
---|
256 | if [[ $? != 0 ]] ; then
|
---|
257 | warn "Mesa: 'make bluegene-visit-osmesa' failed. Giving up"
|
---|
258 | return 1
|
---|
259 | fi
|
---|
260 | info "Installing OSMesa as libGL replacement ..."
|
---|
261 | ${MAKE} install
|
---|
262 | if [[ $? != 0 ]] ; then
|
---|
263 | warn "Mesa: 'make install' failed. Giving up"
|
---|
264 | return 1
|
---|
265 | fi
|
---|
266 |
|
---|
267 | # Some versions of Mesa erroneously install GLEW as well. We need to make
|
---|
268 | # sure we get VisIt's GLEW when we include it, so remove the ones Mesa
|
---|
269 | # installs.
|
---|
270 | rm -f $PF/include/GL/gl*ew.h
|
---|
271 |
|
---|
272 | if [[ $? != 0 ]] ; then
|
---|
273 | warn "Mesa build failed. Giving up"
|
---|
274 | return 1
|
---|
275 | fi
|
---|
276 |
|
---|
277 | chmod -R ug+w,a+rX "$THIRD_PARTY_PATH/mesa"
|
---|
278 | chgrp -R ${GROUP} "$THIRD_PARTY_PATH/mesa"
|
---|
279 |
|
---|
280 | info "Done with Mesa"
|
---|
281 | return 0
|
---|
282 | }
|
---|
283 |
|
---|
284 | function write_platform_file
|
---|
285 | {
|
---|
286 | # Remove the platform file if it exists.
|
---|
287 | if test -e $1 ; then
|
---|
288 | rm -f $1
|
---|
289 | fi
|
---|
290 |
|
---|
291 | # Write boilerplate platform file.
|
---|
292 | cat << \EOF > $1
|
---|
293 | # From BlueGeneP-base.cmake
|
---|
294 |
|
---|
295 | #
|
---|
296 | # For BGQ builds, we're cross compiling, but we don't want to re-root things
|
---|
297 | # (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on
|
---|
298 | # the shared filesystems, and this may lie outside the root. Instead, we set the
|
---|
299 | # system directories so that the various system BGQ CNK library locations are
|
---|
300 | # searched first. This is not the clearest thing in the world, given IBM's driver
|
---|
301 | # layout, but this should cover all the standard ones.
|
---|
302 | #
|
---|
303 | set(CMAKE_SYSTEM_LIBRARY_PATH
|
---|
304 | /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers)
|
---|
305 | /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries
|
---|
306 | /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff
|
---|
307 | /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory
|
---|
308 | /bgsys/drivers/ppcfloor/gnu-linux/powerpc-BGQ-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc.
|
---|
309 | )
|
---|
310 |
|
---|
311 | #
|
---|
312 | # This adds directories that find commands should specifically ignore for cross compiles.
|
---|
313 | # Most of these directories are the includeand lib directories for the frontend on BG/P systems.
|
---|
314 | # Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly.
|
---|
315 | # We use this on BG instead of re-rooting because backend libraries are typically strewn about
|
---|
316 | # the filesystem, and we can't re-root ALL backend libraries to a single place.
|
---|
317 | #
|
---|
318 | set(CMAKE_SYSTEM_IGNORE_PATH
|
---|
319 | /lib /lib64 /include
|
---|
320 | /usr/lib /usr/lib64 /usr/include
|
---|
321 | /usr/local/lib /usr/local/lib64 /usr/local/include
|
---|
322 | /usr/X11/lib /usr/X11/lib64 /usr/X11/include
|
---|
323 | /usr/lib/X11 /usr/lib64/X11 /usr/include/X11
|
---|
324 | /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include
|
---|
325 | /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include
|
---|
326 | )
|
---|
327 |
|
---|
328 | #
|
---|
329 | # Indicate that this is a unix-like system
|
---|
330 | #
|
---|
331 | set(UNIX 1)
|
---|
332 |
|
---|
333 | #
|
---|
334 | # Library prefixes, suffixes, extra libs.
|
---|
335 | #
|
---|
336 | set(CMAKE_LINK_LIBRARY_SUFFIX "")
|
---|
337 | set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib
|
---|
338 | set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a
|
---|
339 |
|
---|
340 | set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
|
---|
341 | set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
|
---|
342 | set(CMAKE_EXECUTABLE_SUFFIX "") # .exe
|
---|
343 | set(CMAKE_DL_LIBS "dl")
|
---|
344 |
|
---|
345 | #
|
---|
346 | # This macro needs to be called for dynamic library support. Unfortunately on BGQ,
|
---|
347 | # We can't support both static and dynamic links in the same platform file. The
|
---|
348 | # dynamic link platform file needs to call this explicitly to set up dynamic linking.
|
---|
349 | #
|
---|
350 | macro(__BlueGeneP_set_dynamic_flags compiler_id lang)
|
---|
351 | if (${compiler_id} STREQUAL XL)
|
---|
352 | # Flags for XL compilers if we explicitly detected XL
|
---|
353 | set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
|
---|
354 | set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-qpie")
|
---|
355 | set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic")
|
---|
356 | set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink")
|
---|
357 | set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc")
|
---|
358 | else()
|
---|
359 | # Assume flags for GNU compilers (if the ID is GNU *or* anything else).
|
---|
360 | set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
|
---|
361 | set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
|
---|
362 | set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
|
---|
363 | set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
---|
364 | set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-dynamic")
|
---|
365 | endif()
|
---|
366 |
|
---|
367 | # Both toolchains use the GNU linker on BG/P, so these options are shared.
|
---|
368 | set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,")
|
---|
369 | set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,")
|
---|
370 | set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,")
|
---|
371 | set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic")
|
---|
372 | set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib
|
---|
373 | set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty
|
---|
374 |
|
---|
375 | set(BGQ_${lang}_DEFAULT_EXE_FLAGS
|
---|
376 | "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
---|
377 | set(CMAKE_${lang}_LINK_EXECUTABLE
|
---|
378 | "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DYNAMIC_EXE_FLAGS} ${BGQ_${lang}_DEFAULT_EXE_FLAGS}")
|
---|
379 | endmacro()
|
---|
380 |
|
---|
381 | #
|
---|
382 | # This macro needs to be called for static builds. Right now it just adds -Wl,-relax
|
---|
383 | # to the link line.
|
---|
384 | #
|
---|
385 | macro(__BlueGeneQ_set_static_flags compiler_id lang)
|
---|
386 | set(BGQ_${lang}_DEFAULT_EXE_FLAGS
|
---|
387 | "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
---|
388 | set(CMAKE_${lang}_LINK_EXECUTABLE
|
---|
389 | "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGQ_${lang}_DEFAULT_EXE_FLAGS}")
|
---|
390 | endmacro()
|
---|
391 |
|
---|
392 | # From BlueGeneP-static.cmake, which has a broken include
|
---|
393 | set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
---|
394 | set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
---|
395 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
---|
396 |
|
---|
397 | # Use the XL compilers
|
---|
398 | __BlueGeneQ_set_static_flags(XL CXX)
|
---|
399 | EOF
|
---|
400 |
|
---|
401 | return 0
|
---|
402 | }
|
---|
403 |
|
---|
404 | #
|
---|
405 | # Build cmake with the regular compiler. Make a link to the regular version
|
---|
406 | # so we can have a "BGQ" version too.
|
---|
407 | #
|
---|
408 | function build_cmake
|
---|
409 | {
|
---|
410 | if test -d $THIRD_PARTY_PATH/cmake/$CMAKE_VERSION/${ARCH}_BGQ ; then
|
---|
411 | info "CMake is already installed."
|
---|
412 | return 0
|
---|
413 | fi
|
---|
414 |
|
---|
415 | MAKEARGS=""
|
---|
416 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
417 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
418 | fi
|
---|
419 | CFLAGSARGS=""
|
---|
420 | if test -n "$C_OPT_FLAGS" ; then
|
---|
421 | CFLAGSARGS="--cflags \"$C_OPT_FLAGS\""
|
---|
422 | fi
|
---|
423 | CXXFLAGSARGS=""
|
---|
424 | if test -n "$CXX_OPT_FLAGS" ; then
|
---|
425 | CXXFLAGSARGS="--cxxflags \"$CXX_OPT_FLAGS\""
|
---|
426 | fi
|
---|
427 |
|
---|
428 | banner "Building CMake"
|
---|
429 | (export BUILD_VISIT_BGQ="yes"
|
---|
430 | eval $bv_PATH/build_visit \
|
---|
431 | --version ${VISIT_VERSION} \
|
---|
432 | --console --static --no-visit $SVN $TARBALL\
|
---|
433 | --no-thirdparty --cmake\
|
---|
434 | --log-file building_cmake.txt \
|
---|
435 | --arch "${ARCH}" \
|
---|
436 | --prefix "${PREFIX}" \
|
---|
437 | --build-mode $BUILD_MODE \
|
---|
438 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
439 | --installation-build-dir "${INSTALLATION_BUILD_DIR}" \
|
---|
440 | --cc $CC $CFLAGSARGS \
|
---|
441 | --cxx $CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
442 | --group $GROUP || error "Cannot build cmake for login node.")
|
---|
443 |
|
---|
444 | # Create a symlink to make a "BGQ" version of the login node cmake.
|
---|
445 | STARTDIR=`pwd`
|
---|
446 | cd $THIRD_PARTY_PATH/cmake/$CMAKE_VERSION
|
---|
447 | if ! test -e "${ARCH}_BGQ" ; then
|
---|
448 | ln -s $ARCH "${ARCH}_BGQ"
|
---|
449 | fi
|
---|
450 | cd $STARTDIR
|
---|
451 |
|
---|
452 | # The BlueGeneP-static-XL-CXX platform files are hosed in cmake's install.
|
---|
453 | # Overwrite.
|
---|
454 | TOOLCHAIN="$THIRD_PARTY_PATH/cmake/$CMAKE_VERSION/$ARCH/share/cmake-$CMAKE_SHORT_VERSION/Modules/Platform/BlueGeneP-static-XL-CXX.cmake"
|
---|
455 | write_platform_file "$TOOLCHAIN"
|
---|
456 |
|
---|
457 | cd $STARTDIR
|
---|
458 |
|
---|
459 | return 0
|
---|
460 | }
|
---|
461 |
|
---|
462 | function build_zlib_BGQ
|
---|
463 | {
|
---|
464 | MAKEARGS=""
|
---|
465 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
466 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
467 | fi
|
---|
468 | CFLAGSARGS=""
|
---|
469 | if test -n "$BG_C_OPT_FLAGS" ; then
|
---|
470 | CFLAGSARGS="--cflag \"${BG_C_OPT_FLAGS}\""
|
---|
471 | fi
|
---|
472 | CXXFLAGSARGS=""
|
---|
473 | if test -n "$BG_CXX_OPT_FLAGS" ; then
|
---|
474 | CXXFLAGSARGS="--cxxflag \"${BG_CXX_OPT_FLAGS}\""
|
---|
475 | fi
|
---|
476 |
|
---|
477 | # Build some packages that require GNU compilers.
|
---|
478 | banner "Building zlib (Compute Node)"
|
---|
479 | (eval $bv_PATH/build_visit \
|
---|
480 | --version ${VISIT_VERSION} \
|
---|
481 | --console --static --no-visit $SVN $TARBALL --engine-only \
|
---|
482 | --log-file compute_node.txt \
|
---|
483 | --arch "${ARCH}_BGQ" \
|
---|
484 | --prefix "${PREFIX}" \
|
---|
485 | --build-mode $BUILD_MODE \
|
---|
486 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
487 | --installation-build-dir "${INSTALLATION_BUILD_DIR}_BGQ" \
|
---|
488 | --cc $BG_CC $CFLAGSARGS \
|
---|
489 | --cxx $BG_CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
490 | --no-thirdparty --zlib \
|
---|
491 | --group $GROUP)
|
---|
492 | if [[ $? != 0 ]] ; then
|
---|
493 | warn "ZLIB build failed. Giving up"
|
---|
494 | return 1
|
---|
495 | fi
|
---|
496 |
|
---|
497 | return 0
|
---|
498 | }
|
---|
499 |
|
---|
500 | function build_vtk_BGQ
|
---|
501 | {
|
---|
502 | # Come up with some extra arguments for VTK's cmake line.
|
---|
503 | MESADIR="$THIRD_PARTY_PATH/mesa/$MESA_VERSION/${ARCH}_BGQ"
|
---|
504 | ZLIBDIR="$THIRD_PARTY_PATH/zlib/$ZLIB_VERSION/${ARCH}_BGQ"
|
---|
505 | VTKDIR="$THIRD_PARTY_PATH/vtk/$VTK_VERSION/${ARCH}_BGQ"
|
---|
506 | VTK_SRC_DIR="${INSTALLATION_BUILD_DIR}_BGQ/VTK-${VTK_VERSION}"
|
---|
507 | VTK_BUILD_DIR="${INSTALLATION_BUILD_DIR}_BGQ/VTK-${VTK_VERSION}-build"
|
---|
508 |
|
---|
509 | # If the VTK installation directory already exists, return.
|
---|
510 | if test -d $VTKDIR ; then
|
---|
511 | info "VTK is already installed."
|
---|
512 | return 0
|
---|
513 | fi
|
---|
514 |
|
---|
515 | MAKEARGS=""
|
---|
516 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
517 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
518 | fi
|
---|
519 | CFLAGSARGS=""
|
---|
520 | if test -n "$BG_C_OPT_FLAGS" ; then
|
---|
521 | CFLAGSARGS="--cflags \"$BG_C_OPT_FLAGS\""
|
---|
522 | fi
|
---|
523 | CXXFLAGSARGS=""
|
---|
524 | if test -n "$BG_CXX_OPT_FLAGS" ; then
|
---|
525 | CXXFLAGSARGS="--cxxflags \"$BG_CXX_OPT_FLAGS\""
|
---|
526 | fi
|
---|
527 |
|
---|
528 | # Form extra arguments that we'll pass to cmake for VTK.
|
---|
529 | vopts="-DCMAKE_CROSSCOMPILING:BOOL=ON -DVTK_OPENGL_HAS_OSMESA:BOOL=ON"
|
---|
530 | vopts="${vopts} -DOPENGL_INCLUDE_DIR:PATH=$MESADIR/include"
|
---|
531 | vopts="${vopts} -DOPENGL_gl_LIBRARY:PATH=$MESADIR/lib/libOSMesa.a"
|
---|
532 | vopts="${vopts} -DOPENGL_glu_LIBRARY:PATH=$MESADIR/lib/libGLU.a"
|
---|
533 | vopts="${vopts} -DVTK_USE_X:BOOL=OFF"
|
---|
534 | vopts="${vopts} -DOSMESA_LIBRARY:FILEPATH=$MESADIR/lib/libOSMesa.a"
|
---|
535 | vopts="${vopts} -DOSMESA_INCLUDE_DIR:FILEPATH=$MESADIR/include"
|
---|
536 |
|
---|
537 | vopts="${vopts} -DVTK_USE_SYSTEM_ZLIB:BOOL=ON"
|
---|
538 | vopts="${vopts} -DZLIB_INCLUDE_DIR:PATH=$ZLIBDIR/include"
|
---|
539 | vopts="${vopts} -DZLIB_LIBRARY:FILEPATH=$ZLIBDIR/lib/libz.a"
|
---|
540 |
|
---|
541 | vopts="${vopts} -DCMAKE_REQUIRE_LARGE_FILE_SUPPORT:INTERNAL=1"
|
---|
542 | vopts="${vopts} -DVTK_TYPE_CHAR_IS_SIGNED:INTERNAL=1"
|
---|
543 | vopts="${vopts} -DVTK_ANSI_STREAM_EOF_RESULT:INTERNAL=0"
|
---|
544 | vopts="${vopts} -DKWSYS_LFS_WORKS:INTERNAL=0"
|
---|
545 | vopts="${vopts} -DKWSYS_CHAR_IS_SIGNED:INTERNAL=0"
|
---|
546 |
|
---|
547 | # Delete the old cache file if there is one.
|
---|
548 | if test -e $VTK_BUILD_DIR/CMakeCache.txt ; then
|
---|
549 | rm -f $VTK_BUILD_DIR/CMakeCache.txt
|
---|
550 | fi
|
---|
551 |
|
---|
552 | # Call build_visit.
|
---|
553 | banner "Building VTK (Compute Node)"
|
---|
554 | (export VTK_EXTRA_OPTIONS="${vopts}"
|
---|
555 | export C_COMPILER=$BG_CC
|
---|
556 | export BUILD_VISIT_BGQ="yes"
|
---|
557 | eval $bv_PATH/build_visit \
|
---|
558 | --version ${VISIT_VERSION} \
|
---|
559 | --console --static --no-visit $SVN $TARBALL --engine-only \
|
---|
560 | --no-thirdparty --cmake --vtk \
|
---|
561 | --log-file compute_node.txt \
|
---|
562 | --arch "${ARCH}_BGQ" \
|
---|
563 | --build-mode $BUILD_MODE \
|
---|
564 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
565 | --installation-build-dir "${INSTALLATION_BUILD_DIR}_BGQ" \
|
---|
566 | --cc $BG_CC $CFLAGSARGS \
|
---|
567 | --cxx $BG_CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
568 | --group $GROUP)
|
---|
569 |
|
---|
570 | rm -rf $VTK_SRC_DIR
|
---|
571 | rm -rf $VTK_BUILD_DIR
|
---|
572 |
|
---|
573 | return $?
|
---|
574 | }
|
---|
575 |
|
---|
576 | function build_icet_BGQ
|
---|
577 | {
|
---|
578 | MAKEARGS=""
|
---|
579 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
580 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
581 | fi
|
---|
582 | CFLAGSARGS=""
|
---|
583 | if test -n "$BG_C_OPT_FLAGS" ; then
|
---|
584 | CFLAGSARGS="--cflag \"$BG_C_OPT_FLAGS\""
|
---|
585 | fi
|
---|
586 | CXXFLAGSARGS=""
|
---|
587 | if test -n "$BG_CXX_OPT_FLAGS" ; then
|
---|
588 | CXXFLAGSARGS="--cxxflag \"$BG_CXX_OPT_FLAGS\""
|
---|
589 | fi
|
---|
590 |
|
---|
591 | # Call build_visit just to build Ice-T. Use the gnu compilers to build
|
---|
592 | # it but use the XL/MPI compilers to detect MPI.
|
---|
593 | banner "Building Ice-T (Compute Node)"
|
---|
594 | (export PAR_COMPILER=$BG_MPI_CC
|
---|
595 | export C_COMPILER=$BG_CC
|
---|
596 | eval $bv_PATH/build_visit \
|
---|
597 | --version ${VISIT_VERSION} \
|
---|
598 | --console --static --no-visit $SVN $TARBALL --engine-only \
|
---|
599 | --no-thirdparty --cmake --icet \
|
---|
600 | --log-file compute_node.txt \
|
---|
601 | --arch "${ARCH}_BGQ" \
|
---|
602 | --prefix "${PREFIX}" \
|
---|
603 | --build-mode $BUILD_MODE \
|
---|
604 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
605 | --installation-build-dir "${INSTALLATION_BUILD_DIR}_BGQ" \
|
---|
606 | --cc $BG_GNU_CC $CFLAGSARGS \
|
---|
607 | --cxx $BG_GNU_CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
608 | --group $GROUP)
|
---|
609 |
|
---|
610 | rm -rf ${INSTALLATION_BUILD_DIR}_BGQ/IceT-1-0-0
|
---|
611 |
|
---|
612 | return $?
|
---|
613 | }
|
---|
614 |
|
---|
615 | # 0 on success, Non-zero on failure.
|
---|
616 | function build_for_compute_node
|
---|
617 | {
|
---|
618 | banner "BUILDING FOR COMPUTE NODE"
|
---|
619 |
|
---|
620 | # We need to build Mesa with a special config file.
|
---|
621 | STARTDIR=`pwd`
|
---|
622 | build_mesa_BGQ
|
---|
623 | if [[ $? != 0 ]] ; then
|
---|
624 | warn "Mesa build failed. Giving up"
|
---|
625 | return 1
|
---|
626 | fi
|
---|
627 | cd $STARTDIR
|
---|
628 |
|
---|
629 | # We need to build zlib
|
---|
630 | build_zlib_BGQ
|
---|
631 | if [[ $? != 0 ]] ; then
|
---|
632 | warn "ZLIB build failed. Giving up"
|
---|
633 | return 1
|
---|
634 | fi
|
---|
635 | cd $STARTDIR
|
---|
636 |
|
---|
637 | # We need to build VTK
|
---|
638 | build_vtk_BGQ
|
---|
639 | if [[ $? != 0 ]] ; then
|
---|
640 | warn "VTK build failed. Giving up"
|
---|
641 | return 1
|
---|
642 | fi
|
---|
643 | cd $STARTDIR
|
---|
644 |
|
---|
645 | # We need to build Ice-T
|
---|
646 | build_icet_BGQ
|
---|
647 | if [[ $? != 0 ]] ; then
|
---|
648 | warn "Ice-T build failed. Giving up"
|
---|
649 | return 1
|
---|
650 | fi
|
---|
651 | cd $STARTDIR
|
---|
652 |
|
---|
653 | # Build the other packages (and VisIt) that don't need special treatment.
|
---|
654 |
|
---|
655 | MAKEARGS=""
|
---|
656 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
657 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
658 | fi
|
---|
659 | CFLAGSARGS=""
|
---|
660 | if test -n "$BG_C_OPT_FLAGS" ; then
|
---|
661 | CFLAGSARGS="--cflag \"$BG_C_OPT_FLAGS\""
|
---|
662 | fi
|
---|
663 | CXXFLAGSARGS=""
|
---|
664 | if test -n "$BG_CXX_OPT_FLAGS" ; then
|
---|
665 | CXXFLAGSARGS="--cxxflag \"$BG_CXX_OPT_FLAGS\""
|
---|
666 | fi
|
---|
667 |
|
---|
668 | # Build some packages that require GNU compilers.
|
---|
669 | banner "Building I/O libraries (Compute Node)"
|
---|
670 | (export SILO_EXTRA_OPTIONS="--disable-browser --disable-hzip --disable-fpzip"
|
---|
671 | export BUILD_VISIT_BGQ="yes"
|
---|
672 | eval $bv_PATH/build_visit \
|
---|
673 | --version ${VISIT_VERSION} \
|
---|
674 | --console --static --no-visit $SVN $TARBALL --engine-only \
|
---|
675 | --log-file compute_node.txt \
|
---|
676 | --arch "${ARCH}_BGQ" \
|
---|
677 | --prefix "${PREFIX}" \
|
---|
678 | --build-mode $BUILD_MODE \
|
---|
679 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
680 | --installation-build-dir "${INSTALLATION_BUILD_DIR}_BGQ" \
|
---|
681 | --cc $BG_GNU_CC $CFLAGSARGS \
|
---|
682 | --cxx $BG_GNU_CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
683 | --no-thirdparty --zlib $IO_PACKAGES \
|
---|
684 | --group $GROUP)
|
---|
685 | if [[ $? != 0 ]] ; then
|
---|
686 | warn "3rd party I/O build failed. Giving up"
|
---|
687 | return 1
|
---|
688 | fi
|
---|
689 |
|
---|
690 | # Call build_visit to build VisIt itself. Note that we set PAR_COMPILER,
|
---|
691 | # C_COMPILER, BUILD_VISIT_BGQ to trigger special behaviors in build_visit.
|
---|
692 | #
|
---|
693 | # NOTE: We do not build with Mesa support because we're already using Mesa
|
---|
694 | # as our GL library. This way, we use the VTK rendering classes since
|
---|
695 | # they are working better than the VisIt Mesa-based ones.
|
---|
696 | #
|
---|
697 |
|
---|
698 | DBPLUGINSARGS=""
|
---|
699 | if test -n "${VISIT_SELECTED_DATABASE_PLUGINS}" ; then
|
---|
700 | DBPLUGINSARGS="--database-plugins \"${VISIT_SELECTED_DATABASE_PLUGINS}\""
|
---|
701 | fi
|
---|
702 |
|
---|
703 | banner "Building VisIt (Compute Node)"
|
---|
704 | (export PAR_COMPILER=$BG_MPI_CC
|
---|
705 | export C_COMPILER=$BG_CC
|
---|
706 | export BUILD_VISIT_BGQ="yes"
|
---|
707 | eval $bv_PATH/build_visit \
|
---|
708 | --version ${VISIT_VERSION} \
|
---|
709 | --console --static $NO_VISIT $SVN $TARBALL --engine-only\
|
---|
710 | --log-file compute_node.txt \
|
---|
711 | --arch "${ARCH}_BGQ" \
|
---|
712 | --prefix "${PREFIX}" \
|
---|
713 | --build-mode $BUILD_MODE \
|
---|
714 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
715 | --installation-build-dir "${INSTALLATION_BUILD_DIR}_BGQ" \
|
---|
716 | --cc $BG_CC $CFLAGSARGS \
|
---|
717 | --cxx $BG_CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
718 | --no-thirdparty --boost --zlib $IO_PACKAGES \
|
---|
719 | --parallel --cmake --icet \
|
---|
720 | --group $GROUP \
|
---|
721 | ${DBPLUGINSARGS})
|
---|
722 | if [[ $? != 0 ]] ; then
|
---|
723 | warn "VisIt build failed. Giving up"
|
---|
724 | return 1
|
---|
725 | fi
|
---|
726 |
|
---|
727 | # If we built VisIt then move the libsim lib directory because otherwise
|
---|
728 | # we'll clobber it with the login node version later.
|
---|
729 | if test "$NO_VISIT" = "" ; then
|
---|
730 | LIBSIM_BGQ=""
|
---|
731 | if test -d $PREFIX/${VISIT_VERSION}/linux-ppc64/libsim/V2/lib ; then
|
---|
732 | LIBSIM_BGQ=$PREFIX/${VISIT_VERSION}/linux-ppc64/libsim/V2/libBGQ
|
---|
733 | mv $PREFIX/${VISIT_VERSION}/linux-ppc64/libsim/V2/lib ${LIBSIM_BGQ}
|
---|
734 | fi
|
---|
735 | if test -d $PREFIX/${VISIT_VERSION}b/linux-ppc64/libsim/V2/lib ; then
|
---|
736 | LIBSIM_BGQ=$PREFIX/${VISIT_VERSION}b/linux-ppc64/libsim/V2/libBGQ
|
---|
737 | mv $PREFIX/${VISIT_VERSION}b/linux-ppc64/libsim/V2/lib ${LIBSIM_BGQ}
|
---|
738 | fi
|
---|
739 | # copy static libs, which are dependencies for the static libsimV2 libs
|
---|
740 | if [ ! -z "${LIBSIM_BGQ}" ]; then
|
---|
741 | cp builds_static_BGQ/src/lib/libsimV2runtime_par.a ${LIBSIM_BGQ}
|
---|
742 | cp builds_static_BGQ/src/lib/libengine_par.a ${LIBSIM_BGQ}
|
---|
743 | cp builds_static_BGQ/src/lib/libsimV2_static_par.a ${LIBSIM_BGQ}
|
---|
744 | cp builds_static_BGQ/src/lib/libcognomen.a ${LIBSIM_BGQ}
|
---|
745 | cp builds_static_BGQ/src/lib/libvisit_vtk.a ${LIBSIM_BGQ}
|
---|
746 | fi
|
---|
747 | fi
|
---|
748 |
|
---|
749 | return 0
|
---|
750 | }
|
---|
751 |
|
---|
752 | function build_for_login_node
|
---|
753 | {
|
---|
754 | banner "BUILDING FOR LOGIN NODE"
|
---|
755 |
|
---|
756 | MAKEARGS=""
|
---|
757 | if test -n "$MAKE_OPT_FLAGS" ; then
|
---|
758 | MAKEARGS="--makeflags \"$MAKE_OPT_FLAGS\""
|
---|
759 | fi
|
---|
760 |
|
---|
761 | CFLAGSARGS=""
|
---|
762 | if test -n "$C_OPT_FLAGS" ; then
|
---|
763 | CFLAGSARGS="--cflag \"$C_OPT_FLAGS\""
|
---|
764 | fi
|
---|
765 | CXXFLAGSARGS=""
|
---|
766 | if test -n "$CXX_OPT_FLAGS" ; then
|
---|
767 | CXXFLAGSARGS="--cxxflag \"$CXX_OPT_FLAGS\""
|
---|
768 | fi
|
---|
769 | DBPLUGINSFLAGSARGS=""
|
---|
770 | if test -n "$VISIT_SELECTED_DATABASE_PLUGINS" ; then
|
---|
771 | DBPLUGINSFLAGSARGS="--database-plugins \"$VISIT_SELECTED_DATABASE_PLUGINS\""
|
---|
772 | fi
|
---|
773 |
|
---|
774 | # Build cmake, python, VTK. We pass BUILD_VISIT_BGQ in the environment so
|
---|
775 | # VTK will be configured using a script. This works around a glitch in
|
---|
776 | # identifying the compiler.
|
---|
777 | banner "Building Dependencies (Login Node)"
|
---|
778 | (eval $bv_PATH/build_visit \
|
---|
779 | --version ${VISIT_VERSION} \
|
---|
780 | --console --static --no-visit $SVN $TARBALL --server-components-only \
|
---|
781 | --log-file login_node.txt \
|
---|
782 | --arch $ARCH \
|
---|
783 | --prefix "${PREFIX}" \
|
---|
784 | --build-mode $BUILD_MODE \
|
---|
785 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
786 | --installation-build-dir $INSTALLATION_BUILD_DIR \
|
---|
787 | --cc $CC $CFLAGSARGS \
|
---|
788 | --cxx $CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
789 | --no-thirdparty --cmake --vtk --python \
|
---|
790 | --group $GROUP)
|
---|
791 | if [[ $? != 0 ]] ; then
|
---|
792 | warn "VisIt build failed. Giving up"
|
---|
793 | return 1
|
---|
794 | fi
|
---|
795 |
|
---|
796 | # Do another build_visit pass with no BUILD_VISIT_BGQ since we don't want what
|
---|
797 | # it would do to the resulting config-site file.
|
---|
798 | banner "Building VisIt (Login Node)"
|
---|
799 | (eval $bv_PATH/build_visit \
|
---|
800 | --version ${VISIT_VERSION} \
|
---|
801 | --console --static $NO_VISIT $SVN $TARBALL --server-components-only \
|
---|
802 | --log-file login_node.txt \
|
---|
803 | --arch $ARCH \
|
---|
804 | --prefix "${PREFIX}" \
|
---|
805 | --build-mode $BUILD_MODE \
|
---|
806 | --thirdparty-path $THIRD_PARTY_PATH \
|
---|
807 | --installation-build-dir $INSTALLATION_BUILD_DIR \
|
---|
808 | --cc $CC $CFLAGSARGS \
|
---|
809 | --cxx $CXX $CXXFLAGSARGS $MAKEARGS \
|
---|
810 | --no-thirdparty --boost --cmake --vtk $IO_PACKAGES --python \
|
---|
811 | --group $GROUP \
|
---|
812 | ${DBPLUGINSFLAGSARGS})
|
---|
813 | if [[ $? != 0 ]] ; then
|
---|
814 | warn "VisIt build failed. Giving up"
|
---|
815 | return 1
|
---|
816 | fi
|
---|
817 |
|
---|
818 | return 0
|
---|
819 | }
|
---|
820 |
|
---|
821 |
|
---|
822 | function printvars
|
---|
823 | {
|
---|
824 | echo "========================================================================"
|
---|
825 | echo "The following variables will be used during the build process:"
|
---|
826 | echo ""
|
---|
827 | echo "Build Settings"
|
---|
828 | echo "==============="
|
---|
829 | echo "ARCH=$ARCH"
|
---|
830 | echo "BUILD_MODE=$BUILD_MODE"
|
---|
831 | echo "THIRD_PARTY_PATH=$THIRD_PARTY_PATH"
|
---|
832 | echo "INSTALLATION_BUILD_DIR=$INSTALLATION_BUILD_DIR"
|
---|
833 | echo "PREFIX=$PREFIX"
|
---|
834 | echo "EXTRA_ARGS=$EXTRA_ARGS"
|
---|
835 | echo "GROUP=$GROUP"
|
---|
836 | echo "IO_PACKAGES=$IO_PACKAGES"
|
---|
837 | echo "MAKE_OPT_FLAGS=$MAKE_OPT_FLAGS"
|
---|
838 | echo "NO_VISIT=$NO_VISIT"
|
---|
839 | echo "SVN=$SVN"
|
---|
840 | echo "VISIT_SELECTED_DATABASE_PLUGINS=$VISIT_SELECTED_DATABASE_PLUGINS"
|
---|
841 | echo ""
|
---|
842 | echo "Login Node"
|
---|
843 | echo "==========="
|
---|
844 | echo "CC=$CC"
|
---|
845 | echo "C_OPT_FLAGS=$C_OPT_FLAGS"
|
---|
846 | echo "CXX=$CXX"
|
---|
847 | echo "CXX_OPT_FLAGS=$CXX_OPT_FLAGS"
|
---|
848 | echo ""
|
---|
849 | echo "Compute Node"
|
---|
850 | echo "============="
|
---|
851 | echo "BG_CC=$BG_CC"
|
---|
852 | echo "BG_C_OPT_FLAGS=$BG_C_OPT_FLAGS"
|
---|
853 | echo "BG_CXX=$BG_CXX"
|
---|
854 | echo "BG_CXX_OPT_FLAGS=$BG_CXX_OPT_FLAGS"
|
---|
855 | echo ""
|
---|
856 | echo "BG_GNU_CC=$BG_GNU_CC"
|
---|
857 | echo "BG_GNU_CXX=$BG_GNU_CXX"
|
---|
858 | echo ""
|
---|
859 | echo "BG_MPI_CC=$BG_MPI_CC"
|
---|
860 | echo "BG_MPI_C_OPT_FLAGS=$BG_MPI_C_OPT_FLAGS"
|
---|
861 | echo "BG_MPI_CXX=$BG_MPI_CXX"
|
---|
862 | echo "BG_MPI_CXX_OPT_FLAGS=$BG_MPI_CXX_OPT_FLAGS"
|
---|
863 | echo "========================================================================"
|
---|
864 |
|
---|
865 | return 0
|
---|
866 | }
|
---|
867 |
|
---|
868 | function usage
|
---|
869 | {
|
---|
870 | echo "Usage: build_visit_BGQ [arguments]"
|
---|
871 | echo ""
|
---|
872 | echo "This script builds statically-linked VisIt server components for BlueGene-Q "
|
---|
873 | echo "computers. The parallel compute engine is built for the compute nodes and the"
|
---|
874 | echo "mdserver, vcl, and engine_ser components are built for the login nodes."
|
---|
875 | echo ""
|
---|
876 | echo "Argument Description"
|
---|
877 | echo "============================= =========================================================="
|
---|
878 | echo "--database-plugins list A list of database plugins to build (e.g. Curve2D;Silo)"
|
---|
879 | echo "--installation-build-dir dir The build directory to be used to build the code."
|
---|
880 | echo "--thirdparty-path path The directory where 3rd party libraries will be installed."
|
---|
881 | echo "--build-mode mode The build mode: Debug or Release"
|
---|
882 | echo "--group group Set the group for installed 3rd party libraries."
|
---|
883 | echo "-h/--help Print the help and exit."
|
---|
884 | echo "--print Print the variables that will be used for the build."
|
---|
885 | echo "--makeflags flags Build the code, passing flags to make."
|
---|
886 | echo "--no-compute Do not build the compute node version."
|
---|
887 | echo "--no-login Do not build the login node version."
|
---|
888 | echo "--no-visit Do not build the VisIt sources."
|
---|
889 | echo "--svn Download sources from svn."
|
---|
890 | echo "--svn-anonymous Download sources from anonymous svn."
|
---|
891 | echo ""
|
---|
892 | echo "Login Node"
|
---|
893 | echo "==========="
|
---|
894 | echo "--cc path The C compiler to use for login node compilation."
|
---|
895 | echo "--cflag flag Append a flag to the CFLAGS used with the --cc compiler."
|
---|
896 | echo "--cflags flags Set the CFLAGS used with the --cc compiler."
|
---|
897 | echo "--cxx path The C++ compiler to use for login node compilation."
|
---|
898 | echo "--cxxflag flag Append a flag to the CXXFLAGS used with the --cxx compiler."
|
---|
899 | echo "--cxxflags flags Set the CXXFLAGS used with the --cxx compiler."
|
---|
900 | echo ""
|
---|
901 | echo ""
|
---|
902 | echo "Compute Node"
|
---|
903 | echo "============="
|
---|
904 | echo "--bgcc path The serial C compiler to use for compute node compilation."
|
---|
905 | echo "--bgcflag flag Append a flag to the CFLAGS used with the --bgcc/--bggnucc compilers."
|
---|
906 | echo "--bgcflags flags Set the CFLAGS used with the --bgcc/--bggnucc compilers."
|
---|
907 | echo "--bgcxx path The serial C++ compiler to use for compute node compilation."
|
---|
908 | echo "--bgcxxflag flag Append a flag to the CXXFLAGS used with the --bgcxx/--bggnucxx compilers."
|
---|
909 | echo "--bgcxxflags flags Set the CXXFLAGS used with the --bgcxx/--bggnucxx compilers."
|
---|
910 | echo ""
|
---|
911 | echo "--bggnucc path The serial GNU C compiler to use for compute node compilation."
|
---|
912 | echo " This compiler is used for 3rd party packages that have autoconf"
|
---|
913 | echo " build systems: Mesa, Silo, ... The CFLAGS specified using "
|
---|
914 | echo " --bgcflag/--bgcflags are used."
|
---|
915 | echo "--bggnucxx path The serial GNU C++ compiler to use for compute node compilation."
|
---|
916 | echo " The CXXFLAGS specified using --bgcxxflag/--bgcxxflags are used."
|
---|
917 | echo
|
---|
918 | echo "--bgmpicc path The parallel C compiler to use for compute node compilation."
|
---|
919 | echo "--bgmpicflag flag Append a flag to the CFLAGS used with the --bgmpicc compiler."
|
---|
920 | echo "--bgmpicflags flags Set the CFLAGS used with the --bgmpicc compiler."
|
---|
921 | echo "--bgmpicxx path The parallel C++ compiler to use for compute node compilation."
|
---|
922 | echo "--bgmpicxxflag flag Append a flag to the CXXFLAGS used with the --bgmpicxx compiler."
|
---|
923 | echo "--bgmpicxxflags flags Set the CXXFLAGS used with the --bgmpicxx compiler."
|
---|
924 |
|
---|
925 | return 0
|
---|
926 | }
|
---|
927 |
|
---|
928 | function main
|
---|
929 | {
|
---|
930 | DO_COMPUTE="yes"
|
---|
931 | DO_LOGIN="yes"
|
---|
932 | next_action=""
|
---|
933 | next_arg=""
|
---|
934 | for arg in "$@" ; do
|
---|
935 | # Was the last option something that took an argument?
|
---|
936 | if test -n "$next_arg" ; then
|
---|
937 | # Yep. Which option was it?
|
---|
938 | case $next_arg in
|
---|
939 | installation-build-dir) INSTALLATION_BUILD_DIR="$arg";;
|
---|
940 | build-mode) BUILD_MODE="${arg}";;
|
---|
941 |
|
---|
942 | append-cflags) C_OPT_FLAGS="${C_OPT_FLAGS} ${arg}";;
|
---|
943 | append-cxxflags) CXX_OPT_FLAGS="${CXX_OPT_FLAGS} ${arg}";;
|
---|
944 | cflags) C_OPT_FLAGS="${arg}";;
|
---|
945 | cxxflags) CXX_OPT_FLAGS="${arg}";;
|
---|
946 | cc) CC="${arg}";;
|
---|
947 | cxx) CXX="${arg}";;
|
---|
948 |
|
---|
949 | append-bgcflags) BG_C_OPT_FLAGS="${BG_C_OPT_FLAGS} ${arg}";;
|
---|
950 | append-bgcxxflags) BG_CXX_OPT_FLAGS="${BG_CXX_OPT_FLAGS} ${arg}";;
|
---|
951 | bgcflags) BG_C_OPT_FLAGS="${arg}";;
|
---|
952 | bgcxxflags) BG_CXX_OPT_FLAGS="${arg}";;
|
---|
953 | bgcc) BG_CC="${arg}";;
|
---|
954 | bgcxx) BG_CXX="${arg}";;
|
---|
955 | bggnucc) BG_GNU_CC="${arg}";;
|
---|
956 | bggnucxx) BG_GNU_CXX="${arg}";;
|
---|
957 |
|
---|
958 | append-bgmpicflags) BG_MPI_C_OPT_FLAGS="${BG_MPI_C_OPT_FLAGS} ${arg}";;
|
---|
959 | append-bgmpicxxflags) BG_MPI_CXX_OPT_FLAGS="${BG_MPI_CXX_OPT_FLAGS} ${arg}";;
|
---|
960 | bgmpicflags) BG_MPI_C_OPT_FLAGS="${arg}";;
|
---|
961 | bgmpicxxflags) BG_MPI_CXX_OPT_FLAGS="${arg}";;
|
---|
962 | bgmpicc) BG_MPI_CC="${arg}";;
|
---|
963 | bgmpicxx) BG_MPI_CXX="${arg}";;
|
---|
964 |
|
---|
965 | database-plugins) VISIT_SELECTED_DATABASE_PLUGINS="${arg}";;
|
---|
966 | group) GROUP="${arg}";;
|
---|
967 | makeflags) MAKE_OPT_FLAGS="${arg}";;
|
---|
968 | thirdparty-path) THIRD_PARTY_PATH="${arg}";;
|
---|
969 | *) error "Unknown next_arg value '$next_arg'!"
|
---|
970 | esac
|
---|
971 | # Make sure we process the next option as an option and not an
|
---|
972 | # argument to an option.
|
---|
973 | next_arg=""
|
---|
974 | continue
|
---|
975 | fi
|
---|
976 | case $arg in
|
---|
977 | --installation-build-dir) next_arg="installation-build-dir";;
|
---|
978 | --build-mode) next_arg="build-mode";;
|
---|
979 |
|
---|
980 | --cflag) next_arg="append-cflags";;
|
---|
981 | --cflags) next_arg="cflags";;
|
---|
982 | --cxxflag) next_arg="append-cxxflags";;
|
---|
983 | --cxxflags) next_arg="cxxflags";;
|
---|
984 | --cc) next_arg="cc";;
|
---|
985 | --cxx) next_arg="cxx";;
|
---|
986 |
|
---|
987 | --bgcflag) next_arg="append-bgcflags";;
|
---|
988 | --bgcflags) next_arg="bgcflags";;
|
---|
989 | --bgcxxflag) next_arg="append-bgcxxflags";;
|
---|
990 | --bgcxxflags) next_arg="bgcxxflags";;
|
---|
991 | --bgcc) next_arg="bgcc";;
|
---|
992 | --bgcxx) next_arg="bgcxx";;
|
---|
993 | --bggnucc) next_arg="bggnucc";;
|
---|
994 | --bggnucxx) next_arg="bggnucxx";;
|
---|
995 |
|
---|
996 | --bgmpicflag) next_arg="append-bgmpicflags";;
|
---|
997 | --bgmpicflags) next_arg="bgmpicflags";;
|
---|
998 | --bgmpicxxflag) next_arg="append-bgmpicxxflags";;
|
---|
999 | --bgmpicxxflags) next_arg="bgmpicxxflags";;
|
---|
1000 | --bgmpicc) next_arg="bgmpicc";;
|
---|
1001 | --bgmpicxx) next_arg="bgmpicxx";;
|
---|
1002 |
|
---|
1003 | --database-plugins) next_arg="database-plugins";;
|
---|
1004 | --group) next_arg="group";;
|
---|
1005 | -h|--help) next_action="help";;
|
---|
1006 | --print) next_action="printvars";;
|
---|
1007 | --makeflags) next_arg="makeflags";;
|
---|
1008 | --no-compute) DO_COMPUTE="";;
|
---|
1009 | --no-login) DO_LOGIN="";;
|
---|
1010 | --no-visit) NO_VISIT="--no-visit";;
|
---|
1011 | --svn) SVN="--svn" ; DO_SVN="yes" ; TARBALL="";;
|
---|
1012 | --svn-anonymous) SVN="--svn-anonymous"; DO_SVN_ANON="yes" ; TARBALL="";;
|
---|
1013 | --thirdparty-path) next_arg="thirdparty-path";;
|
---|
1014 | esac
|
---|
1015 | done
|
---|
1016 |
|
---|
1017 | if test -n "${next_action}" ; then
|
---|
1018 | case ${next_action} in
|
---|
1019 | printvars) printvars; exit 2;;
|
---|
1020 | help) usage; exit 2;;
|
---|
1021 | esac
|
---|
1022 | fi
|
---|
1023 |
|
---|
1024 | # Print the settings we're using for the build
|
---|
1025 | printvars
|
---|
1026 |
|
---|
1027 | # Make build directories.
|
---|
1028 | if ! test -d $INSTALLATION_BUILD_DIR ; then
|
---|
1029 | mkdir $INSTALLATION_BUILD_DIR
|
---|
1030 |
|
---|
1031 | fi
|
---|
1032 | if ! test -d ${INSTALLATION_BUILD_DIR}_BGQ ; then
|
---|
1033 | mkdir ${INSTALLATION_BUILD_DIR}_BGQ
|
---|
1034 | fi
|
---|
1035 |
|
---|
1036 | # Make an installation directory.
|
---|
1037 | if ! test -d $THIRD_PARTY_PATH ; then
|
---|
1038 | mkdir $THIRD_PARTY_PATH
|
---|
1039 | else
|
---|
1040 | echo "$THIRD_PARTY_PATH already exists."
|
---|
1041 | fi
|
---|
1042 |
|
---|
1043 | if test "${SVN}" == "" && test "${NO_VISIT}" == "" ; then
|
---|
1044 | # We're building VisIt from a local source file (not svn) so check that
|
---|
1045 | # the file is present at the level of the build_visit_BGQ script.
|
---|
1046 | # If we find it then we'll copy it into the installation build dirs so
|
---|
1047 | # the build_visit scripts will locate it.
|
---|
1048 | if ! test -e visit${VISIT_VERSION}.tar.gz ; then
|
---|
1049 | error "VisIt source file visit${VISIT_VERSION}.tar.gz not found in $PWD. Exiting."
|
---|
1050 | exit 3
|
---|
1051 | fi
|
---|
1052 |
|
---|
1053 | # Copy local source file into installation build dirs if it's not there.
|
---|
1054 | if ! test -e $INSTALLATION_BUILD_DIR/visit${VISIT_VERSION}.tar.gz ; then
|
---|
1055 | cp visit${VISIT_VERSION}.tar.gz $INSTALLATION_BUILD_DIR
|
---|
1056 | fi
|
---|
1057 | if ! test -e ${INSTALLATION_BUILD_DIR}_BGQ/visit${VISIT_VERSION}.tar.gz ; then
|
---|
1058 | cp visit${VISIT_VERSION}.tar.gz ${INSTALLATION_BUILD_DIR}_BGQ
|
---|
1059 | fi
|
---|
1060 | fi
|
---|
1061 |
|
---|
1062 | # We build cmake specially so we can share the build between the login
|
---|
1063 | # node and compute node build stages.
|
---|
1064 | build_cmake
|
---|
1065 |
|
---|
1066 | # We build the compute node version first.
|
---|
1067 | if test -n "${DO_COMPUTE}" ; then
|
---|
1068 | build_for_compute_node
|
---|
1069 | if [[ $? != 0 ]] ; then
|
---|
1070 | warn "Compute node build failed. Giving up"
|
---|
1071 | exit 4
|
---|
1072 | fi
|
---|
1073 | fi
|
---|
1074 |
|
---|
1075 | # Now build for the login node so the engine_ser for the login node will
|
---|
1076 | # overwrite the compute node's version that was previously installed.
|
---|
1077 | if test -n "${DO_LOGIN}" ; then
|
---|
1078 | build_for_login_node
|
---|
1079 | if [[ $? != 0 ]] ; then
|
---|
1080 | warn "Login node build failed. Giving up"
|
---|
1081 | exit 5
|
---|
1082 | fi
|
---|
1083 | fi
|
---|
1084 |
|
---|
1085 | # We installed VisIt so tar up the binary distribution since it contains
|
---|
1086 | # binaries for both the login nodes and the compute nodes.
|
---|
1087 | if test "$NO_VISIT" = "" ; then
|
---|
1088 | VV=$(echo ${VISIT_VERSION} | tr "." "_")
|
---|
1089 | tar zcf visit${VV}.${PREFIXARCH}.tar.gz ${PREFIXARCH}
|
---|
1090 | fi
|
---|
1091 |
|
---|
1092 | return 0
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 | main "$@"
|
---|
1096 | exit 0 |
---|