1
|
#!/bin/bash
|
2
|
# Build a CCS v5 or V5 project in an automated fashion
|
3
|
#
|
4
|
# Args:
|
5
|
# build_dsp.sh projectdir projectname configs
|
6
|
#
|
7
|
# Set the exit on error status
|
8
|
set -e
|
9
|
xvfb_pid=0
|
10
|
# Error hanlder to clean up, etc...
|
11
|
function onexit() {
|
12
|
local exit_status=${1:-$?}
|
13
|
echo Exiting $0 with $exit_status
|
14
|
# if we started the Xvfb server then we should stop it
|
15
|
if [ 0 -ne $xvfb_pid ]
|
16
|
then
|
17
|
kill $xvfb_pid
|
18
|
fi
|
19
|
exit $exit_status
|
20
|
}
|
21
|
|
22
|
function die()
|
23
|
{
|
24
|
echo "$*"
|
25
|
onexit 2
|
26
|
}
|
27
|
|
28
|
# install error handler...
|
29
|
trap onexit INT TERM EXIT
|
30
|
|
31
|
# Set these vars before setting the -u option so
|
32
|
# bash doesn't complain about unbound vars..
|
33
|
#projdir=/home/mikew/mityomapl138/sw/DSP/lib/SigProc
|
34
|
#projname=SigProc
|
35
|
#config=Debug
|
36
|
projdir=$1
|
37
|
shift
|
38
|
projname=$1
|
39
|
shift
|
40
|
|
41
|
# Set "fail on unset var"
|
42
|
set -u
|
43
|
|
44
|
workspace=/tmp/workspace_$$
|
45
|
cdir=/tmp/.eclipse_$$
|
46
|
|
47
|
#eclipse="/usr/local/CCSv5/ccsv5/eclipse/eclipse -noSplash -data ${workspace} -configuration @none -user @none"
|
48
|
eclipse="/opt/ti/ccsv5/eclipse/eclipse -noSplash -data ${workspace} -configuration @none -user @none"
|
49
|
importcmd="-application com.ti.ccstudio.apps.projectImport"
|
50
|
buildcmd="-application com.ti.ccstudio.apps.projectBuild"
|
51
|
|
52
|
|
53
|
[ -x /usr/bin/Xvfb ] || die "$0 need xvfb installed"
|
54
|
(ps aux|grep Xvfb | grep -v grep > /dev/null) || (
|
55
|
/usr/bin/Xvfb :1 -screen 0 800x600x24 < /dev/null > /dev/null 2>&1 &
|
56
|
xvfb_pid=$!
|
57
|
)
|
58
|
|
59
|
export DISPLAY=:1.0
|
60
|
|
61
|
# make a blank workspace
|
62
|
rm -rf ${workspace}
|
63
|
mkdir ${workspace}
|
64
|
rm -rf ${cdir}
|
65
|
mkdir -p ${cdir}
|
66
|
|
67
|
# import / copy the project into the workspace
|
68
|
${eclipse} ${importcmd} -ccs.location ${projdir} -ccs.autoImport
|
69
|
|
70
|
# build all configurations specified
|
71
|
while (( "$#" )); do
|
72
|
${eclipse} ${buildcmd} -ccs.projects ${projname} -ccs.configuration $1
|
73
|
shift
|
74
|
done
|