forked from OpenXT/openxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_build
executable file
·143 lines (114 loc) · 4.33 KB
/
setup_build
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
#!/bin/bash
#
# Copyright (c) 2014 Citrix Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
set -e
# This script sets up a build environment for building
# XenClient using OpenEmbedded.
# Usage: ./setup_build
# See README file for details.
# See COPYING file for license.
# Default configuration section
# Do not edit this, override in local.settings instead e.g.
# if you have local copies of the repositories
usage()
{
echo "$0: [-v]"
}
while [ "$#" -ne 0 ]; do
case "$1" in
-v) set -x; shift 1;;
--) shift ; break ;;
-*) usage ; exit 1;;
*) break ;;
esac
done
BITBAKE_REPO=git://github.com/openembedded/bitbake.git
# maybe use something more "release-like"
BITBAKE_TAG=f8bf4499549f978ce7c93bc088a66f74cd751e2c
OE_CORE_REPO=git://github.com/openembedded/openembedded-core
OE_CORE_TAG=5433da972f2994f7176597d89499ccb65f876f88
META_OE_REPO=git://github.com/openembedded/meta-openembedded
META_OE_TAG=24e1ebc21da20240a41984b7f5c90aa9bd65a7e8
META_JAVA_REPO=https://github.com/woglinde/meta-java.git
META_JAVA_TAG=5d528acac0eab6cfaa4ed3c290c7db3acd5047bf
META_SELINUX_REPO=git://git.yoctoproject.org/meta-selinux
META_SELINUX_TAG=8e952c7da126d30f4aecb33abd3ef9252785cb40
META_OPENXT_OCAML_PLATFORM_REPO=https://github.com/OpenXT/meta-openxt-ocaml-platform.git
META_OPENXT_OCAML_PLATFORM_TAG=master
META_OPENXT_HASKELL_PLATFORM_REPO=https://github.com/OpenXT/meta-openxt-haskell-platform.git
META_OPENXT_HASKELL_PLATFORM_TAG=master
META_VIRTUALIZATION_REPO=git://git.yoctoproject.org/meta-virtualization.git
META_VIRTUALIZATION_TAG=jethro
# End of configuration
die() {
echo "FATAL: $*"
exit 1
}
# Usage: getgit LOCALDIR REPO TAG
getgit() {
rm -rf "$1.tmp"
[ -d "$1" ] && return
git clone -n $2 "$1.tmp" || die "Clone repo failed: $2"
pushd "$1.tmp"
set +e
git checkout $3 2> /dev/null || git checkout -b $3 origin/$3
current_branch=`git branch | grep -e ^* | cut -d ' ' -f2-`
if [ "$current_branch" != "$3" ]; then
git checkout -b $3
fi
set -e
popd
mv "$1.tmp" "$1"
}
OE_XENCLIENT_DIR=`pwd`
export OE_XENCLIENT_DIR
[ -f "$OE_XENCLIENT_DIR/local.settings" ] && . "$OE_XENCLIENT_DIR/local.settings"
REPOS=$OE_XENCLIENT_DIR/repos
if [ "$1" != "env" ]; then
mkdir -p $REPOS || die "Could not create local build dir"
getgit $REPOS/xenclient-oe $XENCLIENT_REPO $XENCLIENT_TAG
getgit $REPOS/bitbake $BITBAKE_REPO $BITBAKE_TAG
for p in `pwd`/repos/xenclient-oe/patches/bitbake/*.patch; do
if [ ! -f "$p.APPLIED" ]; then
echo "Applying BitBake patch: $p"
pushd $REPOS/bitbake
git apply $p || true
popd
touch "$p.APPLIED"
fi
done
getgit $REPOS/openembedded-core $OE_CORE_REPO $OE_CORE_TAG
getgit $REPOS/meta-openembedded $META_OE_REPO $META_OE_TAG
getgit $REPOS/meta-java $META_JAVA_REPO $META_JAVA_TAG
getgit $REPOS/meta-selinux $META_SELINUX_REPO $META_SELINUX_TAG
getgit $REPOS/meta-openxt-ocaml-platform $META_OPENXT_OCAML_PLATFORM_REPO $META_OPENXT_OCAML_PLATFORM_TAG
getgit $REPOS/meta-openxt-haskell-platform $META_OPENXT_HASKELL_PLATFORM_REPO $META_OPENXT_HASKELL_PLATFORM_TAG
getgit $REPOS/meta-virtualization $META_VIRTUALIZATION_REPO $META_VIRTUALIZATION_TAG
fi
if [ ! -e $OE_XENCLIENT_DIR/conf/local.conf ]; then
ln -s $OE_XENCLIENT_DIR/conf/local.conf-dist \
$OE_XENCLIENT_DIR/conf/local.conf
fi
BBPATH=$OE_XENCLIENT_DIR/oe/xenclient:$REPOS/openembedded:$OE_XENCLIENT_DIR/oe-addons
cat > oeenv <<EOF
OE_XENCLIENT_DIR=$OE_XENCLIENT_DIR
PATH=$OE_XENCLIENT_DIR/repos/bitbake/bin:\$PATH
BBPATH=$BBPATH
BB_ENV_EXTRAWHITE="OE_XENCLIENT_DIR MACHINE GIT_AUTHOR_NAME EMAIL"
export OE_XENCLIENT_DIR PATH BBPATH BB_ENV_EXTRAWHITE
EOF