|
| 1 | +#!/bin/bash |
| 2 | +CONFMAKE=$1 |
| 3 | +CLEAN_SUNDIALS=$2 |
| 4 | + |
| 5 | +dir=`pwd` |
| 6 | + |
| 7 | +echo "CLEAN_SUNDIALS = $CLEAN_SUNDIALS" |
| 8 | +if [ "$CLEAN_SUNDIALS" = true ]; then |
| 9 | + echo "Removing sundials library ..." |
| 10 | + rm -r $FIREMODELS/libs/sundials |
| 11 | + rm -r $FIREMODELS/sundials/BUILDDIR |
| 12 | +fi |
| 13 | + |
| 14 | +echo "Checking for sundials library..." |
| 15 | + |
| 16 | +if [ -d "$FIREMODELS/libs/sundials" ]; then |
| 17 | + echo "Sundials library exists. Skipping sundials build." |
| 18 | + # List all directories under $FIREMODELS/libs/sundials |
| 19 | + sundials_lib_dir=$(ls -d $FIREMODELS/libs/sundials/*/) |
| 20 | + # Extract the version part (removes the leading path) |
| 21 | + SUNDIALS_VERSION=$(basename $sundials_lib_dir) |
| 22 | + export SUNDIALS_HOME=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION |
| 23 | + echo "Sundials library:" $FIREMODELS/libs/sundials/$SUNDIALS_VERSION |
| 24 | + return 0 |
| 25 | +else |
| 26 | + echo "Sundials library does not exist." |
| 27 | +fi |
| 28 | + |
| 29 | +echo "Checking for sundials repository..." |
| 30 | + |
| 31 | +if [ -d "$FIREMODELS/sundials" ]; then |
| 32 | + echo "Sundials repository exists. Building sundials library." |
| 33 | + mkdir $FIREMODELS/sundials/BUILDDIR |
| 34 | + cd $FIREMODELS/sundials/BUILDDIR |
| 35 | + |
| 36 | + echo "Creating library directry..." |
| 37 | + export SUNDIALS_VERSION=$(git describe) |
| 38 | + mkdir $FIREMODELS/libs/sundials/$SUNDIALS_VERSION |
| 39 | + |
| 40 | + echo "Cleaning sundials repository..." |
| 41 | + rm -r * |
| 42 | + cp $FIREMODELS/fds/Build/Scripts/SUNDIALS/$CONFMAKE . |
| 43 | + ./$CONFMAKE |
| 44 | + |
| 45 | + cd $dir |
| 46 | + export SUNDIALS_HOME=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION |
| 47 | + echo "Sundials library:" $FIREMODELS/libs/sundials/$SUNDIALS_VERSION |
| 48 | + return 0 |
| 49 | +else |
| 50 | + echo "Sundials repository does not exist." |
| 51 | +fi |
0 commit comments