bv_main.sh 49.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
function initialize_build_visit()
{

# *************************************************************************** #
#                       Section 1, setting up inputs                          #
# --------------------------------------------------------------------------- #
# This section sets up the inputs to the VisIt script.  This is where you can #
# specify which compiler to use, which versions of the third party libraries, #
# etc.  Note that this script is really only known to work with gcc.          #
# *************************************************************************** #

# This env. variable is NOT to be overriden by user. It is intended to
# contain user's env. just prior to running build_visit.
export BUILD_VISIT_ENV=$(env | cut -d'=' -f1 | sort | uniq)

16 17 18
# allow users to set an external hostname for output filename
export EXTERNAL_HOSTNAME=""

19 20 21 22 23 24 25 26
# Can cause problems in some build systems.
unset CDPATH

# Some systems tar command does not support the deep directory hierarchies
# used in Qt, such as AIX. Gnu tar is a good alternative.
### export TAR=/usr/local/bin/tar # Up and Purple
export TAR=tar

brugger's avatar
 
brugger committed
27 28 29 30 31 32 33 34 35
# Determine if gfortran is present. This overly complex coding is to prevent
# the "which" command from echoing failure to the user.
which gfortran >& /dev/null
if [[ $? == 0 ]]; then
    export GFORTRAN=`which gfortran | grep '^/'`
else
    export GFORTRAN=""
fi

36 37 38 39 40 41 42 43 44 45
export OPSYS=${OPSYS:-$(uname -s)}
export PROC=${PROC:-$(uname -p)}
export REL=${REL:-$(uname -r)}
# Determine architecture
if [[ "$OPSYS" == "Darwin" ]]; then
   export ARCH=${ARCH:-"${PROC}-apple-darwin${REL%%.*}"}
#  export VISITARCH=${VISITARCH-${ARCH}}
   export SO_EXT="dylib"
   VER=$(uname -r)
# Check for Panther, because MACOSX_DEPLOYMENT_TARGET will default to 10.1
miller86's avatar
miller86 committed
46 47 48 49
# Used http://en.wikipedia.org/wiki/Darwin_(operating_system) to map Darwin
# Kernel versions to OSX version numbers.
# Other options for dealing with MACOSX_DEPLOYMENT_TARGET didn't work
# See issue #1499 (https://visitbugs.ornl.gov/issues/1499)
50 51 52 53 54 55 56 57
   if (( ${VER%%.*} < 8 )) ; then
      export MACOSX_DEPLOYMENT_TARGET=10.3
   elif [[ ${VER%%.*} == 8 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.4
   elif [[ ${VER%%.*} == 9 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.5
   elif [[ ${VER%%.*} == 10 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.6
miller86's avatar
miller86 committed
58 59 60 61
   elif [[ ${VER%%.*} == 11 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.7
   elif [[ ${VER%%.*} == 12 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.8
ghweber's avatar
ghweber committed
62 63
   elif [[ ${VER%%.*} == 13 ]] ; then
      export MACOSX_DEPLOYMENT_TARGET=10.9
64
   else
ghweber's avatar
ghweber committed
65
      export MACOSX_DEPLOYMENT_TARGET=10.9
66 67 68 69
   fi
   export C_COMPILER=${C_COMPILER:-"gcc"}
   export CXX_COMPILER=${CXX_COMPILER:-"g++"}
   # Disable Fortran on Darwin since it causes HDF5, H5Part, Silo, ADIOS builds to explode.
brugger's avatar
 
brugger committed
70
   export FC_COMPILER=""
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CFLAGS=${CFLAGS:-"-fno-common -fexceptions"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export CXXFLAGS=${CXXFLAGS:-"-fno-common -fexceptions"}
   export FCFLAGS=${FCFLAGS:-$CFLAGS}
   export MESA_TARGET=${MESA_TARGET:-"darwin"}
   export QT_PLATFORM=${QT_PLATFORM:-"macx-g++"}
elif [[ "$OPSYS" == "Linux" ]]; then
   export ARCH=${ARCH:-"linux-$(uname -m)"} # You can change this to say RHEL, SuSE, Fedora.
   export SO_EXT="so"
   if [[ "$(uname -m)" == "i386" ]] ; then
###   export MESA_TARGET=${MESA_TARGET:-"linux-x86"} # Mesa-6.x
      export MESA_TARGET=${MESA_TARGET:-"linux"}
   elif [[ "$(uname -m)" == "i686" ]] ; then
###   export MESA_TARGET=${MESA_TARGET:-"linux-x86"} # Mesa-6.x
      export MESA_TARGET=${MESA_TARGET:-"linux"}
   elif [[ "$(uname -m)" == "x86_64" ]] ; then
brugger's avatar
 
brugger committed
88 89
      CFLAGS="$CFLAGS -m64 -fPIC"
      FCFLAGS="$FCFLAGS -m64 -fPIC"
90 91 92
      if [[ "$C_COMPILER" == "gcc" || "$C_COMPILER" == "" ]]; then
          C_OPT_FLAGS="$C_OPT_FLAGS -O2"
      fi
brugger's avatar
 
brugger committed
93
      CXXFLAGS="$CXXFLAGS -m64 -fPIC"
94 95 96 97 98 99 100 101 102 103 104 105 106 107
      if [[ "$CXX_COMPILER" == "g++" || "$CXX_COMPILER" == "" ]]; then
          CXX_OPT_FLAGS="$CXX_OPT_FLAGS -O2"
      fi
###   export MESA_TARGET=${MESA_TARGET:-"linux-x86-64"} # Mesa-6.x
      export MESA_TARGET=${MESA_TARGET:-"linux"}
      QT_PLATFORM="linux-g++-64"
   elif [[ "$(uname -m)" == "ppc64" ]] ; then
      if [[ "$C_COMPILER" == "xlc" ]] ; then
          CFLAGS="$CFLAGS -qpic"
          FCFLAGS="$FCFLAGS -qpic"
          CXXFLAGS="$CXXFLAGS -qpic"
          export CXX_COMPILER=${CXX_COMPILER-"xlC"}
          export MESA_TARGET=${MESA_TARGET-"linux"}
          QT_PLATFORM="linux-xlc" #aix-xlc"
108 109
      elif [[ "$C_COMPILER" == "bgxlc" ]] ; then
          export CXX_COMPILER=${CXX_COMPILER-"bgxlC"}
110
      else
brugger's avatar
 
brugger committed
111 112
          CFLAGS="$CFLAGS -fPIC"
          FCFLAGS="$FCFLAGS -fPIC"
113 114 115
          if [[ "$C_COMPILER" == "gcc" || "$C_COMPILER" == "" ]]; then
              C_OPT_FLAGS="$C_OPT_FLAGS -O2"
          fi
brugger's avatar
 
brugger committed
116
          CXXFLAGS="$CXXFLAGS -fPIC"
117 118 119 120 121 122 123
          if [[ "$CXX_COMPILER" == "g++" || "$CXX_COMPILER" == "" ]]; then
              CXX_OPT_FLAGS="$CXX_OPT_FLAGS -O2"
          fi
          export MESA_TARGET=${MESA_TARGET-"linux"}
          QT_PLATFORM="linux-g++"
      fi
   elif [[ "$(uname -m)" == "ia64" ]] ; then
brugger's avatar
 
brugger committed
124 125
      CFLAGS="$CFLAGS -fPIC"
      FCFLAGS="$FCFLAGS -fPIC"
126 127 128
      if [[ "$C_COMPILER" == "gcc" || "$C_COMPILER" == "" ]]; then
          C_OPT_FLAGS="$C_OPT_FLAGS -O2"
      fi
brugger's avatar
 
brugger committed
129
      CXXFLAGS="$CXXFLAGS -fPIC"
130 131 132 133 134 135 136
      if [[ "$CXX_COMPILER" == "g++" || "$CXX_COMPILER" == "" ]]; then
          CXX_OPT_FLAGS="$CXX_OPT_FLAGS -O2"
      fi
      QT_PLATFORM="linux-g++"
   fi
   export C_COMPILER=${C_COMPILER:-"gcc"}
   export CXX_COMPILER=${CXX_COMPILER:-"g++"}
brugger's avatar
 
brugger committed
137
   export FC_COMPILER=${FC_COMPILER:-$GFORTRAN}
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export MESA_TARGET=${MESA_TARGET:-"linux"}
   export QT_PLATFORM=${QT_PLATFORM:-"linux-g++"}
elif [[ "$OPSYS" == "AIX" ]]; then
   export ARCH="aix" # You can change this to say RHEL, SuSE, Fedora, etc.
   export SO_EXT="a"
   export C_COMPILER=${C_COMPILER:-"xlc"}
   export FC_COMPILER=${FC_COMPILER:-$(which xlf | grep '^/')}
   export CXX_COMPILER=${CXX_COMPILER:-"xlC"}
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export MAKE=${MAKE:-"gmake"}
   export MESA_TARGET=${MESA_TARGET:-"aix"}
   if [[ "$OBJECT_MODE" == 32 ]]; then
      export QT_PLATFORM=${QT_PLATFORM:-"aix-xlc"}
   else
      export QT_PLATFORM=${QT_PLATFORM:-"aix-xlc-64"}
   fi
elif [[ "$OPSYS" == "IRIX64" ]]; then
   export ARCH="irix64" # You can change this to say RHEL, SuSE, Fedora, etc.
   export SO_EXT="so"
   export C_COMPILER=${C_COMPILER:-"gcc"}
brugger's avatar
 
brugger committed
161
   export FC_COMPILER=${FC_COMPILER:-$GFORTRAN}
162 163 164 165 166 167 168 169 170
   export CXX_COMPILER=${CXX_COMPILER:-"g++"}
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export MAKE=${MAKE:-"gmake"}
   export MESA_TARGET=${MESA_TARGET:-"irix6-64-dso"}
elif [[ "$OPSYS" == "SunOS" ]]; then
   export ARCH=${ARCH:-"sunos5"}
   export SO_EXT="so"
   export C_COMPILER=${C_COMPILER:-"gcc"}
brugger's avatar
 
brugger committed
171
   export FC_COMPILER=${FC_COMPILER:-$GFORTRAN}
172 173 174 175 176 177 178 179 180 181
   export CXX_COMPILER=${CXX_COMPILER:-"g++"}
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export MAKE=${MAKE:-"make"}
   export MESA_TARGET=${MESA_TARGET:-"sunos5-gcc"}
   export QT_PLATFORM="solaris-g++"
else
   export ARCH=${ARCH:-"linux-$(uname -m)"} # You can change this to say RHEL, SuSE, Fedora.
   export SO_EXT="so"
   if [[ "$(uname -m)" == "x86_64" ]] ; then
brugger's avatar
 
brugger committed
182 183
      CFLAGS="$CFLAGS -m64 -fPIC"
      FCFLAGS="$FCFLAGS -m64 -fPIC"
184 185 186
      if [[ "$C_COMPILER" == "gcc" || "$C_COMPILER" == "" ]]; then
          C_OPT_FLAGS="$C_OPT_FLAGS -O2"
      fi
brugger's avatar
 
brugger committed
187
      CXXFLAGS="$CXXFLAGS -m64 -fPIC"
188 189 190 191 192 193
      if [[ "$CXX_COMPILER" == "g++" || "$CXX_COMPILER" == "" ]]; then
          CXX_OPT_FLAGS="$CXX_OPT_FLAGS -O2"
      fi
      QT_PLATFORM="linux-g++-64"
   fi
   if [[ "$(uname -m)" == "ia64" ]] ; then
brugger's avatar
 
brugger committed
194 195
      CFLAGS="$CFLAGS -fPIC"
      FCFLAGS="$FCFLAGS -fPIC"
196 197 198
      if [[ "$C_COMPILER" == "gcc" || "$C_COMPILER" == "" ]]; then
          C_OPT_FLAGS="$C_OPT_FLAGS -O2"
      fi
brugger's avatar
 
brugger committed
199
      CXXFLAGS="$CXXFLAGS -fPIC"
200 201 202 203 204 205
      if [[ "$CXX_COMPILER" == "g++" || "$CXX_COMPILER" == "" ]]; then
          CXX_OPT_FLAGS="$CXX_OPT_FLAGS -O2"
      fi
      QT_PLATFORM="linux-g++-64"
   fi
   export C_COMPILER=${C_COMPILER:-"gcc"}
brugger's avatar
 
brugger committed
206
   export FC_COMPILER=${FC_COMPILER:-$GFORTRAN}
207 208 209 210 211 212 213 214
   export CXX_COMPILER=${CXX_COMPILER:-"g++"}
   export C_OPT_FLAGS=${C_OPT_FLAGS:-"-O2"}
   export CXX_OPT_FLAGS=${CXX_OPT_FLAGS:-"-O2"}
   export QT_PLATFORM=${QT_PLATFORM:-"linux-g++"}
fi
export MAKE=${MAKE:-"make"}
export THIRD_PARTY_PATH=${THIRD_PARTY_PATH:-"./visit"}
export GROUP=${GROUP:-"visit"}
215
#export LOG_FILE=${LOG_FILE:-"${0##*/}_log"}
216
export SVNREVISION=${SVNREVISION:-"HEAD"}
cyrush's avatar
cyrush committed
217
# Created a temporary value because the user can override most of
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
# the components, which for the GUI happens at a later time.
# the tmp value is useful for user feedback.
if [[ $VISITARCH == "" ]] ; then
    export VISITARCHTMP=${ARCH}_${C_COMPILER}
    if [[ "$CXX_COMPILER" == "g++" ]] ; then
        VERSION=$(g++ -v 2>&1 | grep "gcc version" | cut -d' ' -f3 | cut -d'.' -f1-2)
        if [[ ${#VERSION} == 3 ]] ; then
            VISITARCHTMP=${VISITARCHTMP}-${VERSION}
        fi
    fi
else
# use environment variable value
    export VISITARCHTMP=$VISITARCH
fi

REDIRECT_ACTIVE="no"
ANY_ERRORS="no"
235 236 237 238

#initialize VisIt
bv_visit_initialize

239 240 241 242
#
# OPTIONS
#
#initialize required libraries..
243

hkrishna's avatar
hkrishna committed
244
for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
245
do
hkrishna's avatar
hkrishna committed
246
    initializeFunc="bv_${reqlibs[$bv_i]}_initialize"
247 248 249
    $initializeFunc
done

hkrishna's avatar
hkrishna committed
250
for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
251
do
hkrishna's avatar
hkrishna committed
252
    initializeFunc="bv_${optlibs[$bv_i]}_initialize"
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
    $initializeFunc
done

export DO_HOSTCONF="yes"
export ON_HOSTCONF="on"

export DO_DEBUG="no"
export ON_DEBUG="off"
export DO_GROUP="no"
export ON_GROUP="off"
export DO_LOG="no"
export ON_LOG="off"
parallel="no"
ON_parallel="off"
export DO_SVN="no"
export DO_SVN_ANON="no"
export ON_SVN="off"
export DO_REVISION="no"
export ON_REVISION="off"
USE_VISIT_FILE="no"
ON_USE_VISIT_FILE="off"
export DO_PATH="no"
export ON_PATH="off"
export DO_VERSION="no"
export ON_VERSION="off"
export DO_VERBOSE="no"
export ON_VERBOSE="off"
export DO_JAVA="no"
export ON_JAVA="off"
brugger's avatar
 
brugger committed
282 283
export DO_FORTRAN="no"
export ON_FORTRAN="off"
284 285 286 287 288 289 290 291 292 293 294 295 296 297
export DO_SLIVR="no"
export ON_SLIVR="off"
export PREVENT_ICET="no"
GRAPHICAL="yes"
ON_GRAPHICAL="on"
verify="no"
ON_verify="off"
export DO_OPTIONAL="yes"
export ON_OPTIONAL="on"
export DO_OPTIONAL2="no"
export ON_OPTIONAL2="off"
export DO_MORE="no"
export ON_MORE="off"
export DO_DBIO_ONLY="no"
298 299
export DO_ENGINE_ONLY="no"
export DO_SERVER_COMPONENTS_ONLY="no"
300
export DO_STATIC_BUILD="no"
camp's avatar
camp committed
301
export DO_THREAD_BUILD="no"
302
export USE_VISIBILITY_HIDDEN="no"
303 304
export VISIT_INSTALL_PREFIX=""
export VISIT_BUILD_MODE="Release"
305 306
DOWNLOAD_ONLY="no"

brugger's avatar
 
brugger committed
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
if [[ "$CXX_COMPILER" == "g++" ]] ; then
    VERSION=$(g++ -v 2>&1 | grep "gcc version" | cut -d' ' -f3 | cut -d'.' -f1-1)
    if [[ ${VERSION} -ge 4 ]] ; then
        export USE_VISIBILITY_HIDDEN="yes"
    fi
fi


export SVN_ANON_ROOT_PATH="http://portal.nersc.gov/svn/visit"
# Setup svn path: use SVN_NERSC_NAME if set
if test -z "$SVN_NERSC_NAME" ; then
    export SVN_REPO_ROOT_PATH="svn+ssh://portal-auth.nersc.gov/project/projectdirs/visit/svn/visit"
else
    export SVN_REPO_ROOT_PATH="svn+ssh://$SVN_NERSC_NAME@portal-auth.nersc.gov/project/projectdirs/visit/svn/visit"
fi




if [[ "$OPSYS" != "Darwin" ]]; then
    WGET_MINOR_VERSION=$(wget --version| head -n 1|cut -d. -f 2)
    # version 1.7 pre-dates ssl integration
    if [[ "${WGET_MINOR_VERSION}" == "8" ]] ; then
       export WGET_OPTS=${WGET_OPTS=""}
    elif [[ "${WGET_MINOR_VERSION}" == "9" ]] ; then
       export WGET_OPTS=${WGET_OPTS:="--sslcheckcert=0"}
    else
       export WGET_OPTS=${WGET_OPTS:-"--no-check-certificate"}
    fi
fi

339 340 341 342

#get visit information..
bv_visit_info

343 344 345 346 347 348 349
#
# TARBALL LOCATIONS AND VERSIONS
#
if [[ "$VISIT_FILE" != "" ]] ; then
  USE_VISIT_FILE="yes"
  ON_USE_VISIT_FILE="on"
fi
brugger's avatar
 
brugger committed
350 351
export VISIT_FILE=${VISIT_FILE:-"visit${VISIT_VERSION}.tar.gz"}

hkrishna's avatar
hkrishna committed
352
for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
353
do
hkrishna's avatar
hkrishna committed
354
    initializeFunc="bv_${reqlibs[$bv_i]}_info"
355 356 357
    $initializeFunc
done

hkrishna's avatar
hkrishna committed
358
for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
359
do
hkrishna's avatar
hkrishna committed
360
    initializeFunc="bv_${optlibs[$bv_i]}_info"
361 362 363 364 365 366 367 368 369 370 371 372
    $initializeFunc
done


# Dialog-related variables.
DLG="dialog"
DLG_BACKTITLE="VisIt $VISIT_VERSION Build Process"
DLG_HEIGHT="5"
DLG_HEIGHT_TALL="25"
DLG_WIDTH="60"
DLG_WIDTH_WIDE="80"
WRITE_UNIFIED_FILE=""
373 374
VISIT_INSTALLATION_BUILD_DIR=""
VISIT_DRY_RUN=0
375 376
DO_SUPER_BUILD="no"
DO_MANGLED_LIBRARIES="no"
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
}




# *************************************************************************** #
# Function: starts_with_quote                                                 #
#                                                                             #
# Purpose: Meant to be used in `if $(starts_with_quote "$var") ; then`        #
#          conditionals.                                                      #
#                                                                             #
# Programmer: Tom Fogal                                                       #
# Date: Thu Oct  9 15:24:04 MDT 2008                                          #
#                                                                             #
# *************************************************************************** #

function starts_with_quote
{
395
    if test "${1:0:1}" = "\""; then #"
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
        return 0
    fi
    if test "${1:0:1}" = "'" ; then
        return 0
    fi
    return 1
}

# *************************************************************************** #
# Function: ends_with_quote                                                   #
#                                                                             #
# Purpose: Meant to be used `if $(ends_with_quote "$var") ; then`             #
#          conditionals.                                                      #
#                                                                             #
# Programmer: Tom Fogal                                                       #
# Date: Thu Oct  9 15:24:13 MDT 2008                                          #
#                                                                             #
# *************************************************************************** #

function ends_with_quote
{
417
    if test "${1: -1:1}" = "\""; then #"
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
        return 0
    fi
    if test "${1: -1:1}" = "'"; then
        return 0
    fi
    return 1
}

# *************************************************************************** #
# Function: strip_quotes                                                      #
#                                                                             #
# Purpose: Removes all quotes from the given argument.  Meant to be used in   #
#          $(strip_quotes "$some_string") expressions.                        #
#                                                                             #
# Programmer: Tom Fogal                                                       #
# Date: Thu Oct  9 16:04:25 MDT 2008                                          #
#                                                                             #
# *************************************************************************** #

function strip_quotes
{
    local arg="$@"
    str=""
    while test -n "$arg" ; do
        if test "${arg:0:1}" != "\"" ; then
            str="${str}${arg:0:1}"
        fi
        arg="${arg:1}"
    done
    echo "${str}"
}

cyrush's avatar
cyrush committed
450
function bv_enable_group
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
{
    local name=${1/--}
    local match=0

    for (( bv_i=0; bv_i < ${#grouplibs_name[*]}; ++bv_i ))
    do
        #replace | with space
        group_flag=${grouplibs_name[$bv_i]}
        group_flag=${group_flag//\|/ }
        for group in `echo $group_flag`;
        do
            if [[ "$group" == "$name" ]]; then
                echo "executing group $name"
                match=1
                for group_dep in `echo ${grouplibs_deps[$bv_i]}`;
                do
                    if [[ "$group_dep" == no-* ]]; then
                        group_dep=${group_dep/no-}
                        #info "disabling $group_dep"
                        initializeFunc="bv_${group_dep}_disable"
                        $initializeFunc
                    else
                        #info "enabling $group_dep"
                        initializeFunc="bv_${group_dep}_enable"
                        $initializeFunc
                    fi
                done
            fi
        done
    done

    return $match
}

function enable_dependent_libraries
{
    local depends_on=""

    for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
    do
        $"bv_${reqlibs[$bv_i]}_is_enabled"

        #if not enabled then skip
        if [[ $? == 0 ]]; then
            continue
        fi

        #enabled library, check dependencies..
        depends_on=$("bv_${reqlibs[$bv_i]}_depends_on")

        #replace commas with spaces if there are any..
        depends_on=${depends_on//,/ }

        for depend_lib in `echo $depends_on`;
        do
            $"bv_${depend_lib}_is_enabled"
            if [[ $? == 0 ]]; then
508 509 510
                error "ERROR: library ${depend_lib} was not set ${reqlibs[$bv_i]} depends on it, please enable"
                #echo "library ${depend_lib} was not set but another library depends on it, enabling it"
                #$"bv_${depend_lib}_enable"
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
            fi
        done
    done

    for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
    do
        $"bv_${optlibs[$bv_i]}_is_enabled"

        #if not enabled then skip
        if [[ $? == 0 ]]; then
            continue
        fi

        #enabled library, check dependencies..
        depends_on=$("bv_${optlibs[$bv_i]}_depends_on")

        #replace commas with spaces if there are any..
        depends_on=${depends_on//,/ }

        for depend_lib in `echo $depends_on`;
        do
            $"bv_${depend_lib}_is_enabled"
            if [[ $? == 0 ]]; then
534
                error "ERROR: library ${depend_lib} was not set ${optlibs[$bv_i]} depends on it, please enable"
535 536 537 538 539 540 541 542 543 544 545 546 547
                echo "library ${depend_lib} was not set but another library depends on it, enabling it"
                $"bv_${depend_lib}_enable"
            fi
        done
    done
}

#TODO: enable this feature and remove this from ensure..
function initialize_module_variables
{
    info "initializing module variables"
    for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
    do
548 549 550 551 552 553 554
        $"bv_${reqlibs[$bv_i]}_is_enabled"

        #if not enabled then skip
        if [[ $? == 0 ]]; then
            continue
        fi

cyrush's avatar
cyrush committed
555 556
        declare -F "bv_${reqlibs[$bv_i]}_initialize_vars" &>/dev/null

557 558 559 560 561 562 563 564
        if [[ $? == 0 ]]; then
            info "initialize module variables for ${reqlibs[$bv_i]}"
            $"bv_${reqlibs[$bv_i]}_initialize_vars"
        fi
    done

    for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
    do
565 566 567 568 569 570 571
        $"bv_${optlibs[$bv_i]}_is_enabled"

        #if not enabled then skip
        if [[ $? == 0 ]]; then
            continue
        fi

572
        declare -F "bv_${optlibs[$bv_i]}_initialize_vars" &>/dev/null
cyrush's avatar
cyrush committed
573

574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
        if [[ $? == 0 ]]; then
            info "initialize module variables for ${optlibs[$bv_i]}"
            $"bv_${optlibs[$bv_i]}_initialize_vars"
        fi
    done
}


function build_library
{
    local build_lib=$1
    local depends_on=""

    #check if library is already installed..
    $"bv_${build_lib}_is_installed"
cyrush's avatar
cyrush committed
589

590 591 592
    if [[ $? == 1 ]]; then
        info "$build_lib is already installed, skipping"
        return
cyrush's avatar
cyrush committed
593
    fi
594 595 596

    #Make sure that the recursive enable feature is working properly
    $"bv_${build_lib}_is_enabled"
cyrush's avatar
cyrush committed
597

598 599 600 601 602
    if [[ $? == 0 ]]; then
        error "$build_lib was disabled, but seems that another library requires it "
    fi

    depends_on=$("bv_${build_lib}_depends_on")
cyrush's avatar
cyrush committed
603

604 605 606 607 608 609
    if [[ $depends_on != "" ]]; then
        info "library $build_lib depends on $depends_on"
    fi

    #replace commas with spaces if there are any..
    depends_on=${depends_on//,/ }
cyrush's avatar
cyrush committed
610

611 612 613 614
    for depend_lib in `echo $depends_on`;
    do
        build_library $depend_lib
    done
cyrush's avatar
cyrush committed
615

616 617 618 619 620 621 622 623 624 625
    #build ..
    $"bv_${build_lib}_build"
}

function build_libraries_serial
{
    info "building required libraries"
    for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
    do
        $"bv_${reqlibs[$bv_i]}_is_enabled"
cyrush's avatar
cyrush committed
626

627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
        if [[ $? == 0 ]]; then
            continue
        fi

        $"bv_${reqlibs[$bv_i]}_is_installed"

        if [[ $? == 0 ]]; then
            cd "$START_DIR"
            build_library ${reqlibs[$bv_i]}
        else
            info "${reqlibs[$bv_i]} already installed, skipping"
        fi
    done

    info "building optional libraries"
    for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
    do
        $"bv_${optlibs[$bv_i]}_is_enabled"
cyrush's avatar
cyrush committed
645

646 647 648 649 650 651 652 653 654 655 656
        if [[ $? == 0 ]]; then
            continue
        fi

        $"bv_${optlibs[$bv_i]}_is_installed"

        if [[ $? == 0 ]]; then
            cd "$START_DIR"
            build_library ${optlibs[$bv_i]}
        else
            info "${optlibs[$bv_i]} already installed, skipping"
cyrush's avatar
cyrush committed
657
        fi
658 659 660 661 662 663 664 665 666 667
    done
}

function build_libraries_parallel
{
    #launch all non dependent libraries in parallel..
    info "building parallel required libraries"
    for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
    do
        $"bv_${reqlibs[$bv_i]}_is_enabled"
cyrush's avatar
cyrush committed
668

669 670 671 672 673 674
        if [[ $? == 0 ]]; then
            continue
        fi

        $"bv_${reqlibs[$bv_i]}_is_installed"
        if [[ $? == 0 ]]; then
cyrush's avatar
cyrush committed
675

676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
            depends_on=$("bv_${reqlibs[$bv_i]}_depends_on")
            if [[ "$depends_on" == "" ]]; then
                (cd "$START_DIR" && build_library ${reqlibs[$bv_i]}) &
            fi
        else
            info "${reqlibs[$bv_i]} already installed, skipping"
        fi
    done

    wait

    #load the serial ones..
    for (( bv_i=0; bv_i<${#reqlibs[*]}; ++bv_i ))
    do
        $"bv_${reqlibs[$bv_i]}_is_enabled"

        if [[ $? == 0 ]]; then
            continue
        fi

        $"bv_${reqlibs[$bv_i]}_is_installed"

        if [[ $? == 0 ]]; then
            cd "$START_DIR"
            build_library ${reqlibs[$bv_i]}
        else
            info "${reqlibs[$bv_i]} already installed, skipping"
        fi
    done

    info "building parallel optional libraries"
    for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
    do
        $"bv_${optlibs[$bv_i]}_is_enabled"
cyrush's avatar
cyrush committed
710

711 712 713 714 715 716 717 718 719 720 721 722
        if [[ $? == 0 ]]; then
            continue
        fi
        $"bv_${optlibs[$bv_i]}_is_installed"
        if [[ $? == 0 ]]; then

            depends_on=$("bv_${optlibs[$bv_i]}_depends_on")
            if [[ "$depends_on" == "" ]]; then
                (cd "$START_DIR" && build_library ${optlibs[$bv_i]}) &
            fi
        else
            info "${optlibs[$bv_i]} already installed, skipping"
cyrush's avatar
cyrush committed
723
        fi
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
    done

    wait

    #load serial
    for (( bv_i=0; bv_i<${#optlibs[*]}; ++bv_i ))
    do
        $"bv_${optlibs[$bv_i]}_is_enabled"

        if [[ $? == 0 ]]; then
            continue
        fi

        $"bv_${optlibs[$bv_i]}_is_installed"

        if [[ $? == 0 ]]; then
            cd "$START_DIR"
            build_library ${optlibs[$bv_i]}
        else
            info "${optlibs[$bv_i]} already installed, skipping"
        fi
    done

cyrush's avatar
cyrush committed
747
}
748

749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
# *************************************************************************** #
#                       Section 2, building VisIt                             #
# --------------------------------------------------------------------------- #
# This section does some set up for building VisIt, and then calls the        #
# functions to build the third party libraries and VisIt itself.              #
# *************************************************************************** #
function run_build_visit()
{
declare -a arguments

# Will be set if the next argument is an argument to an argument (I swear that
# makes sense).  Make sure to unset it after pulling the argument!
next_arg=""
# If the user gives any deprecated options, we'll append command line options
# we think they should use here.
deprecated=""
# A few options require us to perform some action before we start building
# things, but we'd like to finish option parsing first.  We'll set this
# variable in those cases, and test it when we finish parsing.
next_action=""

770
#handle groups first since they affect multiple libraries..
cyrush's avatar
cyrush committed
771
for arg in "$@" ;
772 773 774 775
do
    bv_enable_group "$arg"
    #not part of a group, add to argument list..
    if [[ $? == 0 ]]; then
776 777 778 779 780 781 782 783 784 785 786
        local match=0

        #suppress licenses from argument list
        for license in `echo $defaultLicenses`
        do
            if [[ "${arg/--}" == "$license" ]]; then
                match=1
                break
            fi
        done

787
        #suppress licenses as well..
788
        if [[ $match == 0 ]]; then
789 790 791
            arguments[${#arguments[*]}]="$arg"
        fi
    fi
792 793 794
done

for arg in "${arguments[@]}" ; do
795

796 797 798 799
    # Was the last option something that took an argument?
    if test -n "$next_arg" ; then
        # Yep.  Which option was it?
        case $next_arg in
800
            extra_commandline_arg) $EXTRA_COMMANDLINE_ARG_CALL "$arg";;
801
            visit-build-hostname) EXTERNAL_HOSTNAME="$arg";;
802
            installation-build-dir) VISIT_INSTALLATION_BUILD_DIR="$arg";;
803 804 805 806
            write-unified-file) WRITE_UNIFIED_FILE="$arg";;
            append-cflags) C_OPT_FLAGS="${C_OPT_FLAGS} ${arg}";;
            append-cxxflags) CXX_OPT_FLAGS="${CXX_OPT_FLAGS} ${arg}";;
            arch) VISITARCH="${arg}";;
807
            build-mode) VISIT_BUILD_MODE="${arg}";;
808 809
            cflags) C_OPT_FLAGS="${arg}";;
            cxxflags) CXX_OPT_FLAGS="${arg}";;
810 811
            cc) C_COMPILER="${arg}";;
            cxx) CXX_COMPILER="${arg}";;
812
            log-file) LOG_FILE="${arg}";;
813
            makeflags) MAKE_OPT_FLAGS="${arg}";;
814
            prefix) VISIT_INSTALL_PREFIX="${arg}";;
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
            group) GROUP="${arg}";;
            svn) SVNREVISION="${arg}";;
            tarball) VISIT_FILE="${arg}";;
            thirdparty-path) THIRD_PARTY_PATH="${arg}";;
            version) VISIT_VERSION="${arg}"
                     VISIT_FILE="visit${VISIT_VERSION}.tar.gz";;
            *) error "Unknown next_arg value '$next_arg'!"
        esac
        # Make sure we process the next option as an option and not an
        # argument to an option.
        next_arg=""
        continue
    fi

    if [[ ${#arg} -gt 2 ]] ; then #has --
830

831 832 833
        #one module at a time
        resolve_arg=${arg:2} #remove --
        declare -F "bv_${resolve_arg}_enable" &>/dev/null
834

cyrush's avatar
cyrush committed
835
        if [[ $? == 0 ]] ; then
836 837
            #echo "enabling ${resolve_arg}"
            initializeFunc="bv_${resolve_arg}_enable"
838 839
            #argument is being explicitly set by the user so add a "force" flag
            $initializeFunc force
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
            continue
        elif [[ ${#resolve_arg} -gt 3 ]] ; then #in case it is --no-
            resolve_arg_no_opt=${resolve_arg:3}
            #disable library if it does not exist..
            declare -F "bv_${resolve_arg_no_opt}_disable" &>/dev/null
            if [[ $? == 0 ]] ; then
                #echo "disabling ${resolve_arg_no_opt}"
                initializeFunc="bv_${resolve_arg_no_opt}_disable"
                $initializeFunc
                #if disabling icet, prevent it as well
                if [[ ${resolve_arg_no_opt} == "icet" ]]; then
                    echo "preventing icet from starting"
                    PREVENT_ICET="yes"
                fi
                continue
           fi
        fi
cyrush's avatar
cyrush committed
857

858 859
        #command line arguments created by modules
        #checking to see if additional command line arguments were requested
860 861 862 863
        resolve_arg=${arg:2} #remove --
        local match=0
        for (( bv_i=0; bv_i<${#extra_commandline_args[*]}; bv_i += 5 ))
        do
cyrush's avatar
cyrush committed
864 865 866 867 868
            local module_name=${extra_commandline_args[$bv_i]}
            local command=${extra_commandline_args[$bv_i+1]}
            local args=${extra_commandline_args[$bv_i+2]}
            local comment=${extra_commandline_args[$bv_i+3]}
            local fp=${extra_commandline_args[$bv_i+4]}
869
            if [[ "$command" == "$resolve_arg" ]]; then
cyrush's avatar
cyrush committed
870
                if [ $args -eq 0 ] ; then
871 872
                  #call function immediately
                  $fp
cyrush's avatar
cyrush committed
873
                else
874 875 876
                  #call function with next argument
                  next_arg="extra_commandline_arg"
                  EXTRA_COMMANDLINE_ARG_CALL="$fp"
cyrush's avatar
cyrush committed
877
                fi
878
                match=1
879 880 881
                break;
            fi
        done
882

883
        #found a match in the modules..
884
        if [[ $match -eq 1 ]]; then
885 886 887 888
           continue
        fi
    fi

cyrush's avatar
cyrush committed
889

890
    case $arg in
891
        --visit-build-hostname) next_arg="visit-build-hostname";;
892
        --installation-build-dir) next_arg="installation-build-dir";;
893
        --write-unified-file) next_arg="write-unified-file";;
894
        --parallel-build) DO_SUPER_BUILD="yes";;
895
        --dry-run) VISIT_DRY_RUN=1;;
896
        --arch) next_arg="arch";;
897
        --build-mode) next_arg="build-mode";;
898 899 900 901 902 903
        --cflag) next_arg="append-cflags";;
        --cflags) next_arg="cflags";;
        --cxxflag) next_arg="append-cxxflags";;
        --cxxflags) next_arg="cxxflags";;
        --cc) next_arg="cc";;
        --cxx) next_arg="cxx";;
904
        --log-file) next_arg="log-file";;
905
        --console) GRAPHICAL="no"; ON_GRAPHICAL="off";;
906 907
        --debug) C_OPT_FLAGS="${C_OPT_FLAGS} -g"; CXX_OPT_FLAGS="${CXX_OPT_FLAGS} -g"; VISIT_BUILD_MODE="Debug";;
        --bv-debug) set -vx;;
908
        --download-only) DOWNLOAD_ONLY="yes";;
