forked from idaholab/raven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_raven
executable file
·124 lines (105 loc) · 3.44 KB
/
build_raven
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
# fail if anything here fails
set -e
RAVEN_BUILD_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# source read ravenrc script
RAVEN_RC_SCRIPT=$RAVEN_BUILD_DIR/scripts/read_ravenrc.sh
RAVEN_RC_SCRIPT="${RAVEN_RC_SCRIPT//\\//}"
PYTHON_FMU_DIR="$RAVEN_BUILD_DIR/framework/contrib/PythonFMU"
PYTHON_FMU_DIR="${PYTHON_FMU_DIR//\\//}"
source $RAVEN_RC_SCRIPT
echo Making RAVEN ...
# defaults
MAKE_ARGS=" "
LIBS_MODE=0 # 0 is "create", 1 is "load"
#### FUTURE WORK:
#### combine "make" and "establish_conda_env.sh" into one installation command
ECE_ARGS=" "
# check installation manager in ravenrc if present
export RAVEN_INSTALLATION_MANAGER=$(read_ravenrc "INSTALLATION_MANAGER")
if [[ "$RAVEN_INSTALLATION_MANAGER" == "PIP" ]];
then
LIBS_MODE=2
else
# conda
LIBS_MODE=1
fi
# read arguments
while test $# -gt 0
do
case "$1" in
--coverage)
MAKE_ARGS="${MAKE_ARGS} coverage=true graceful=true"
LIBS_MODE=1
;;
--jobs) MAKE_ARGS="-j $1 ${MAKE_ARGS}"; ;;
--skip-conda)
LIBS_MODE=2
# --help) ECE_ARGS="${ECE_ARGS} --help"; ;;
# --optional) ECE_ARGS="${ECE_ARGS} --optional"; ;;
# --no-clean) ECE_ARGS="${ECE_ARGS} --no-clean"; ;;
# --conda-defs)
# shift
# ECE_ARGS="${ECE_ARGS} --conda-defs $1"
# ;;
# --raven-libs-name)
# shift
# export RAVEN_LIBS_NAME="$1"
# ;;
esac
shift
done
#### END FUTURE WORK
# clean up to assure library matching
echo Cleaning old build ...
${RAVEN_BUILD_DIR}/clean_raven
if [[ $LIBS_MODE == 0 ]]; then
# this mode can not be called currently
#### FUTURE WORK:
# clear .ravenrc
#if [[ -f "$RAVEN_BUILD_DIR/.ravenrc" ]]; then
# rm "$RAVEN_BUILD_DIR/.ravenrc"
#fi
# combining install script for python libs and make?
#echo Establishing Python libraries ...
#. scripts/establish_conda_env.sh --install ${ECE_ARGS}
# identify python
#echo python: `which python`
#### END FUTURE WORK
## remove when FUTURE WORK is in place
echo Establishing Python libraries ...
. scripts/establish_conda_env.sh --load ${ECE_ARGS}
elif [[ $LIBS_MODE == 1 ]]; then
echo Establishing Python libraries ...
. scripts/establish_conda_env.sh --load ${ECE_ARGS}
elif [[ $LIBS_MODE == 2 ]]; then
echo Establishing Python libraries ...
. scripts/establish_conda_env.sh --load ${ECE_ARGS} --installation-manager PIP
else
echo No Conda Python libraries ...
fi
echo Making ...
# make
PYTHON_COMMAND=${PYTHON_COMMAND:=python}
CROW_DIR=$RAVEN_BUILD_DIR/crow
unset CXX CC
#Conda sets too old of a MACOSX_DEPLOYMENT_TARGET
if test `uname` = Darwin; then
MACOSX_DEPLOYMENT_TARGET=10.12;
export MACOSX_DEPLOYMENT_TARGET;
fi
PIP_COMMAND=pip3
(cd $RAVEN_BUILD_DIR && ${PIP_COMMAND} --verbose install . --upgrade --target ./install)
(cd $PYTHON_FMU_DIR && ./build_pythonfmu || echo PythonFMU build failed)
if [ ! -z "$RAVEN_SIGNATURE" ];
then
#This is to allow the code to be signed on mac os computers.
# It requires a signature (possibly self signed) to be used.
# Creating a signature is discussed at:
# https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
# RAVEN_SIGNATURE can be added to .ravenrc
echo "... Signing code with '$RAVEN_SIGNATURE' ..."
(cd $CROW_DIR/install/crow_modules && pwd && codesign -s "$RAVEN_SIGNATURE" -v *.so)
(cd $RAVEN_BUILD_DIR/framework/contrib/AMSC && pwd && codesign -s "$RAVEN_SIGNATURE" -v *.so)
fi
echo ... done!