diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:36:50 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 15:25:03 +0100 |
commit | 41ac47d732eed8392d60d0f6773e5a279d49b999 (patch) | |
tree | cf19d099db9cfdb8d73aa21c31e7aa1cc86ff860 /scripts/setup.sh | |
download | eclipse-poky-juno-41ac47d732eed8392d60d0f6773e5a279d49b999.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'scripts/setup.sh')
-rwxr-xr-x | scripts/setup.sh | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..4e08ea2 --- /dev/null +++ b/scripts/setup.sh | |||
@@ -0,0 +1,226 @@ | |||
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.2.2" | ||
53 | ep_date="-201302041200" | ||
54 | P2_disabled=false | ||
55 | P2_no_dropins=false | ||
56 | if [ ! -f eclipse/plugins/org.eclipse.swt_3.100.0.v4233d.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 | |||
70 | wget "http://download.eclipse.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
71 | # The eclipse site has moments where it is overloaded. Maintaining our own mirror solves this. | ||
72 | #wget "http://downloads.yoctoproject.org/eclipse/downloads/drops4/${ep_rel}${ep_ver}${ep_date}/eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz" | ||
73 | tar xfz eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz || err_exit $? "extracting Eclipse SDK failed" | ||
74 | rm eclipse-SDK-${ep_ver}-${ep_arch}.tar.gz | ||
75 | cd "${curdir2}" | ||
76 | if [ ! -d eclipse -o -h eclipse ]; then | ||
77 | if [ -e eclipse ]; then | ||
78 | rm eclipse | ||
79 | fi | ||
80 | ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse | ||
81 | fi | ||
82 | fi | ||
83 | if [ ! -f eclipse/startup.jar ]; then | ||
84 | curdir2=`pwd` | ||
85 | cd eclipse/plugins | ||
86 | if [ -h ../startup.jar ]; then | ||
87 | rm ../startup.jar | ||
88 | fi | ||
89 | LAUNCHER="`ls org.eclipse.equinox.launcher_*.jar | sort | tail -1`" | ||
90 | if [ "x${LAUNCHER}" != "x" ]; then | ||
91 | echo "eclipse LAUNCHER=${LAUNCHER}" | ||
92 | ln -s plugins/${LAUNCHER} ../startup.jar | ||
93 | else | ||
94 | echo "Eclipse: NO startup.jar LAUNCHER FOUND!" | ||
95 | fi | ||
96 | cd ${curdir2} | ||
97 | fi | ||
98 | |||
99 | LAUNCHER="eclipse/startup.jar" | ||
100 | |||
101 | get_version() | ||
102 | { | ||
103 | #$1: repository_url | ||
104 | #$2: featureId | ||
105 | #$3: 'all' or 'max' or 'min', 'max' if not specified | ||
106 | local remote_vers="`java ${PROXY_PARAM} \ | ||
107 | -jar ${LAUNCHER} \ | ||
108 | -application org.eclipse.equinox.p2.director \ | ||
109 | -destination ${curdir}/eclipse \ | ||
110 | -profile SDKProfile \ | ||
111 | -repository $1 \ | ||
112 | -list $2\ | ||
113 | | awk 'BEGIN { FS="=" } { print $2 }'`" | ||
114 | |||
115 | #find larget remote vers | ||
116 | local remote_ver="`echo ${remote_vers} | cut -d ' ' -f1`" | ||
117 | case $3 in | ||
118 | all) | ||
119 | remote_ver=${remote_vers} | ||
120 | ;; | ||
121 | min) | ||
122 | for i in ${remote_vers}; do | ||
123 | [ "${remote_ver}" \> "$i" ] && remote_ver="$i" | ||
124 | done | ||
125 | ;; | ||
126 | *) | ||
127 | for i in ${remote_vers}; do | ||
128 | [ "${remote_ver}" \< "$i" ] && remote_ver="$i" | ||
129 | done | ||
130 | ;; | ||
131 | esac | ||
132 | |||
133 | echo ${remote_ver} | ||
134 | } | ||
135 | |||
136 | check_local_version() | ||
137 | { | ||
138 | # $1 unitId | ||
139 | # $2 min version | ||
140 | # $3 max version (optional) | ||
141 | version="`get_version file:///${curdir}/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile $1`" | ||
142 | [ "$version" \< "$2" ] && return 1 | ||
143 | if [ "x$3" != "x" ]; then | ||
144 | [ "$version" \> "$3" ] && return -1 | ||
145 | fi | ||
146 | return 0 | ||
147 | } | ||
148 | |||
149 | update_feature_remote() | ||
150 | { | ||
151 | # install a feature of with version requirement [min, max) | ||
152 | #$1: reporsitory url | ||
153 | #$2: featureId | ||
154 | #$3: min version | ||
155 | #$4: max version(optional) | ||
156 | [ $# -lt 3 ] && err_exit 1 "update_feature_remote: invalid parameters, $*" | ||
157 | check_local_version $2 $3 $4 && echo "skip installed feature $2" && return 0 | ||
158 | local installIU="" | ||
159 | if [ "x$4" != "x" ]; then | ||
160 | #has max version requirement | ||
161 | for i in "`get_version $1 $2 'all'`"; do | ||
162 | if [ "$i" \> "$3" ] || [ "$i" = "$3" ] && [ "$i" \< "$4" ]; then | ||
163 | [ "$i" \> "$installIU" ] && installIU=$i | ||
164 | fi | ||
165 | done | ||
166 | else | ||
167 | #only has minimum version requirement | ||
168 | local max_remote_ver="`get_version $1 $2 'max'`" | ||
169 | [ "$max_remote_ver" \> "$3" ] || [ "$max_remote_ver" = "$3" ] && installIU=$max_remote_ver | ||
170 | fi | ||
171 | |||
172 | [ "x$installIU" = "x" ] && err_exit 1 "Can NOT find candidates of $2 version($3, $4) at $1!" | ||
173 | installIU="$2/$installIU" | ||
174 | echo "try to install $installIU ..." | ||
175 | java ${PROXY_PARAM} -jar ${LAUNCHER} \ | ||
176 | -application org.eclipse.equinox.p2.director \ | ||
177 | -destination ${curdir}/eclipse \ | ||
178 | -profile SDKProfile \ | ||
179 | -repository $1 \ | ||
180 | -installIU ${installIU} || err_exit $? "installing ${installIU} failed" | ||
181 | } | ||
182 | |||
183 | #Eclipse Update Site | ||
184 | MAIN_UPDATE_SITE="http://download.eclipse.org/releases/juno" | ||
185 | # The main eclipse download site is unreliable at times. For now, we're going to | ||
186 | # maintain a mirror of just what we need. | ||
187 | #MAIN_UPDATE_SITE="http://downloads.yoctoproject.org/eclipse/juno/ftp.osuosl.org/pub/eclipse/releases/juno" | ||
188 | |||
189 | UPDATE_SITE="${MAIN_UPDATE_SITE}" | ||
190 | |||
191 | #CDT related | ||
192 | CDTFEAT="8.1.0" | ||
193 | echo "Installing CDT..." | ||
194 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.sdk.feature.group ${CDTFEAT} | ||
195 | CDTREMOTEVER="6.0.0" | ||
196 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER} | ||
197 | |||
198 | #RSE SDK | ||
199 | RSEVER="3.4.0" | ||
200 | TCFVER="1.0.0" | ||
201 | TMVER="3.3.0" | ||
202 | echo "Installing RSE/TCF/TM related component..." | ||
203 | update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER} | ||
204 | update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER} | ||
205 | update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER} | ||
206 | |||
207 | #AUTOTOOL | ||
208 | ATVER="3.0.1" | ||
209 | echo "Install AutoTool..." | ||
210 | update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER} | ||
211 | |||
212 | #Lttng legacy | ||
213 | TMFREL="1.0.0" | ||
214 | echo "Install TMF..." | ||
215 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.tmf.feature.group ${TMFREL} | ||
216 | |||
217 | #LTTng Kernel Analysis | ||
218 | LTTNGKAVER="1.0.0" | ||
219 | update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER} | ||
220 | |||
221 | echo "" | ||
222 | echo "Your build environment is successfully created." | ||
223 | echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh <branch name> <release name> to build" | ||
224 | echo "" | ||
225 | |||
226 | exit 0 | ||