909 910
        --engine-only) DO_ENGINE_ONLY="yes";;
        --flags-debug) C_OPT_FLAGS="${C_OPT_FLAGS} -g"; CXX_OPT_FLAGS="${CXX_OPT_FLAGS} -g"; VISIT_BUILD_MODE="Debug";;
911
        --gdal) DO_GDAL="yes"; ON_GDAL="on";;
brugger's avatar
 
brugger committed
912
        --fortran) DO_FORTRAN="yes"; ON_FORTRAN="on";;
913 914 915 916 917
        --group) next_arg="group"; DO_GROUP="yes"; ON_GROUP="on";;
        -h|--help) next_action="help";;
        --java) DO_JAVA="yes"; ON_JAVA="on";;
        --makeflags) next_arg="makeflags";;
        --no-hostconf) DO_HOSTCONF="no"; ON_HOSTCONF="off";;
bonnell's avatar
bonnell committed
918
        --parallel) parallel="yes"; DO_ICET="yes"; ON_ICET="on"; ON_parallel="on";;
919
        --prefix) next_arg="prefix";;
920
        --print-vars) next_action="print-vars";;
921
        --server-components-only) DO_SERVER_COMPONENTS_ONLY="yes";;
922
        --slivr) DO_SLIVR="yes"; ON_SLIVR="on";;
