2006-07-21 12:44:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-03-25 11:46:15 +00:00
|
|
|
# OE Build Environment Setup Script
|
2006-07-25 21:45:55 +00:00
|
|
|
#
|
2011-04-21 11:26:25 +00:00
|
|
|
# Copyright (C) 2006-2011 Linux Foundation
|
2006-07-25 21:45:55 +00:00
|
|
|
#
|
|
|
|
# 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
|
2007-05-16 13:48:29 +00:00
|
|
|
|
2010-11-25 00:06:04 +00:00
|
|
|
#
|
2016-03-15 15:01:53 +00:00
|
|
|
# Normally this is called as '. ./oe-init-build-env <builddir>'
|
2010-11-25 00:06:04 +00:00
|
|
|
#
|
2016-03-15 15:01:53 +00:00
|
|
|
# This works in most shells (not dash), but not all of them pass the arguments
|
|
|
|
# when being sourced. To workaround the shell limitation use "set <builddir>"
|
|
|
|
# prior to sourcing this script.
|
2010-11-25 00:06:04 +00:00
|
|
|
#
|
2014-02-24 17:11:47 +00:00
|
|
|
if [ -n "$BASH_SOURCE" ]; then
|
2016-03-15 14:41:02 +00:00
|
|
|
THIS_SCRIPT=$BASH_SOURCE
|
2014-02-24 17:11:47 +00:00
|
|
|
elif [ -n "$ZSH_NAME" ]; then
|
2016-03-15 14:41:02 +00:00
|
|
|
THIS_SCRIPT=$0
|
2009-11-10 16:46:31 +00:00
|
|
|
else
|
2016-03-15 14:41:02 +00:00
|
|
|
THIS_SCRIPT="$(pwd)/oe-init-build-env"
|
2006-07-21 21:05:18 +00:00
|
|
|
fi
|
2014-02-24 17:11:47 +00:00
|
|
|
if [ -n "$BBSERVER" ]; then
|
2016-03-15 15:04:11 +00:00
|
|
|
unset BBSERVER
|
2014-02-24 17:11:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
|
2016-03-15 15:04:11 +00:00
|
|
|
echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
|
|
|
|
exit 1
|
2014-02-24 17:11:47 +00:00
|
|
|
fi
|
|
|
|
|
2016-03-15 14:41:02 +00:00
|
|
|
if [ -z "$OEROOT" ]; then
|
|
|
|
OEROOT=$(dirname "$THIS_SCRIPT")
|
|
|
|
OEROOT=$(readlink -f "$OEROOT")
|
|
|
|
fi
|
|
|
|
unset THIS_SCRIPT
|
|
|
|
|
2014-02-24 17:11:47 +00:00
|
|
|
export OEROOT
|
2016-03-17 09:56:28 +00:00
|
|
|
. $OEROOT/scripts/oe-buildenv-internal &&
|
|
|
|
TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || {
|
|
|
|
unset OEROOT
|
|
|
|
return 1
|
|
|
|
}
|
2014-02-24 17:11:47 +00:00
|
|
|
unset OEROOT
|
2006-07-21 21:05:18 +00:00
|
|
|
|
2016-03-17 09:56:28 +00:00
|
|
|
[ -z "$BUILDDIR" ] || cd "$BUILDDIR"
|
|
|
|
|
2013-11-25 21:21:28 +00:00
|
|
|
# Shutdown any bitbake server if the BBSERVER variable is not set
|
2016-03-15 15:04:11 +00:00
|
|
|
if [ -z "$BBSERVER" ] && [ -f bitbake.lock ]; then
|
|
|
|
grep ":" bitbake.lock > /dev/null && BBSERVER=$(cat bitbake.lock) bitbake --status-only
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
echo "Shutting down bitbake memory resident server with bitbake -m"
|
|
|
|
BBSERVER=$(cat bitbake.lock) bitbake -m
|
2013-11-25 21:21:28 +00:00
|
|
|
fi
|
|
|
|
fi
|