summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:36:50 +0100
committerAdrian Dudau <adrian.dudau@enea.com>2013-12-12 15:25:03 +0100
commit41ac47d732eed8392d60d0f6773e5a279d49b999 (patch)
treecf19d099db9cfdb8d73aa21c31e7aa1cc86ff860 /scripts
downloadeclipse-poky-juno-41ac47d732eed8392d60d0f6773e5a279d49b999.tar.gz
initial commit of Enea Linux 3.1HEADmaster
Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh173
-rwxr-xr-xscripts/find-version62
-rwxr-xr-xscripts/generate-doc.sh88
-rw-r--r--scripts/readme.txt71
-rwxr-xr-xscripts/setup.sh226
5 files changed, 620 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..7010caa
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,173 @@
1#!/bin/sh
2
3help ()
4{
5 echo "Build the Yocto Eclipse plugins"
6 echo "Usage: [GIT_URL=url_of_repo] [DOC_GIT=url_of_repo] $0 [OPTIONS] BRANCH_NAME RELEASE_NAME [TAG_NAME]";
7 echo ""
8 echo "Options:"
9 echo "-h - display this help and exit"
10 echo "-l - use local git repository"
11 echo "BRANCH_NAME - git branch name to build upon"
12 echo "RELEAES_NAME - release name in the final output name"
13 echo "TAG_NAME - git tag name to build upon. defaults to HEAD if not set"
14 echo "GIT_URL - use this repo for the plugins. Defaults to git://git.pokylinux.org/eclipse-poky-juno.git if not set"
15 echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set"
16 echo ""
17 echo "Example: $0 master r0 M1.1_rc1";
18 exit 1;
19}
20
21fail ()
22{
23 local retval=$1
24 shift $1
25 echo "[Fail $retval]: $*"
26 echo "BUILD_TOP=${BUILD_TOP}"
27 cd ${TOP}
28 exit ${retval}
29}
30
31find_eclipse_base ()
32{
33 [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=${ECLIPSE_HOME}
34}
35
36find_launcher ()
37{
38 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`"
39 for launcher in $list; do
40 [ -f $launcher ] && LAUNCHER=${launcher}
41 done
42}
43
44find_buildfile ()
45{
46 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.pde.build_*/scripts/build.xml`"
47 for buildfile in $list; do
48 [ -f $buildfile ] && BUILDFILE=${buildfile}
49 done
50}
51
52check_env ()
53{
54 find_eclipse_base
55 find_launcher
56 find_buildfile
57
58 local err=0
59 [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" -o "x${BUILDFILE}" = "x" ] && err=1
60 if [ $err -eq 0 ]; then
61 [ ! -d ${ECLIPSE_BASE} ] && err=1
62 [ ! -f ${LAUNCHER} ] && err=1
63 [ ! -f ${BUILDFILE} ] && err=1
64 fi
65
66 if [ $err -ne 0 ]; then
67 echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!"
68 exit 1
69 fi
70}
71
72USE_LOCAL_GIT_REPO=0
73while getopts ":lh" opt; do
74 case $opt in
75 h)
76 help
77 ;;
78 l)
79 USE_LOCAL_GIT_REPO=1
80 ;;
81 esac
82done
83shift $(($OPTIND - 1))
84
85
86if [ $# -ne 2 ] && [ $# -ne 3 ]; then
87 help
88fi
89
90#milestone
91BRANCH=$1
92RELEASE=$2
93
94if [ "x" = "x${3}" ]
95then
96 TAG="HEAD"
97else
98 TAG=$3
99fi
100
101TOP=`pwd`
102
103check_env
104
105#create tmp dir for build
106DATE=`date +%Y%m%d%H%M`
107BUILD_TOP=`echo ${BRANCH} | sed 's%/%-%'`
108BUILD_TOP=${TOP}/${BUILD_TOP}_build_${DATE}
109rm -rf ${BUILD_TOP}
110mkdir ${BUILD_TOP} || fail $? "Create temporary build directory ${BUILD_TOP}"
111BUILD_SRC=${BUILD_TOP}/src
112BUILD_DIR=${BUILD_TOP}/build
113mkdir ${BUILD_DIR} || fail $? "Create temporary build directory ${BUILD_DIR}"
114
115
116#git clone
117GIT_URL=${GIT_URL:-git://git.pokylinux.org/eclipse-poky-juno.git}
118if [ $USE_LOCAL_GIT_REPO -eq 1 ]; then
119 SCRIPT_DIR=`dirname $0`
120 GIT_DIR=`readlink -f ${SCRIPT_DIR}/..`
121 GIT_URL="file://${GIT_DIR}"
122fi
123
124GIT_DIR=${BUILD_SRC}
125#mkdir ${GIT_DIR}
126#cp -r features/ ${GIT_DIR}
127#cp -r plugins/ ${GIT_DIR}
128#cp -r tcf/ ${GIT_DIR}
129git clone ${GIT_URL} ${GIT_DIR} || fail $? "git clone ${GIT_URL}"
130cd ${GIT_DIR}
131git checkout origin/${BRANCH} || fail $? "git checkout origin/${BRANCH}"
132git checkout ${TAG} || fail $? "git checkout ${TAG}"
133cd ${TOP}
134
135# generate and add documentation
136if [ "${TAG}" = "HEAD" ]; then
137 ${GIT_DIR}/scripts/generate-doc.sh ${BRANCH} ${GIT_DIR}
138else
139 ${GIT_DIR}/scripts/generate-doc.sh -t ${TAG} ${GIT_DIR}
140fi
141
142#build
143java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build"
144java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build"
145java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} || fail $? "normal build"
146
147if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ] &&
148 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ] &&
149 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ]; then
150 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}.zip ./org.yocto.bc-${RELEASE}-${DATE}.zip
151 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}.zip ./org.yocto.doc-${RELEASE}-${DATE}.zip
152 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}.zip ./org.yocto.sdk-${RELEASE}-${DATE}.zip
153 rm -rf ${BUILD_DIR}
154else
155 fail 1 "Not finding normal build output"
156fi
157
158#build archive for update site
159java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.bc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build"
160java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.doc.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build"
161java -jar ${LAUNCHER} -application org.eclipse.ant.core.antRunner -buildfile ${BUILDFILE} -DbaseLocation=${ECLIPSE_BASE} -Dbuilder=${GIT_DIR}/features/org.yocto.sdk.headless.build -DbuildDirectory=${BUILD_DIR} -DotherSrcDirectory=${GIT_DIR} -DbuildId=${RELEASE} -Dp2.gathering=true || fail $? "archive build"
162
163#clean up
164if [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ] &&
165 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.bc-${RELEASE}-group.group.group.zip ] &&
166 [ -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.doc-${RELEASE}-group.group.group.zip ]; then
167 cp -f ${BUILD_DIR}/I.${RELEASE}/org.yocto.sdk-${RELEASE}-group.group.group.zip ./org.yocto.sdk-${RELEASE}-${DATE}-archive.zip
168 rm -rf ${BUILD_TOP}
169else
170 fail 1 "Not finding archive build output"
171fi
172
173exit 0
diff --git a/scripts/find-version b/scripts/find-version
new file mode 100755
index 0000000..55fbc58
--- /dev/null
+++ b/scripts/find-version
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3help ()
4{
5 echo "Find the installed plugin/feature version of a eclipse build environment"
6 echo "Usage: $0 [pluginId1/featureId1[,pluginId2/featureId2]...]";
7 echo ""
8 echo "Options:"
9 echo "pluginId/featureId - comma seperated plugin or feature ids, empty for all"
10 echo ""
11 echo "Example: $0 org.eclipse.tcf.feature.group";
12 exit 1;
13}
14
15fail ()
16{
17 local retval=$1
18 shift $1
19 echo "[Fail $retval]: $*"
20 echo "BUILD_TOP=${BUILD_TOP}"
21 cd ${TOP}
22 exit ${retval}
23}
24
25find_eclipse_base ()
26{
27 [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=`readlink -f ${ECLIPSE_HOME}`
28}
29
30find_launcher ()
31{
32 local list="`ls ${ECLIPSE_BASE}/plugins/org.eclipse.equinox.launcher_*.jar`"
33 for launcher in $list; do
34 [ -f $launcher ] && LAUNCHER=${launcher}
35 done
36}
37
38check_env ()
39{
40 find_eclipse_base
41 find_launcher
42
43 local err=0
44 [ "x${ECLIPSE_BASE}" = "x" -o "x${LAUNCHER}" = "x" ] && err=1
45 if [ $err -eq 0 ]; then
46 [ ! -d ${ECLIPSE_BASE} ] && err=1
47 [ ! -f ${LAUNCHER} ] && err=1
48 fi
49
50 if [ $err -ne 0 ]; then
51 echo "Please set env variable ECLIPSE_HOME to the eclipse installation directory!"
52 exit 1
53 fi
54}
55
56if [ $# -ne 0 ] && [ $# -ne 1 ]; then
57 help
58fi
59
60check_env
61
62java -jar ${LAUNCHER} -application org.eclipse.equinox.p2.director -destination ${ECLIPSE_BASE} -profile SDKProfile -repository file:///${ECLIPSE_BASE}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile -list $@
diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh
new file mode 100755
index 0000000..90205ee
--- /dev/null
+++ b/scripts/generate-doc.sh
@@ -0,0 +1,88 @@
1#!/bin/sh
2
3help()
4{
5 echo "Generate and add eclipse help from yocto's documentation"
6 echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER"
7 echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER"
8 echo ""
9 echo "Options:"
10 echo "-h - display this help and exit"
11 echo "-t TAG_NAME - tag to build the documentation upon"
12 echo "BRANCH_NAME - branch to build the documentation upon"
13 echo "PLUGIN_FOLDER - root folder of the eclipse-poky project"
14 echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set"
15 exit 1
16}
17
18fail ()
19{
20 local retval=$1
21 shift $1
22 echo "[Fail $retval]: $*"
23 echo "BUILD_TOP=${BUILD_TOP}"
24 cd ${TOP}
25 exit ${retval}
26}
27
28CHECKOUT_TAG=0
29while getopts ":ht" opt; do
30 case $opt in
31 h)
32 help
33 ;;
34 t)
35 CHECKOUT_TAG=1
36 ;;
37 esac
38done
39shift $(($OPTIND - 1))
40
41if [ $# -ne 2 ]; then
42 help
43fi
44
45if [ $CHECKOUT_TAG -eq 0 ]; then
46 REFERENCE=origin/$1
47else
48 REFERENCE=$1
49fi
50PLUGIN_FOLDER=`readlink -f $2`
51
52TOP=`pwd`
53
54DOC_DIR=${PLUGIN_FOLDER}/docs
55rm -rf ${DOC_DIR}
56DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user
57DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/
58
59# git clone
60DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git}
61
62git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}"
63cd ${DOC_DIR}
64git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}"
65COMMIT_ID=`git rev-parse HEAD`
66
67# build and copy
68DOCS="yocto-project-qs adt-manual kernel-dev \
69 bsp-guide ref-manual dev-manual profile-manual"
70
71cd documentation
72ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?`
73if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then
74 echo "WARNING:"
75 echo "This version does not support generating eclipse help"
76 echo "Documentation will not be available in eclipse"
77 exit 1
78fi
79
80for DOC in ${DOCS}; do
81 make DOC=${DOC} eclipse
82 cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR}
83 cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR}
84done
85
86sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html
87
88cd ${TOP}
diff --git a/scripts/readme.txt b/scripts/readme.txt
new file mode 100644
index 0000000..ba55b64
--- /dev/null
+++ b/scripts/readme.txt
@@ -0,0 +1,71 @@
1Note: PART I and PART II can be skipped if you have already done that.
2
3Part I: Base environment setup
4I-1. install JDK
5 sudo zypper install java-1_6_0-openjdk
6
7I-2. install X11 related packages for eclipse running
8 sudo zypper install xorg-x11-xauth
9
10I-3. using git through a SOCKS proxy(If you're behind some firewall)
11I-3.1 Create a wrapper script for netcat
12 cat > ~/bin/proxy-wrapper
13
14 #!/bin/sh
15 PROXY=proxy-jf.intel.com
16 PORT=1080
17 METHOD="-X 5 -x ${PROXY}:${PORT}"
18
19 nc $METHOD $*
20
21 Then Ctlr+D to save the file and "chmod +x ~/bin/proxy-wrapper"
22
23 Note: if netcat is not installed, please "sudo zypper install netcat-openbsd".
24
25I-3.2 set git proxy environment
26 add the following line to your ~/.bashrc and "source ~/.bashrc"
27
28 export GIT_PROXY_COMMAND="/somepath/bin/proxy-wrapper"
29
30 Please be noted that it should be absolute path, since "~" is not supported.
31
32I-4. using svn through a http_proxy(If you're behind some firewall)
33 Modify the ~/.subversion/servers
34
35 http-proxy-host = proxy.jf.intel.com
36 http-proxy-port = 911
37
38I-5. Get the scripts from eclipse-poky git
39 git clone git://git.pokylinux.org/eclipse-poky.git
40
41 The scripts used for auto builder is under the directory of "scripts".
42
43
44Part II: Setup the build environment
45II-1. Modify the scripts/setup.sh to set appropriate proxy settings.
46 Set PROXY to a http proxy URL and PORT to the port number. Comment out
47 these 2 variables if proxy is not required.
48
49II-2. Run scripts/setup.sh to set up the build environment.
50 This will install the eclipse and relevant plugins required to build
51 Yocto eclipse plug-in.
52
53Part III: Build & Install Yocto Eclipse plug-in
54
55To build the Yocto Eclipse plug-in, simply run
56"ECLIPSE_HOME=<eclipse path> scripts/build.sh <branch name> <release name>".
57
58The <eclipse install path> is the absolute path where you installed the
59eclipse in step II-2.
60
61The <branch name> is the git branch name you build based on.
62
63If successful, 2 files org.yocto.sdk-<release name>-<date>.zip and
64org.yocto.sdk.-<release name>-<date>-archive.zip will be genereated under the
65directory where you invoked the "build.sh" script.
66
67The file with the "-archive" in its name is the archive zip used for eclipse
68update manager. User should use eclipse update manager to install it.
69
70The file without the "-archive" in its name is the zip containing only the
71plugins/features. User should unzip it to the their target eclipse to install it.
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
7err_exit()
8{
9 echo "[FAILED $1]$2"
10 exit $1
11}
12
13curdir=`pwd`
14
15uname_s=`uname -s`
16uname_m=`uname -m`
17case ${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 ;;
31esac
32
33#parsing proxy URLS
34url=${PROXY}
35if [ "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"
47fi
48
49
50# prepare the base Eclipse installation in folder "eclipse"
51ep_rel="R-"
52ep_ver="4.2.2"
53ep_date="-201302041200"
54P2_disabled=false
55P2_no_dropins=false
56if [ ! -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
82fi
83if [ ! -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}
97fi
98
99LAUNCHER="eclipse/startup.jar"
100
101get_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
136check_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
149update_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
184MAIN_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
189UPDATE_SITE="${MAIN_UPDATE_SITE}"
190
191#CDT related
192CDTFEAT="8.1.0"
193echo "Installing CDT..."
194update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.sdk.feature.group ${CDTFEAT}
195CDTREMOTEVER="6.0.0"
196update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.launch.remote.feature.group ${CDTREMOTEVER}
197
198#RSE SDK
199RSEVER="3.4.0"
200TCFVER="1.0.0"
201TMVER="3.3.0"
202echo "Installing RSE/TCF/TM related component..."
203update_feature_remote ${UPDATE_SITE} org.eclipse.rse.feature.group ${RSEVER}
204update_feature_remote ${UPDATE_SITE} org.eclipse.tcf.rse.feature.feature.group ${TCFVER}
205update_feature_remote ${UPDATE_SITE} org.eclipse.tm.terminal.sdk.feature.group ${TMVER}
206
207#AUTOTOOL
208ATVER="3.0.1"
209echo "Install AutoTool..."
210update_feature_remote ${UPDATE_SITE} org.eclipse.cdt.autotools.feature.group ${ATVER}
211
212#Lttng legacy
213TMFREL="1.0.0"
214echo "Install TMF..."
215update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.tmf.feature.group ${TMFREL}
216
217#LTTng Kernel Analysis
218LTTNGKAVER="1.0.0"
219update_feature_remote ${UPDATE_SITE} org.eclipse.linuxtools.lttng2.kernel.feature.group ${LTTNGKAVER}
220
221echo ""
222echo "Your build environment is successfully created."
223echo "Run ECLIPSE_HOME=${curdir}/eclipse `dirname $0`/build.sh <branch name> <release name> to build"
224echo ""
225
226exit 0