923
        --static) DO_STATIC_BUILD="yes"; USE_VISIBILIITY_HIDDEN="no";;
camp's avatar
camp committed
924
        --thread) DO_THREAD_BUILD="yes";;
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973
        --stdout) LOG_FILE="/dev/tty";;
        --svn) DO_SVN="yes"; export SVN_ROOT_PATH=$SVN_REPO_ROOT_PATH;;
        --svn-anon) DO_SVN="yes"; DO_SVN_ANON="yes" ; export SVN_ROOT_PATH=$SVN_ANON_ROOT_PATH ;;
        --svn-anonymous) DO_SVN="yes"; DO_SVN_ANON="yes" ; export SVN_ROOT_PATH=$SVN_ANON_ROOT_PATH ;;
        --svn-revision) next_arg="svn"; DO_SVN="yes"; DO_REVISION="yes"; DO_SVN_ANON="yes" ; export SVN_ROOT_PATH=$SVN_ANON_ROOT_PATH ;;
        --tarball) next_arg="tarball"
                   USE_VISIT_FILE="yes"
                   ON_USE_VISIT_FILE="on";;
        --thirdparty-path) next_arg="thirdparty-path"
                           ON_THIRD_PARTY_PATH="on";;
        --version) next_arg="version";;
        -4) deprecated="${deprecated} --hdf4";;
        -5) deprecated="${deprecated} --hdf5";;
        -c) deprecated="${deprecated} --cgns";;
        -C) deprecated="${deprecated} --ccmio";;
        -d) deprecated="${deprecated} --cflags '$C_OPT_FLAGS -g'";;
        -D) deprecated="${deprecated} --cflags '$C_OPT_FLAGS -g#'";;
        -E) deprecated="${deprecated} --print-vars";;
        -e) deprecated="${deprecated} --exodus";;
        -H) deprecated="${deprecated} --help";;
        -i) deprecated="${deprecated} --absolute";;
        -J) deprecated="${deprecated} --makeflags '-j <something>'";;
        -j) deprecated="${deprecated} --no-visit";;
        -m) deprecated="${deprecated} --mili";;
        -M) deprecated="${deprecated} --tcmalloc";;
        -r) deprecated="${deprecated} --h5part";;
        -R) deprecated="${deprecated} --svn <REVISION>";;
        -s) deprecated="${deprecated} --svn HEAD";;
        -S) deprecated="${deprecated} --slivr";;
        -t) deprecated="${deprecated} --tarball '<file>'";;
        -v) deprecated="${deprecated} --tarball 'visit<version>.tar.gz'";;
        -b|-B) deprecated="${deprecated} --boxlib";;
        -f|-F) deprecated="${deprecated} --cfitsio";;
        -g|-G) deprecated="${deprecated} --gdal";;
        -k|-K) deprecated="${deprecated} --no-thirdparty";;
        -l|-L) deprecated="${deprecated} --group '<arg>'";;
        -n|-N) deprecated="${deprecated} --netcdf";;
        -o|-O) deprecated="${deprecated} --stdout";;
        -p|-P) deprecated="${deprecated} --parallel";;
        -u|-U) deprecated="${deprecated} --thirdparty-path <path>";;
        -w|-W) deprecated="${deprecated} --python";;
        -y|-Y) deprecated="${deprecated} --java";;
        -z|-Z) deprecated="${deprecated} --console";;
        *)
            echo "Unrecognized option '${arg}'."
            ANY_ERRORS="yes";;
    esac
