]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/blame - oe-init-build-env
python3: move dataclasses to python3-core
[thirdparty/openembedded/openembedded-core.git] / oe-init-build-env
CommitLineData
5b9a5c95
MA
1#!/bin/sh
2
17e981a8 3# OE Build Environment Setup Script
e9f80c8c 4#
fe73ea8c 5# Copyright (C) 2006-2011 Linux Foundation
e9f80c8c 6#
f8c9c511 7# SPDX-License-Identifier: GPL-2.0-or-later
e9f80c8c 8#
8142b95b 9
60ccdaa0 10#
9c7e3cfc 11# Normally this is called as '. ./oe-init-build-env <builddir>'
60ccdaa0 12#
9c7e3cfc
PK
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.
60ccdaa0 16#
cac863e9 17if [ -n "$BASH_SOURCE" ]; then
3327e2a9 18 THIS_SCRIPT=$BASH_SOURCE
cac863e9 19elif [ -n "$ZSH_NAME" ]; then
3327e2a9 20 THIS_SCRIPT=$0
988e4ddf 21else
3327e2a9 22 THIS_SCRIPT="$(pwd)/oe-init-build-env"
632c54b7
RY
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
46c6968e 28fi
cac863e9 29if [ -n "$BBSERVER" ]; then
1295d413 30 unset BBSERVER
cac863e9 31fi
cac863e9
GT
32
33if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
632c54b7 34 echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'" >&2
1295d413 35 exit 1
cac863e9
GT
36fi
37
3327e2a9
PK
38if [ -z "$OEROOT" ]; then
39 OEROOT=$(dirname "$THIS_SCRIPT")
40 OEROOT=$(readlink -f "$OEROOT")
41fi
42unset THIS_SCRIPT
43
cac863e9 44export OEROOT
b07a70fb
AAB
45. "$OEROOT"/scripts/oe-buildenv-internal &&
46 TEMPLATECONF="$TEMPLATECONF" "$OEROOT"/scripts/oe-setup-builddir || {
40764c70
PK
47 unset OEROOT
48 return 1
49}
cac863e9 50unset OEROOT
46c6968e 51
40764c70
PK
52[ -z "$BUILDDIR" ] || cd "$BUILDDIR"
53