Blame view

script/deploy.sh 2.44 KB
7bde1dd3   Benjamin Renard   Remove hard coded...
1
2
#!/bin/sh

6c8de11c   Benjamin Renard   Remove hard coded...
3
4
SCRIPT=$(readlink -f "$0")
SCRIPTDIR=$(dirname "$SCRIPT")
7bde1dd3   Benjamin Renard   Remove hard coded...
5
6
7
8

usage="
    \n ### Deploy AMDA Kernel ###
    \n
0dd5665c   Benjamin Renard   Give the possibil...
9
    \n    Usage : $0 -b <build type (Debug or Release)> -c <COTS install directory> -d <DDServer host name> -p <DDServer port> -o <options>
7bde1dd3   Benjamin Renard   Remove hard coded...
10
    \n
96e26914   Benjamin Renard   Some fix in kerne...
11
    \n            $0 -b Debug -c /opt -d amdadev.fr -p 5000
7bde1dd3   Benjamin Renard   Remove hard coded...
12
13
14
15
    \n
    \n
    \n ###"

0dd5665c   Benjamin Renard   Give the possibil...
16
while getopts "b:c:d:p:o:h" options; do
7bde1dd3   Benjamin Renard   Remove hard coded...
17
18
    case $options in
        b ) KERNEL_BUILD_TYPE=`echo $OPTARG`;;
96e26914   Benjamin Renard   Some fix in kerne...
19
        c ) COTS_DIR=`echo $OPTARG`;;
7bde1dd3   Benjamin Renard   Remove hard coded...
20
21
        d ) DDSERVER_HOST_NAME=`echo $OPTARG`;;
        p ) DDSERVER_PORT=`echo $OPTARG`;;
0dd5665c   Benjamin Renard   Give the possibil...
22
        o ) OPTION_SUP=`echo $OPTARG`;;
7bde1dd3   Benjamin Renard   Remove hard coded...
23
24
25
26
27
28
29
30
31
        h ) echo -e $usage
            exit 1;;
        \? ) echo -e $usage
            exit 1;;
        * ) echo -e $usage
            exit 1;;
    esac
done

96e26914   Benjamin Renard   Some fix in kerne...
32
if [ "$COTS_DIR" = "" ]
7bde1dd3   Benjamin Renard   Remove hard coded...
33
34
35
36
37
then
    echo -e $usage
    exit 1
fi

ab9d7e65   Benjamin Renard   Fix libraries loc...
38
39
40
41
42
43
if [ -d "$COTS_DIR/tools/gcc" ]; then
    GCC_ROOT="$COTS_DIR/tools/gcc/4.7.2/rtf"
else
    GCC_ROOT="/usr"
fi

e2ac4ed5   Benjamin Renard   Real fix for BOOS...
44
if [ -d "$COTS_DIR/tools/gcc/4.7.2/boost" ]; then
1dff4abb   Elena.Budnik   BOOST_ROOT => cor...
45
    BOOST_ROOT="$COTS_DIR/tools/gcc/4.7.2/boost"
ab9d7e65   Benjamin Renard   Fix libraries loc...
46
47
else
    BOOST_ROOT="/usr"
7bde1dd3   Benjamin Renard   Remove hard coded...
48
49
fi

96e26914   Benjamin Renard   Some fix in kerne...
50
if [ ! -d "$COTS_DIR/local/lib" ]; then
7bde1dd3   Benjamin Renard   Remove hard coded...
51
    echo -e $usage
96e26914   Benjamin Renard   Some fix in kerne...
52
    echo "[ERROR] Cannot find lib directory $COTS_DIR/local/lib"
7bde1dd3   Benjamin Renard   Remove hard coded...
53
54
55
    exit 1
fi

6c8de11c   Benjamin Renard   Remove hard coded...
56
if [ "$DDSERVER_HOST_NAME" = "" ]
7bde1dd3   Benjamin Renard   Remove hard coded...
57
58
59
60
61
then
    echo -e $usage
    exit 1
fi

6c8de11c   Benjamin Renard   Remove hard coded...
62
if [ "$DDSERVER_PORT" = "" ]
7bde1dd3   Benjamin Renard   Remove hard coded...
63
64
65
66
67
68
69
then
    echo -e $usage
    exit 1
fi

if [ "$KERNEL_BUILD_TYPE" = "Debug" ]
then
96e26914   Benjamin Renard   Some fix in kerne...
70
    echo "[INFO] Install AMDA Kernel in Debug mode"
7bde1dd3   Benjamin Renard   Remove hard coded...
71
72
elif [ "$KERNEL_BUILD_TYPE" = "Release" ]
then
96e26914   Benjamin Renard   Some fix in kerne...
73
    echo "[INFO] Install AMDA Kernel in Release mode"
7bde1dd3   Benjamin Renard   Remove hard coded...
74
75
76
77
78
else
    echo -e $usage
    exit 1
fi

96e26914   Benjamin Renard   Some fix in kerne...
79
export AMDA_COTS_DIR="$COTS_DIR"
7bde1dd3   Benjamin Renard   Remove hard coded...
80
81
export DDSERVER_HOST_NAME="$DDSERVER_HOST_NAME"
export DDSERVER_PORT="$DDSERVER_PORT"
ab9d7e65   Benjamin Renard   Fix libraries loc...
82
83
84
85
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"
7bde1dd3   Benjamin Renard   Remove hard coded...
86

0dd5665c   Benjamin Renard   Give the possibil...
87
88
89
90
91
92
93
if [ "$OPTION_SUP" = "" ]
then
    echo "[INFO] No OPTION_SUP"
else
    echo "[INFO] OPTION_SUP=${OPTION_SUP}"
fi

6c8de11c   Benjamin Renard   Remove hard coded...
94
95
cmake -E make_directory "$SCRIPTDIR/../build"
cmake -E make_directory "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
0dd5665c   Benjamin Renard   Give the possibil...
96
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 -DOPTION_SUP="$OPTION_SUP" ../..
6c8de11c   Benjamin Renard   Remove hard coded...
97
98
cmake --build "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
make -C "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" install VERBOSE=1