deploy.sh
2.25 KB
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
#!/bin/sh
SCRIPT=$(readlink -f "$0")
SCRIPTDIR=$(dirname "$SCRIPT")
usage="
\n ### Deploy AMDA Kernel ###
\n
\n Usage : $0 -b <build type (Debug or Release)> -c <COTS install directory> -d <DDServer host name> -p <DDServer port>
\n
\n $0 -b Debug -c /opt -d amdadev.fr -p 5000
\n
\n
\n ###"
while getopts "b:c:d:p:h" options; do
case $options in
b ) KERNEL_BUILD_TYPE=`echo $OPTARG`;;
c ) COTS_DIR=`echo $OPTARG`;;
d ) DDSERVER_HOST_NAME=`echo $OPTARG`;;
p ) DDSERVER_PORT=`echo $OPTARG`;;
h ) echo -e $usage
exit 1;;
\? ) echo -e $usage
exit 1;;
* ) echo -e $usage
exit 1;;
esac
done
if [ "$COTS_DIR" = "" ]
then
echo -e $usage
exit 1
fi
if [ -d "$COTS_DIR/tools/gcc" ]; then
GCC_ROOT="$COTS_DIR/tools/gcc/4.7.2/rtf"
else
GCC_ROOT="/usr"
fi
if [ -d "$COTS_DIR/tools/gcc/4.7.2/boost" ]; then
BOOST_ROOT="$COTS_DIR/tools/gcc/4.7.2/boost"
else
BOOST_ROOT="/usr"
fi
if [ ! -d "$COTS_DIR/local/lib" ]; then
echo -e $usage
echo "[ERROR] Cannot find lib directory $COTS_DIR/local/lib"
exit 1
fi
if [ "$DDSERVER_HOST_NAME" = "" ]
then
echo -e $usage
exit 1
fi
if [ "$DDSERVER_PORT" = "" ]
then
echo -e $usage
exit 1
fi
if [ "$KERNEL_BUILD_TYPE" = "Debug" ]
then
echo "[INFO] Install AMDA Kernel in Debug mode"
elif [ "$KERNEL_BUILD_TYPE" = "Release" ]
then
echo "[INFO] Install AMDA Kernel in Release mode"
else
echo -e $usage
exit 1
fi
export AMDA_COTS_DIR="$COTS_DIR"
export DDSERVER_HOST_NAME="$DDSERVER_HOST_NAME"
export DDSERVER_PORT="$DDSERVER_PORT"
export GCC_ROOT="$GCC_ROOT"
export BOOST_ROOT="$BOOST_ROOT"
export LD_LIBRARY_PATH="$COTS_DIR/local/lib:$GCC_ROOT/lib64:$GCC_ROOT/lib:$LD_LIBRARY_PATH"
export PATH="$COTS_DIR/local/bin:$GCC_ROOT/bin:$PATH"
cmake -E make_directory "$SCRIPTDIR/../build"
cmake -E make_directory "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
cmake -E chdir "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" cmake -DCMAKE_C_COMPILER="$GCC_ROOT/bin/gcc" -DCMAKE_CXX_COMPILER="$GCC_ROOT/bin/g++" -DCMAKE_BUILD_TYPE=$KERNEL_BUILD_TYPE ../..
cmake --build "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
make -C "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" install VERBOSE=1