Blame view

script/deploy.sh 2.25 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
96e26914   Benjamin Renard   Some fix in kerne...
9
    \n    Usage : $0 -b <build type (Debug or Release)> -c <COTS install directory> -d <DDServer host name> -p <DDServer port>
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 ###"

96e26914   Benjamin Renard   Some fix in kerne...
16
while getopts "b:c:d:p: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
22
23
24
25
26
27
28
29
30
        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

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

ab9d7e65   Benjamin Renard   Fix libraries loc...
37
38
39
40
41
42
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...
43
if [ -d "$COTS_DIR/tools/gcc/4.7.2/boost" ]; then
1dff4abb   Elena.Budnik   BOOST_ROOT => cor...
44
    BOOST_ROOT="$COTS_DIR/tools/gcc/4.7.2/boost"
ab9d7e65   Benjamin Renard   Fix libraries loc...
45
46
else
    BOOST_ROOT="/usr"
7bde1dd3   Benjamin Renard   Remove hard coded...
47
48
fi

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

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

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

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

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

6c8de11c   Benjamin Renard   Remove hard coded...
86
87
cmake -E make_directory "$SCRIPTDIR/../build"
cmake -E make_directory "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
ab9d7e65   Benjamin Renard   Fix libraries loc...
88
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 ../..
6c8de11c   Benjamin Renard   Remove hard coded...
89
90
cmake --build "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE"
make -C "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" install VERBOSE=1