-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb2qt-init-build-env
executable file
·180 lines (163 loc) · 4.88 KB
/
b2qt-init-build-env
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/sh
############################################################################
##
## Copyright (C) 2019 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the Boot to Qt meta layer.
##
## $QT_BEGIN_LICENSE:GPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 3 or (at your option) any later version
## approved by the KDE Free Qt Foundation. The licenses are as published by
## the Free Software Foundation and appearing in the file LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
############################################################################
set -e
usage() {
echo "Usage: $(basename $0) COMMAND [ARGS]"
echo
echo "Initialize build environment:"
echo " $(basename $0) init [--bsp <layer name>]"
echo " [--manifest <manifest xml>] [--manifest-dir <dir path>]"
echo " [--reference <mirror path>] [--internal]"
echo " --bsp <layer name>: name of the boot2qt bsp layer which was used for the repo init"
echo " --manifest <manifest xml>: name of the manifest to be used for initialization"
echo " --manifest-dir <dir path>: path to a directory containing repo manifest file(s)"
echo " --reference <mirror path>: path to local mirror, initialized previously with 'repo init --mirror'"
echo " --internal: fetch internal repositories, available only inside The Qt Company network."
echo "List available devices:"
echo " $(basename $0) list-devices"
}
while test -n "$1"; do
case "$1" in
"help" | "--help" | "-h")
usage
exit 0
;;
"--reference" | "-r")
shift
REFERENCE=$1
;;
"--device" | "-d")
shift
# ignored
;;
"--repo-url")
shift
REPO_URL="--repo-url $1"
;;
"--manifest")
shift
MANIFEST=$1
;;
"--manifest-dir")
shift
MANIFEST_DIR="$(readlink -f $1)"
;;
"--bsp")
shift
BSPLAYER=$1
;;
"--internal")
PROJECT_GROUPS="all"
;;
*)
if [ -n "$COMMAND" ]; then
echo "Unknown argument: $1"
usage
exit 1
fi
COMMAND=$1
;;
esac
shift
done
if [ -z "${COMMAND}" ]; then
usage
exit 1
fi
DIR=$(dirname $(readlink -f $0))
if [ -n "${REFERENCE}" ]; then
REFERENCE="--reference $(readlink -f ${REFERENCE})"
fi
if [ -z "${REPO_URL}" ]; then
REPO_URL="--repo-url https://github.com/theqtcompany/git-repo"
fi
PROJECT_GROUPS=${PROJECT_GROUPS:-default}
MANIFEST=${MANIFEST:-manifest.xml}
MANIFEST_DIR=${MANIFEST_DIR:-${DIR}/scripts}
get_repo() {
REPO="./repo"
if [ -n "$(command -v repo)" ]; then
REPO="repo"
elif [ ! -x "./repo" ]; then
curl -s https://storage.googleapis.com/git-repo-downloads/repo > "./repo"
chmod +x ./repo
fi
}
list_devices() {
echo "Available device configurations:"
for device in $(ls ${DIR}/meta-boot2qt-distro/conf/distro/include/*.conf); do
echo " $(basename ${device%%.conf})"
done
}
init() {
# local manifests are used with boot2qt bsp layers that don't need init
if [ ! -d ".repo/local_manifests" ]; then
mkdir -p .repo/manifests
cp ${MANIFEST_DIR}/${MANIFEST} .repo/manifests/default.xml
${REPO} init ${REPO_URL} -u ${PWD}/.repo/repo -b default -g "${PROJECT_GROUPS}" ${REFERENCE}
fi
${REPO} sync --optimized-fetch
if [ ! -e "sources/meta-boot2qt" ]; then
ln -s ${DIR} sources/meta-boot2qt
fi
if [ ! -e "setup-environment.sh" ]; then
ln -s ${DIR}/scripts/setup-environment.sh setup-environment.sh
fi
if [ -n "${BSPLAYER}" ] && [ ! -e "sources/${BSPLAYER}" ]; then
ln -s ../.repo/manifests sources/${BSPLAYER}
fi
if [ -n "${BSPLAYER}" ]; then
ln -sfn ${BSPLAYER}/conf sources/templates
else
ln -sfn meta-boot2qt/meta-boot2qt-distro/conf sources/templates
fi
# handle lfs repos which need manual lfs pull
LFS_REPOS=$(grep filter=lfs -l sources/*/.gitattributes 2>/dev/null || true)
for repo in ${LFS_REPOS}; do
( cd $(dirname ${repo}); git lfs pull )
done
}
get_repo
case "$COMMAND" in
"init")
init
;;
"mirror")
mirror
;;
"list-devices")
list_devices
;;
*)
echo "Unknown command"
usage
exit 1
;;
esac