diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
commit | ede215cf93ba81c963ae62d665d0f32c9407551c (patch) | |
tree | 4a6dc80f259bccb8ff8b76d31e6cc8794bd97a2b /scripts/setup.sh | |
download | eclipse-poky-kepler-ede215cf93ba81c963ae62d665d0f32c9407551c.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'scripts/setup.sh')
-rwxr-xr-x | scripts/setup.sh | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..bb929b9 --- /dev/null +++ b/scripts/setup.sh | |||
@@ -0,0 +1,236 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #setup eclipse building environment for Indigo. | ||
4 | #comment out the following line if you want to using your own http proxy setting for eclipse update site | ||
5 | #PROXY=http://proxy.jf.intel.com:911 | ||
6 | |||
7 | err_exit() | ||
8 | { | ||
9 | echo "[FAILED $1]$2" | ||
10 | exit $1 | ||
11 | } | ||
12 | |||
13 | curdir=`pwd` | ||
14 | |||
15 | uname_s=`uname -s` | ||
16 | uname_m=`uname -m` | ||
17 | case ${uname_s}${uname_m} in | ||
18 | Linuxppc*) ep_arch=linux-gtk-ppc | ||
19 | cdt_arch=linux.ppc | ||
20 | ;; | ||
21 | Linuxx86_64*) ep_arch=linux-gtk-x86_64 | ||
22 | cdt_arch=linux.x86_64 | ||
23 | ;; | ||
24 | Linuxi*86) ep_arch=linux-gtk | ||
25 | cdt_arch=linux.x86 | ||
26 | ;; | ||
27 | *) | ||
28 | echo "Unknown ${uname_s}${uname_m}" | ||
29 | exit 1 | ||
30 | ;; | ||
31 | esac | ||
32 | |||
33 | #parsing proxy URLS | ||
34 | url=${PROXY} | ||
35 | if [ "x$url" != "x" ]; then | ||
36 | proto=`echo $url | grep :// | sed -e 's,^\(.*://\).*,\1,g'` | ||
37 | url=`echo $url | sed s,$proto,,g` | ||
38 | userpass=`echo $url | grep @ | cut -d@ -f1` | ||
39 | user=`echo $userpass | cut -d: -f1` | ||
40 | pass=`echo $userpass | grep : | cut -d: -f2` | ||
41 | url=`echo $url | sed s,$userpass@,,g` | ||
42 | host=`echo $url | cut -d: -f1` | ||
43 | port=`echo $url | cut -d: -f2 | sed -e 's,[^0-9],,g'` | ||
44 | [ "x$host" = "x" ] && err_exit 1 "Undefined proxy host" | ||
45 | PROXY_PARAM="-Dhttp.proxySet=true -Dhttp.proxyHost=$host" | ||
46 | [ "x$port" != "x" ] && PROXY_PARAM="${PROXY_PARAM} -Dhttp.proxyPort=$port" | ||
47 | fi | ||
48 | |||
49 | |||
50 | # prepare the base Eclipse installation in folder "eclipse" | ||
51 | ep_rel="R-" | ||
52 | ep_ver="4.3" | ||
53 | ep_date="-201306052000" | ||
54 | P2_disabled=false | ||
55 | P2_no_dropins=false | ||
56 | if [ ! -f eclipse/plugins/3.102.0.v20130605-1539.jar ]; then | ||
57 | curdir2=`pwd` | ||
58 | if [ ! -d eclipse -o -h eclipse ]; then | ||
59 | if [ -d eclipse-${ep_ver}-${ep_arch} ]; then | ||
60 | rm -rf eclipse-${ep_ver}-${ep_arch} | ||
61 | fi | ||
62 | mkdir eclipse-${ep_ver}-${ep_arch} | ||
63 | cd eclipse-${ep_ver}-${ep_arch} | ||
64 | else | ||
65 | rm -rf eclipse | ||
66 | fi | ||
67 | # Eclipse SDK: Need the SDK so we can link into docs | ||
68 | echo "Getting Eclipse SDK..." | ||
69 | #wget "http://download.eclipse.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
70 | #The eclipse site has moments where it is overloaded. Maintaining our own mirror solves this. | ||
71 | wget "http://downloads.yoctoproject.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
72 | tar xfz eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz || err_exit $? "extracting Eclipse SDK failed" | ||
73 | rm eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz | ||
74 | cd "${curdir2}" | ||
75 | if [ ! -d eclipse -o -h eclipse ]; then | ||
76 | if [ -e eclipse ]; then | ||
77 | rm eclipse | ||
78 | fi | ||
79 | ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse | ||
80 | fi | ||
81 | fi | ||
82 | if [ ! -f eclipse/startup.jar ]; then | ||
83 | curdir2=`pwd` | ||
84 | cd eclipse/plugins | ||
85 | if [ -h ../startup.jar ]; then | ||
86 | rm ../startup.jar | ||
87 | fi | ||
88 | LAUNCHER="`ls org.eclipse.equinox.launcher_*.jar | sort | tail -1`" | ||
89 | if [ "x${LAUNCHER}" != "x" ]; then | ||
90 | echo "eclipse LAUNCHER=${LAUNCHER}" | ||
91 | ln -s plugins/${LAUNCHER} ../startup.jar | ||
92 | else | ||
93 | echo "Eclipse: NO startup.jar LAUNCHER FOUND!" | ||
94 | fi | ||
95 | cd ${curdir2} | ||
96 | fi | ||
97 | |||
98 | LAUNCHER="eclipse/startup.jar" | ||
99 | |||
100 | get_version() | ||
101 | { | ||
102 | #$1: repository_url | ||
103 | #$2: featureId | ||
104 | #$3: 'all' or 'max' or 'min', 'max' if not specified | ||
105 | local remote_vers="`java ${PROXY_PARAM} \ | ||
106 | -jar ${LAUNCHER} \ | ||
107 | -application org.eclipse.equinox.p2.director \ | ||
108 | -destination ${curdir}/eclipse \ | ||
109 | -profile SDKProfile \ | ||
110 | -repository $1 \ | ||
111 | -list $2\ | ||
112 | | awk 'BEGIN { FS="=" } { print $2 }'`" | ||
113 | |||
114 | #find larget remote vers | ||
115 | local remote_ver="`echo ${remote_vers} | cut -d ' ' -f1`" | ||
116 | case $3 in | ||
117 | all) | ||
118 | remote_ver=${remote_vers} | ||
119 | ;; | ||
120 | min) | ||
121 | for i in ${remote_vers}; do | ||
122 | [ "${remote_ver}" \> "$i" ] && remote_ver="$i" | ||
123 | done | ||
124 | ;; | ||
125 | *) | ||
126 | for i in ${remote_vers}; do | ||
127 | [ "${remote_ver}" \< "$i" ] && remote_ver="$i" | ||
128 | done | ||
129 | ;; | ||
130 | esac | ||
131 | |||
132 | echo ${remote_ver} | ||
133 | } | ||
134 | |||
135 | check_local_version() | ||
136 | { | ||
137 | # $1 unitId | ||
138 | # $2 min version | ||
139 | # $3 max version (optional) | ||
140 | version="`get_version file:///${curdir}/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile $1`" | ||
141 | [ "$version" \< "$2" ] && return 1 | ||
142 | if [ "x$3" != "x" ]; then | ||
143 | [ "$version" \> "$3" ] && return -1 | ||
144 | fi | ||
145 | return 0 | ||
146 | } | ||
147 | |||
148 | update_feature_remote() | ||
149 | { | ||
150 | # install a feature of with version requirement [min, max) | ||
151 | #$1: reporsitory url | ||
152 | #$2: featureId | ||
153 | #$3: min version | ||
154 | #$4: max version(optional) | ||
155 | [ $# -lt 3 ] && err_exit 1 "update_feature_remote: invalid parameters, $*" | ||
156 | check_local_version $2 $3 $4 && echo "skip installed feature $2" && return 0 | ||
157 | local installIU="" | ||
158 | if [ "x$4" != "x" ]; then | ||
159 | #has max version requirement | ||
160 | for i in "`get_version $1 $2 'all'`"; do | ||
161 | if [ "$i" \> "$3" ] || [ "$i" = "$3" ] && [ "$i" \< "$4" ]; then | ||
162 | [ "$i" \> "$installIU" ] && installIU=$i | ||
163 | fi | ||
164 | done | ||
165 | else | ||
166 | #only has minimum version requirement | ||
167 | local max_remote_ver="`get_version $1 $2 'max'`" | ||
168 | [ "$max_remote_ver" \> "$3" ] || [ "$max_remote_ver" = "$3" ] && installIU=$max_remote_ver | ||
169 | fi | ||
170 | |||
171 | [ "x$installIU" = "x" ] && err_exit 1 "Can NOT find candidates of $2 version($3, $4) at $1!" | ||
172 | installIU="$2/$installIU" | ||
173 | echo "try to install $installIU ..." | ||
174 | java ${PROXY_PARAM} -jar ${LAUNCHER} \ | ||
175 | -application org.eclipse.equinox.p2.director \ | ||
176 | -destination ${curdir}/eclipse \ | ||
177 | -profile SDKProfile \ | ||
178 | -repository $1 \ | ||
179 | -installIU ${installIU} || err_exit $? "installing ${installIU} failed" | ||
180 | } | ||
181 | |||
182 | #Eclipse Update Site | ||
183 | MAIN_UPDATE_SITE="http://download.eclipse.org/releases/kepler" | ||
184 | # The main eclipse download site is unreliable at times. For now, we're going to | ||
185 | # maintain a mirror of just what we need. | ||
186 | #MAIN_UPDATE_SITE="http://downloads.yoctoproject.org/eclipse/juno/ftp.osuosl.org/pub/eclipse/releases/juno" | ||
187 | |||
188 | UPDATE_SITE="${MAIN_UPDATE_SITE}" | ||
189 | |||
190 | #CDT related | ||
191 | CDTFEAT="8.2.0" | ||
192 | echo "Installing CDT..." | ||
193 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.feature.group ${CDTFEAT} | ||
194 | CDTREMOTEVER="6.2.0" | ||
195 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER} | ||
196 | |||
197 | #RSE SDK | ||
198 | RSEVER="3.5.0" | ||
199 | #TCFVER="1.0.0" | ||
200 | TMVER="3.3.1" | ||
201 | echo "Installing RSE/TCF/TM related component..." | ||
202 | update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER} | ||
203 | #update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER} | ||
204 | update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER} | ||
205 | |||
206 | #AUTOTOOL | ||
207 | ATVER="3.2.0" | ||
208 | echo "Install AutoTool..." | ||
209 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER} | ||
210 | |||
211 | #Lttng2 | ||
212 | LTTNGREL="2.0.0" | ||
213 | echo "Install Lttng..." | ||
214 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.feature.group ${LTTNGREL} | ||
215 | |||
216 | #PTP RDT | ||
217 | PTPVER="7.0.0" | ||
218 | RDTVER="7.0.0" | ||
219 | |||
220 | update_feature_remote ${UPDATE_SITE} org.eclipse.ptp.feature.group ${PTPVER} | ||
221 | update_feature_remote ${UPDATE_SITE} org.eclipse.ptp.rdt.feature.group ${RDTVER} | ||
222 | |||
223 | #LTTng Kernel Analysis | ||
224 | LTTNGKAVER="2.0.0" | ||
225 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER} | ||
226 | |||
227 | #C/C++ GDB Hardware Debugging | ||
228 | GDBHARDVER="8.3.0" | ||
229 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.debug.gdbjtag.feature.group ${GDBHARDVER} | ||
230 | |||
231 | echo "" | ||
232 | echo "Your build environment is successfully created." | ||
233 | echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh <branch name> <release name> to build" | ||
234 | echo "" | ||
235 | |||
236 | exit 0 | ||