done

974
#error check to make sure that next arg is not left blank..
975
if [[ $next_arg != "" ]] ; then
976 977
    echo "command line arguments are used incorrectly: argument $next_arg not fullfilled"
    exit 0
978 979
fi

980 981 982 983 984
if [[ "$ANY_ERRORS" == "yes" ]] ; then
    echo "command line arguments are used incorrectly. unrecognized options..."
    exit 0
fi

985 986 987 988 989 990
if test -n "${deprecated}" ; then
    summary="You are using some deprecated options to $0.  Please re-run"
    summary="${summary} $0 with a command line similar to:"
    echo "$summary"
    echo ""
    echo "$0 ${deprecated}"
991
    exit 0
992
fi
993

994 995 996 997 998 999 1000
if test -n "${next_action}" ; then
    case ${next_action} in
        print-vars) printvariables; exit 2;;
        help) usage; exit 2;;
    esac
fi

1001 1002 1003 1004 1005 1006
#
# Echo the current invocation command line to the log file
#
info "[build_visit invocation arguments] $@"


1007
#write a unified file
1008
if [[ $WRITE_UNIFIED_FILE != "" ]] ; then
1009 1010
    bv_write_unified_file $WRITE_UNIFIED_FILE
    exit 0
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
fi

#
# If we are AIX, make sure we are using GNU tar.
#
if [[ "$OPSYS" == "AIX" ]]; then
    TARVERSION=$($TAR --version >/dev/null 2>&1)
    if [[ $? != 0 ]] ; then
        echo "Error in build process. You are using the system tar on AIX."
        echo "Change the TAR variable in the script to the location of the"
        echo "GNU tar command."
        exit 1
    fi
