-
Notifications
You must be signed in to change notification settings - Fork 8
/
build_all
executable file
·254 lines (236 loc) · 7.23 KB
/
build_all
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#!/bin/sh
#
# @file buildall.sh
# @brief rtmtools build script
# @author Noriaki Ando <n-ando@aist.go.jp>
#
# update:
# cerate:Sep/11/2008
#
# * How to build rtmtools
#
# ** Required environment
#
# The following development environment and tools are required to
# build rtmtools.
#
# - jdk
# - ant
# - Eclipse SDK (3.4 or later is required.)
#
# ** Before build tools
#
# Please edit "version" text to set version number of the tools. This
# is a kind of bash script.
#
# Example:
# -------
# VERSION=1.1.0
# PROJECT_VERSION=${VERSION}.rc7v$(date +%Y%m%d)
#
# ** Environment variables
#
# To build rtmtools, some environmental variables can be set. In most
# case, these variables are automatically set.
#
# - ECLIPSE_HOME: A directory path to an Eclipse SDK. Under this
# directory, .eclipseproduct, eclipse.ini, plugins and
# eclipse executable should exist. If this
# env.variable is not set, this script tries to search
# eclipse directory under some directories that is set
# in a env.variable ECLIPSE_DIRS written in the head
# of this script.
#
# - JAVA_HOME: A directory JDK installed. If this variable is not set,
# this script tries to estimate JDK directory to
# resolve symbolic link of javac executable.
#
# - VERSION: A simple version number for the tools like 1.1.1. This is
# used for actual bundles' version number with
# PROJECT_VERSION number.
#
# - PROJECT_VERSION: Project version number is full version string
# with simple version and suffix like
# rc120121212. This version string is used actual jar
# file name.
#
# - JARDIR: A directory to store jar files. Default directory is "jar".
# This directory is temporary jar files store place.
#
# - DISTDIR: A directory to be archived for distribution package.
# This directory name becomes archive package name.
# Default name is openrtm-x.y.z. x, y, z are version
# number which is defined in version text file.
#
#---------------------------------------------------------------------------
# Global variables
#---------------------------------------------------------------------------
# Default build taget
TARGET="buildAll"
# Default
JARDIR_DEFAULT="jar"
# target projects
PROJECTS="jp.go.aist.rtm.toolscommon.profiles
jp.go.aist.rtm.toolscommon.profiles.nl1
jp.go.aist.rtm.toolscommon
jp.go.aist.rtm.toolscommon.nl1
jp.go.aist.rtm.rtcbuilder
jp.go.aist.rtm.rtcbuilder.nl1
jp.go.aist.rtm.rtcbuilder.java
jp.go.aist.rtm.rtcbuilder.python
jp.go.aist.rtm.rtcbuilder.lua
jp.go.aist.rtm.repositoryView
jp.go.aist.rtm.repositoryView.nl1
jp.go.aist.rtm.nameserviceview
jp.go.aist.rtm.nameserviceview.nl1
jp.go.aist.rtm.systemeditor
jp.go.aist.rtm.systemeditor.nl1"
# Eclipse search directories
ECLIPSE_DIRS="$PWD/../eclipse $HOME/eclipse $HOME /usr/lib/ /usr/share"
#============================================================
# functions
#============================================================
#------------------------------------------------------------
# getopt
#
# This function gets command line options
# ------------------------------------------------------------
getopt()
{
if test $# = 1 ; then
arg=$1
if test "x$arg" = "xclean" ; then
TARGET=$1
return 0
fi
if test "x$arg" = "xrevert" ; then
./build_plugins revert
./build_features revert
exit 0
fi
fi
}
#------------------------------------------------------------
# get_version
#
# This function gets version number and project version string
# from version text file.
# ------------------------------------------------------------
get_version()
{
if test "x$VERSION" = "x" || test "x$PROJECT_VERSION" = "x" ; then
echo "Environment variable VERSION/PROJECT_VERSION is not set."
echo "Getting from ./version text."
. ./version
fi
export VERSION
export PROJECT_VERSION
if test "x$DISTDIR" = "x" ; then
DISTDIR=openrtp-$VERSION
fi
if test "x$JARDIR" = "x" ; then
JARDIR=$JARDIR_DEFAULT
fi
if test -f version.txt ; then
rm -f version.txt
fi
echo "VERSION=$VERSION" >> version.txt
echo "PROJECT_VERSION=$PROJECT_VERSION" >> version.txt
}
#------------------------------------------------------------
# find_eclipsehome
#
# This function checks ECLIPSE_HOME env variable and if it is
# not set, it searches an eclipse directory under ECLIPSE_DIRS,
# and set ECLIPSE_HOME env variable.
# ------------------------------------------------------------
find_eclipsehome()
{
if test ! "x$ECLIPSE_HOME" = "x" ; then
if test -d $ECLIPSE_HOME ; then
return 0
fi
echo "ECLIPSE_HOME $ECLIPSE_HOME does not exist."
fi
echo "Environment variable ECLIPSE_HOME is not set. Seaching..."
for d in $ECLIPSE_DIRS ; do
if test ! -d $d ; then
continue
fi
tmp=`find -L $d -name .eclipseproduct`
if test "x$tmp" = "x" ; then
continue
fi
for e in $tmp ; do
edir=`dirname $e`
if test -f $edir/eclipse.ini && test -d $edir/plugins ; then
export ECLIPSE_HOME="$edir"
echo "eclipse found. set ECLIPSE_HOME=$ECLIPSE_HOME."
return 0
fi
done
done
echo "eclipse not found. Please install eclipse and set ECLIPSE_HOME."
exit 1
}
#------------------------------------------------------------
# find_javahome
#
# This function estimate JAVA_HOME from javac, which usually
# is a symbolic link to $JAVA_HOME/bin/javac.
#------------------------------------------------------------
find_javahome()
{
if test ! "x$JAVA_HOME" = "x" ; then
if test -d $JAVA_HOME && test -f $JAVA_HOME/bin/javac ; then
return 0
fi
echo "JDK cannot be found under JAVA_HOME: $JAVA_HOME"
fi
echo "Valid Environment variable JAVA_HOME is not set. Searching..."
tmp=`readlink -e $(which javac)`
jdk_path=`dirname $tmp | sed 's/\/bin$//'`
if test "x$jdk_path" = "x" ; then
echo "JDK not found. Please install JDK and set JAVA_HOME."
exit 1
fi
export JAVA_HOME=$jdk_path
return 0
}
#==============================
# main
#==============================
export LC_ALL=C
cd `dirname $0`
getopt $*
get_version
find_eclipsehome
find_javahome
if test "x$TARGET" = "xclean" ; then
./build_plugins clean
if test $? -ne 0 ; then
echo "[ERROR] cleaning plugins failed. Aborting..."
exit 1
fi
./build_features clean
if test $? -ne 0 ; then
echo "[ERROR] cleaning features failed. Aborting..."
exit 1
fi
echo "[OK] cleaning plugins/features successfully done."
exit 0
else
./build_plugins
if test $? -ne 0 ; then
echo "[ERROR] build plugins failed. Aborting..."
exit 1
fi
./build_features
if test $? -ne 0 ; then
echo "[ERROR] build features failed. Aborting..."
exit 1
fi
echo "[OK] building plugins/features successfully done."
fi
exit 0
# end of script