diff options
Diffstat (limited to 'scripts/setup-environment.sh')
-rwxr-xr-x | scripts/setup-environment.sh | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/scripts/setup-environment.sh b/scripts/setup-environment.sh new file mode 100755 index 0000000..62055a2 --- /dev/null +++ b/scripts/setup-environment.sh | |||
@@ -0,0 +1,96 @@ | |||
1 | #!/bin/sh | ||
2 | ############################################################################# | ||
3 | ## | ||
4 | ## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | ||
5 | ## | ||
6 | ## This file is part of the Qt Enterprise Embedded Scripts of the Qt | ||
7 | ## framework. | ||
8 | ## | ||
9 | ## $QT_BEGIN_LICENSE$ | ||
10 | ## Commercial License Usage Only | ||
11 | ## Licensees holding valid commercial Qt license agreements with Digia | ||
12 | ## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, | ||
13 | ## may use this file in accordance with the terms contained in said license | ||
14 | ## agreement. | ||
15 | ## | ||
16 | ## For further information use the contact form at | ||
17 | ## http://www.qt.io/contact-us. | ||
18 | ## | ||
19 | ## | ||
20 | ## $QT_END_LICENSE$ | ||
21 | ## | ||
22 | ############################################################################# | ||
23 | |||
24 | while test -n "$1"; do | ||
25 | case "$1" in | ||
26 | "--help" | "-h") | ||
27 | echo "Usage: . $0 [build directory]" | ||
28 | return 0 | ||
29 | ;; | ||
30 | *) | ||
31 | BUILDDIR=$1 | ||
32 | ;; | ||
33 | esac | ||
34 | shift | ||
35 | done | ||
36 | |||
37 | THIS_SCRIPT="setup-environment.sh" | ||
38 | if [ "$(basename $0)" = "${THIS_SCRIPT}" ]; then | ||
39 | echo "Error: This script needs to be sourced. Please run as '. $0'" | ||
40 | exit 1 | ||
41 | fi | ||
42 | |||
43 | if [ -z "$MACHINE" ]; then | ||
44 | echo "Error: MACHINE environment variable not defined" | ||
45 | return 1 | ||
46 | fi | ||
47 | |||
48 | BUILDDIR=${BUILDDIR:-build-${MACHINE}} | ||
49 | |||
50 | if [ ! -f ${PWD}/${BUILDDIR}/conf/bblayers.conf ]; then | ||
51 | case ${MACHINE} in | ||
52 | apalis-imx6|colibri-vf) | ||
53 | LAYERSCONF="bblayers.conf.toradex.sample" | ||
54 | ;; | ||
55 | imx53qsb|imx6qsabresd|nitrogen6x) | ||
56 | LAYERSCONF="bblayers.conf.fsl.sample" | ||
57 | ;; | ||
58 | tibidabo) | ||
59 | LAYERSCONF="bblayers.conf.tibidabo.sample" | ||
60 | ;; | ||
61 | beagleboard|am335x-evm) | ||
62 | LAYERSCONF="bblayers.conf.ti.sample" | ||
63 | ;; | ||
64 | beaglebone) | ||
65 | LAYERSCONF="bblayers.conf.bbb.sample" | ||
66 | ;; | ||
67 | raspberrypi) | ||
68 | LAYERSCONF="bblayers.conf.rpi.sample" | ||
69 | ;; | ||
70 | emulator) | ||
71 | LAYERSCONF="bblayers.conf.emulator.sample" | ||
72 | ;; | ||
73 | *) | ||
74 | LAYERSCONF="bblayers.conf.sample" | ||
75 | echo "Unknown MACHINE, bblayers.conf might need manual editing" | ||
76 | ;; | ||
77 | esac | ||
78 | |||
79 | mkdir -p ${PWD}/${BUILDDIR}/conf | ||
80 | cp ${PWD}/sources/meta-b2qt/conf/${LAYERSCONF} ${PWD}/${BUILDDIR}/conf/bblayers.conf | ||
81 | |||
82 | if [ ! -d ${PWD}/sources/meta-b2qt/.git ]; then | ||
83 | QT_SDK_PATH=$(readlink -f ${PWD}/sources/meta-b2qt/../../) | ||
84 | fi | ||
85 | fi | ||
86 | |||
87 | export TEMPLATECONF="${PWD}/sources/meta-b2qt/conf" | ||
88 | . sources/poky/oe-init-build-env ${BUILDDIR} | ||
89 | |||
90 | # use sources from Qt SDK if that is available | ||
91 | sed -i -e "/QT_SDK_PATH/s:\"\":\"${QT_SDK_PATH}\":" conf/local.conf | ||
92 | |||
93 | unset QT_SDK_PATH | ||
94 | unset BUILDDIR | ||
95 | unset TEMPLATECONF | ||
96 | unset LAYERSCONF | ||