forked from antmicro/emul8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·97 lines (82 loc) · 1.68 KB
/
build.sh
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
91
92
93
94
95
96
97
#!/bin/bash
#
# Emulator build script
#
# Copyright (c) Antmicro
# Copyright (c) Realtime Embedded
#
set -e
if [ -z "$ROOT_PATH" -a -x "$(command -v realpath)" ]; then
# this is to support running emul8 from external directory
ROOT_PATH="`dirname \`realpath $0\``"
fi
TARGET="./target/Emul8.sln"
export CLEAN=false
export INSTALL=false
export DEBUG=false
export VERBOSE=false
while getopts ":cidv" opt; do
case $opt in
c)
CLEAN=true
;;
i)
INSTALL=true
;;
d)
DEBUG=true
;;
v)
VERBOSE=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
if [ ! -f "target/Emul8.sln" ]
then
./bootstrap.sh
fi
if ! $CLEAN
then
pushd ${ROOT_PATH:=.}/Tools/scripts > /dev/null
./check_weak_implementations.sh
popd > /dev/null
fi
# Build CCTask in Release configuration
xbuild /p:Configuration=Release $ROOT_PATH/External/cctask/CCTask.sln > /dev/null
if $CLEAN
then
xbuild /t:Clean /p:Configuration=Debug $TARGET
xbuild /t:Clean /p:Configuration=Release $TARGET
rm -fr $ROOT_PATH/output
exit 0
fi
if $DEBUG
then
CONFIGURATION="Debug"
else
CONFIGURATION="Release"
fi
PARAMS=" /p:Configuration=$CONFIGURATION"
if $VERBOSE
then
PARAMS="$PARAMS /verbosity:detailed"
fi
retries=5
while [ \( ${result_code:-134} -eq 134 \) -a \( $retries -ne 0 \) ]
do
set +e
xbuild /p:OutputPath=$PWD/output/$CONFIGURATION $PARAMS $TARGET $ADDITIONAL_PARAM
result_code=$?
set -e
retries=$((retries-1))
done
if $INSTALL
then
INSTALLATION_PATH="/usr/local/bin/emul8"
echo "Installing Emul8 in: $INSTALLATION_PATH"
sudo ln -sf $ROOT_PATH/run.sh $INSTALLATION_PATH
fi
exit $result_code