]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/blob - oe-init-build-env
build-appliance-image: Update to nanbield head revision
[thirdparty/openembedded/openembedded-core.git] / oe-init-build-env
1 #!/bin/sh
2
3 # OE Build Environment Setup Script
4 #
5 # Copyright (C) 2006-2011 Linux Foundation
6 #
7 # SPDX-License-Identifier: GPL-2.0-or-later
8 #
9
10 #
11 # Normally this is called as '. ./oe-init-build-env <builddir>'
12 #
13 # This works in most shells (not dash), but not all of them pass the arguments
14 # when being sourced. To workaround the shell limitation use "set <builddir>"
15 # prior to sourcing this script.
16 #
17 if [ -n "$BASH_SOURCE" ]; then
18 THIS_SCRIPT=$BASH_SOURCE
19 elif [ -n "$ZSH_NAME" ]; then
20 THIS_SCRIPT=$0
21 else
22 THIS_SCRIPT="$(pwd)/oe-init-build-env"
23 if [ ! -e "$THIS_SCRIPT" ]; then
24 echo "Error: $THIS_SCRIPT doesn't exist!" >&2
25 echo "Please run this script in oe-init-build-env's directory." >&2
26 exit 1
27 fi
28 fi
29 if [ -n "$BBSERVER" ]; then
30 unset BBSERVER
31 fi
32
33 if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
34 echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'" >&2
35 exit 1
36 fi
37
38 if [ -z "$OEROOT" ]; then
39 OEROOT=$(dirname "$THIS_SCRIPT")
40 OEROOT=$(readlink -f "$OEROOT")
41 fi
42 unset THIS_SCRIPT
43
44 export OEROOT
45 . "$OEROOT"/scripts/oe-buildenv-internal &&
46 TEMPLATECONF="$TEMPLATECONF" "$OEROOT"/scripts/oe-setup-builddir || {
47 unset OEROOT
48 return 1
49 }
50 unset OEROOT
51
52 [ -z "$BUILDDIR" ] || cd "$BUILDDIR"
53