fi

brugger's avatar
 
brugger committed
1026 1027 1028
# Disable fortran support unless --fortran specified and a fortran compiler
# was specified or found.
if [[ $DO_FORTRAN == "no" || $FC_COMPILER == "" ]]; then
1029
    export FC_COMPILER="no";
brugger's avatar
 
brugger committed
1030
    warn "Fortran support for thirdparty libraries disabled."
1031 1032 1033 1034 1035 1036 1037 1038 1039
fi

# Show a splashscreen. This routine also determines if we have "dialog"
# or "whiptail", which we use to show dialogs. If we do not have either
# then proceed in non-graphical mode.
#

if [[ "$GRAPHICAL" == "yes" ]] ; then
    DLG=$(which dialog)
cyrush's avatar
cyrush committed
1040

1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
    # Guard against bad "which" implementations that return
    # "no <exe> in path1 path2 ..." (these implementations also
    # return 0 as the exit status).
    if [[ "${DLG#no }" != "${DLG}" ]] ; then
        DLG=""
    fi
    if [[ "$DLG" == "" ]] ; then
        warn "Could not find 'dialog'; looking for 'whiptail'."
        DLG=$(which whiptail)
        if [[ "${DLG#no }" != "${DLG}" ]] ; then
           DLG=""
        fi
        if [[ "$DLG" == "" ]] ; then
            GRAPHICAL="no"
            warn "'whiptail' not found."
            warn ""
            warn "Unable to find utility for graphical build..."
            warn "Continuing in command line mode..."
            warn ""
            test -t 1
            if test $? != 1 ; then
              warn "Please hit enter to continue."
              (read junkvar)
            fi
        else
            warn "Some versions of 'whiptail' fail to display anything with --infobox."
            warn "Continuing in command line mode..."
        fi
    fi
