40_ocarina.sh 1.74 KB
Newer Older
1 2
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3
. "${DIR}/common.sh"
4

5 6 7 8 9 10 11 12 13
function overWriteAADLcomponents()
{
    # Install Maxime's customized version of available deployment targets
    echo Installing customized version of available deployment targets...
    cat ../misc/supported-platforms/ocarina_components.aadl  | \
        sed "s,/home/taste/tool-inst,$(taste-config --prefix)," > \
        "${PREFIX}/share/ocarina/AADLv2/ocarina_components.aadl"
}

14
# Setup the tools in ~/.local/bin
15
cd "$DIR/../ocarina" || exit 1
16 17 18 19

# Skip Ocarina building if tree is clean and version is identical
HEAD="$(git log --oneline | head -1 | cut -d' ' -f1)"
VERSION_INSTALLED="$(ocarina -v 2>&1 | grep ^Oca | awk '{print $NF}' | sed 's,),,;s,r,,')"
20 21 22 23 24 25 26
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
    TREE_DIRTY=0
else
    TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
27
    echo Ocarina tree is clean and already installed. Skipping Ocarina build...
28
    overWriteAADLcomponents
29 30 31
    exit 0
fi

32 33
make distclean # ignore any errors here
./support/reconfig || exit 1
34
./configure --enable-python --enable-shared --prefix="${PREFIX}" || exit 1
35 36 37
make || exit 1
make install

38 39
overWriteAADLcomponents

40 41 42
# Add Ocarina to PATH
PATH_CMD='export PATH=$PATH:'"${PREFIX}/bin"
UpdatePATH
43 44 45 46

# Add Ocarina Python-binding libraries to LD_LIBRARY_PATH
PATH_CMD='export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'"${PREFIX}/lib"
UpdatePATH
47 48 49 50

# Add Ocarina env var necessary for Python mappings to function
PATH_CMD="export OCARINA_PATH=`ocarina-config --prefix`"
UpdatePATH
51 52 53 54

# Add Ocarina-specific PYTHONPATH dependencies
PATH_CMD='export PYTHONPATH=$OCARINA_PATH/include/ocarina/runtime/python:$OCARINA_PATH/lib:$PYTHONPATH'
UpdatePATH