diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 173 | ||||
-rwxr-xr-x | scripts/find-version | 62 | ||||
-rwxr-xr-x | scripts/generate-doc.sh | 87 | ||||
-rw-r--r-- | scripts/readme.txt | 71 | ||||
-rwxr-xr-x | scripts/setup.sh | 236 |
5 files changed, 629 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..99acff7 --- /dev/null +++ b/scripts/build.sh | |||
@@ -0,0 +1,173 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help () | ||
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 | |||
21 | fail () | ||
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 | |||
31 | find_eclipse_base () | ||
32 | { | ||
33 | [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=${ECLIPSE_HOME} | ||
34 | } | ||
35 | |||
36 | find_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 | |||
44 | find_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 | |||
52 | check_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 | |||
72 | USE_LOCAL_GIT_REPO=0 | ||
73 | while getopts ":lh" opt; do | ||
74 | case $opt in | ||
75 | h) | ||
76 | help | ||
77 | ;; | ||
78 | l) | ||
79 | USE_LOCAL_GIT_REPO=1 | ||
80 | ;; | ||
81 | esac | ||
82 | done | ||
83 | shift $(($OPTIND - 1)) | ||
84 | |||
85 | |||
86 | if [ $# -ne 2 ] && [ $# -ne 3 ]; then | ||
87 | help | ||
88 | fi | ||
89 | |||
90 | #milestone | ||
91 | BRANCH=$1 | ||
92 | RELEASE=$2 | ||
93 | |||
94 | if [ "x" = "x${3}" ] | ||
95 | then | ||
96 | TAG="HEAD" | ||
97 | else | ||
98 | TAG=$3 | ||
99 | fi | ||
100 | |||
101 | TOP=`pwd` | ||
102 | |||
103 | check_env | ||
104 | |||
105 | #create tmp dir for build | ||
106 | DATE=`date +%Y%m%d%H%M` | ||
107 | BUILD_TOP=`echo ${BRANCH} | sed 's%/%-%'` | ||
108 | BUILD_TOP=${TOP}/${BUILD_TOP}_build_${DATE} | ||
109 | rm -rf ${BUILD_TOP} | ||
110 | mkdir ${BUILD_TOP} || fail $? "Create temporary build directory ${BUILD_TOP}" | ||
111 | BUILD_SRC=${BUILD_TOP}/src | ||
112 | BUILD_DIR=${BUILD_TOP}/build | ||
113 | mkdir ${BUILD_DIR} || fail $? "Create temporary build directory ${BUILD_DIR}" | ||
114 | |||
115 | |||
116 | #git clone | ||
117 | GIT_URL=${GIT_URL:-git://git.pokylinux.org/eclipse-poky-kepler.git} | ||
118 | if [ $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}" | ||
122 | fi | ||
123 | |||
124 | GIT_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} | ||
129 | git clone ${GIT_URL} ${GIT_DIR} || fail $? "git clone ${GIT_URL}" | ||
130 | cd ${GIT_DIR} | ||
131 | git checkout origin/${BRANCH} || fail $? "git checkout origin/${BRANCH}" | ||
132 | git checkout ${TAG} || fail $? "git checkout ${TAG}" | ||
133 | cd ${TOP} | ||
134 | |||
135 | # generate and add documentation | ||
136 | if [ "${TAG}" = "HEAD" ]; then | ||
137 | ${GIT_DIR}/scripts/generate-doc.sh ${BRANCH} ${GIT_DIR} | ||
138 | else | ||
139 | ${GIT_DIR}/scripts/generate-doc.sh -t ${TAG} ${GIT_DIR} | ||
140 | fi | ||
141 | |||
142 | #build | ||
143 | java -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" | ||
144 | java -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" | ||
145 | java -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 | |||
147 | if [ -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} | ||
154 | else | ||
155 | fail 1 "Not finding normal build output" | ||
156 | fi | ||
157 | |||
158 | #build archive for update site | ||
159 | java -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" | ||
160 | java -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" | ||
161 | java -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 | ||
164 | if [ -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} | ||
169 | else | ||
170 | fail 1 "Not finding archive build output" | ||
171 | fi | ||
172 | |||
173 | exit 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 | |||
3 | help () | ||
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 | |||
15 | fail () | ||
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 | |||
25 | find_eclipse_base () | ||
26 | { | ||
27 | [ -d ${ECLIPSE_HOME}/plugins ] && ECLIPSE_BASE=`readlink -f ${ECLIPSE_HOME}` | ||
28 | } | ||
29 | |||
30 | find_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 | |||
38 | check_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 | |||
56 | if [ $# -ne 0 ] && [ $# -ne 1 ]; then | ||
57 | help | ||
58 | fi | ||
59 | |||
60 | check_env | ||
61 | |||
62 | java -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..7feeb6b --- /dev/null +++ b/scripts/generate-doc.sh | |||
@@ -0,0 +1,87 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | help() | ||
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 | |||
18 | fail () | ||
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 | |||
28 | CHECKOUT_TAG=0 | ||
29 | while getopts ":ht" opt; do | ||
30 | case $opt in | ||
31 | h) | ||
32 | help | ||
33 | ;; | ||
34 | t) | ||
35 | CHECKOUT_TAG=1 | ||
36 | ;; | ||
37 | esac | ||
38 | done | ||
39 | shift $(($OPTIND - 1)) | ||
40 | |||
41 | if [ $# -ne 2 ]; then | ||
42 | help | ||
43 | fi | ||
44 | |||
45 | if [ $CHECKOUT_TAG -eq 0 ]; then | ||
46 | REFERENCE=origin/$1 | ||
47 | else | ||
48 | REFERENCE=$1 | ||
49 | fi | ||
50 | PLUGIN_FOLDER=`readlink -f $2` | ||
51 | |||
52 | TOP=`pwd` | ||
53 | |||
54 | DOC_DIR=${PLUGIN_FOLDER}/docs | ||
55 | rm -rf ${DOC_DIR} | ||
56 | DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user | ||
57 | DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/ | ||
58 | |||
59 | # git clone | ||
60 | DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git} | ||
61 | git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}" | ||
62 | cd ${DOC_DIR} | ||
63 | git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}" | ||
64 | COMMIT_ID=`git rev-parse HEAD` | ||
65 | |||
66 | # build and copy | ||
67 | DOCS="yocto-project-qs adt-manual kernel-dev \ | ||
68 | bsp-guide ref-manual dev-manual profile-manual" | ||
69 | |||
70 | cd documentation | ||
71 | ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?` | ||
72 | if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then | ||
73 | echo "WARNING:" | ||
74 | echo "This version does not support generating eclipse help" | ||
75 | echo "Documentation will not be available in eclipse" | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | for DOC in ${DOCS}; do | ||
80 | make DOC=${DOC} eclipse | ||
81 | cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR} | ||
82 | cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR} | ||
83 | done | ||
84 | |||
85 | sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html | ||
86 | |||
87 | cd ${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 @@ | |||
1 | Note: PART I and PART II can be skipped if you have already done that. | ||
2 | |||
3 | Part I: Base environment setup | ||
4 | I-1. install JDK | ||
5 | sudo zypper install java-1_6_0-openjdk | ||
6 | |||
7 | I-2. install X11 related packages for eclipse running | ||
8 | sudo zypper install xorg-x11-xauth | ||
9 | |||
10 | I-3. using git through a SOCKS proxy(If you're behind some firewall) | ||
11 | I-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 | |||
25 | I-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 | |||
32 | I-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 | |||
38 | I-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 | |||
44 | Part II: Setup the build environment | ||
45 | II-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 | |||
49 | II-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 | |||
53 | Part III: Build & Install Yocto Eclipse plug-in | ||
54 | |||
55 | To build the Yocto Eclipse plug-in, simply run | ||
56 | "ECLIPSE_HOME=<eclipse path> scripts/build.sh <branch name> <release name>". | ||
57 | |||
58 | The <eclipse install path> is the absolute path where you installed the | ||
59 | eclipse in step II-2. | ||
60 | |||
61 | The <branch name> is the git branch name you build based on. | ||
62 | |||
63 | If successful, 2 files org.yocto.sdk-<release name>-<date>.zip and | ||
64 | org.yocto.sdk.-<release name>-<date>-archive.zip will be genereated under the | ||
65 | directory where you invoked the "build.sh" script. | ||
66 | |||
67 | The file with the "-archive" in its name is the archive zip used for eclipse | ||
68 | update manager. User should use eclipse update manager to install it. | ||
69 | |||
70 | The file without the "-archive" in its name is the zip containing only the | ||
71 | plugins/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..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 | ||