fi
if [[ "$GRAPHICAL" == "yes" ]] ; then
1072
    result=$($DLG --backtitle "$DLG_BACKTITLE" \
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
    --title "Build options" \
    --checklist \
"Welcome to the VisIt $VISIT_VERSION build process.\n\n"\
"This program will build VisIt and its required "\
"3rd party sources, downloading any missing source packages "\
"before building. The required and optional 3rd party libraries "\
"are built and installed before VisIt is built, so please be patient. "\
"Note that you can build a parallel version of VisIt by "\
"specifying the location of your MPI installation when prompted.\n\n"\
"Select the build options:" 0 0 0 \
1083 1084
           "Groups"    "select 3rd party and advanced build"  $ON_OPTIONAL\
           "Custom"    "select custom flags provided by each module"  $ON_OPTIONAL2\
1085 1086 1087 1088
           "SVN"        "get sources from SVN server"     $ON_SVN\
           "Tarball"    "specify VisIt tarball name"      $ON_USE_VISIT_FILE\
           "Parallel"   "specify parallel build flags"    $ON_parallel\
           "Java"       "enable java client library"      $ON_JAVA\
brugger's avatar
 
brugger committed
1089
           "Fortran"    "enable fortran in third party libraries"  $ON_FORTRAN\
1090 1091
           "SLIVR"      "enable SLIVR volume rendering library"  $ON_SLIVR\
           "EnvVars"     "specify build environment var values"   $ON_verify\
1092
           "Advanced"   "display advanced options"        $ON_MORE  3>&1 1>&2 2>&3)
