-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-dependencies.sh
37 lines (30 loc) · 1.04 KB
/
build-dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Log outcome
rm -f dependencies-log.out # Remove if already exists
exec 3>&1 4>&2 # Trap stdout, stderr etc all at the same time.
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>dependencies-log.out 2>&1
# exit when any command fails
set -e
# Build dependencies that BOUT++'s CMake configuration does not handle yet
rm -f dependencies # Delete if already exists
mkdir dependencies
cd dependencies
DEPS_ROOT=$(pwd)
# PETSc
# See https://stackoverflow.com/a/13864829 for testing if variable is set
if [ -z ${PETSC_DIR+x} ]; then
unset PETSC_DIR
fi
if [ -z ${PETSC_ARCH+x} ]; then
unset PETSC_ARCH
fi
mkdir petsc-build
wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.4.tar.gz
tar xzf petsc-3.17.4.tar.gz
cd petsc-3.17.4
./configure COPTFLAGS="-O3" CXXOPTFLAGS="-O3" FOPTFLAGS="-O3" --download-hypre --with-debugging=0 --prefix=../petsc-build
make -j 4 PETSC_DIR=$PWD PETSC_ARCH=arch-linux-c-opt all
make -j 4 PETSC_DIR=$PWD PETSC_ARCH=arch-linux-c-opt install
make -j 4 PETSC_DIR=$PWD/../petsc-build PETSC_ARCH="" check
cd $DEPS_ROOT