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

# Setup the tools in ~/.local/bin
6
cd "$DIR/../ocarina" || exit 1
7

8 9 10 11 12
# Install Maxime's 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

13 14 15
# 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,,')"
16 17 18 19 20 21 22
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
23 24 25 26
    echo Ocarina tree is clean and already installed. Skipping Ocarina build...
    exit 0
fi

27 28
make distclean # ignore any errors here
./support/reconfig || exit 1
29
./configure --prefix="${PREFIX}" || exit 1
30 31 32 33 34 35
make || exit 1
make install

# Add Ocarina to PATH
PATH_CMD='export PATH=$PATH:'"${PREFIX}/bin"
UpdatePATH