1093 1094 1095
    retval=$?

    # Remove the extra quoting, new dialog has --single-quoted
1096 1097
    choice="$(echo $result | sed 's/\"//g' )"

1098 1099 1100 1101 1102 1103 1104 1105
    case $retval in
      0)
        DO_OPTIONAL="no"
        DO_OPTIONAL2="no"
        DO_SVN="no"
        USE_VISIT_FILE="no"
        parallel="no"
        DO_JAVA="no"
brugger's avatar
 
brugger committed
1106
        DO_FORTRAN="no"
1107 1108 1109 1110 1111 1112
        DO_SLIVR="no"
        verify="no"
        DO_MORE="no"
        for OPTION in $choice
        do
            case $OPTION in
1113
              Groups)
1114
                 DO_OPTIONAL="yes";;
1115
              Custom)
1116 1117 1118 1119
                 DO_OPTIONAL2="yes";;
              SVN)
                 DO_SVN="yes";DO_SVN_ANON="yes";export SVN_ROOT_PATH=$SVN_ANON_ROOT_PATH ;;
              Tarball)
1120
                 result=$($DLG --backtitle "$DLG_BACKTITLE" \
1121
                    --nocancel --inputbox \
1122 1123
"Enter $OPTION value:" 0 $DLG_WIDTH_WIDE "$VISIT_FILE" 3>&1 1>&2 2>&3)
                 VISIT_FILE="$(echo $result)"
1124 1125
                 USE_VISIT_FILE="yes";;
              Parallel)
bonnell's avatar
bonnell committed
1126
                 parallel="yes"; DO_ICET="yes"; ON_ICET="on";;
1127 1128
              Java)
                 DO_JAVA="yes";;
brugger's avatar
 
brugger committed
1129 1130
              Fortran)
                 DO_FORTRAN="yes";;
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150
              SLIVR)
                 DO_SLIVR="yes";;
              EnvVars)
                 verify="yes";;
              Advanced)
                 DO_MORE="yes";;
            esac
        done
        ;;
      1)
        warn "Cancel pressed."
        exit 1;;
      255)
        warn "ESC pressed.";;
      *)
        warn "Unexpected return code: $retval";;
    esac
fi

if [[ "$DO_OPTIONAL" == "yes" && "$GRAPHICAL" == "yes" ]] ; then
pugmire's avatar
pugmire committed
1151

1152
    local add_checklist_vars=""
1153

1154
    for (( bv_i=0; bv_i < ${#grouplibs_name[*]}; ++bv_i ))
brugger's avatar
 
brugger committed
1155
    do
1156 1157
        name="${grouplibs_name[$bv_i]}"
        comment="${grouplibs_comment[$bv_i]}"
cyrush's avatar
cyrush committed
1158
        output_str="$name \"$comment\" 0 \"  Customize($name)\" \"Customize selection of $name\" 0"
1159
        add_checklist_vars="$add_checklist_vars ${output_str}"
brugger's avatar
 
brugger committed
1160 1161
    done

1162 1163
    #calling whiptail directly is having issues delimiting by space , so hacking around it
    result=$(echo "$DLG --backtitle \"Group options\" --title \"Groups provided by build_visit\" --checklist \"select\" 0 0 0 $add_checklist_vars 3>&1 1>&2 2>&3 || echo \"Cancelled Operation\"" | awk '{system($0)}')
1164

1165 1166 1167 1168
    if [[ $result == "Cancelled Operation" ]]; then
        warn "Operation was cancelled, exiting"
        exit 1
    fi
1169 1170

    # Remove the extra quoting, new dialog has --single-quoted
1171
    choice="$(echo $result | sed 's/\"//g' )"
1172
    for OPTION in $choice
1173 1174
    do
        #if customize operation
cyrush's avatar
cyrush committed
1175
        if [[ "$OPTION" != Customize* ]]; then
1176 1177 1178 1179
            #execute the entire group..
            bv_enable_group "$OPTION"
            continue
        fi
cyrush's avatar
cyrush committed
1180

1181 1182 1183 1184
        #allow modification of predefined groups
        add_checklist_vars=""

        for (( bv_i=0; bv_i < ${#grouplibs_name[*]}; ++bv_i ))
1185
        do
1186 1187
            name="${grouplibs_name[$bv_i]}"
            #dialog and whiptail treat parantheses differently
cyrush's avatar
cyrush committed
1188
            if [[ "Customize($name)" == "$OPTION" || "Customize\\($name\\)" == "$OPTION" ]]; then
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199