X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FBuildEnv;h=ff0c5115a5e18a074705bbd58c273ab2dd98066b;hb=e0fb2d3e5d4b1d8477e9658adfbeeee43615083f;hp=79f916a9d54b437b63108be28a6ac44fabaad13a;hpb=64b2609fcff9d6412eea4c74c8e74bed33dc3235;p=mirror_edk2.git
diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv
index 79f916a9d5..ff0c5115a5 100755
--- a/BaseTools/BuildEnv
+++ b/BaseTools/BuildEnv
@@ -1,5 +1,9 @@
+## @file
+# Setup the environment for unix-like systems running a bash-like shell.
+# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
#
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -7,10 +11,6 @@
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-#
-# Setup the environment for unix-like systems running a bash-like shell.
-# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
#
SetWorkspace() {
@@ -23,14 +23,6 @@ SetWorkspace() {
return 0
fi
- if [ ! ${BASH_SOURCE[0]} -ef ./BaseTools/BuildEnv ]
- then
- echo Run this script from the base of your tree. For example:
- echo " cd /Path/To/Edk/Root"
- echo " . BaseTools/BuildEnv"
- return 1
- fi
-
#
# Set $WORKSPACE
#
@@ -44,11 +36,28 @@ RestorePreviousConfiguration() {
#
# Restore previous configuration
#
- PREVIOUS_CONF_FILE=Conf/BuildEnv.sh
+ if [ -z "$CONF_PATH" ]
+ then
+ export CONF_PATH=$WORKSPACE/Conf
+ if [ ! -d $WORKSPACE/Conf ] && [ -n "$PACKAGES_PATH" ]
+ then
+ PATH_LIST=${PACKAGES_PATH//:/ }
+ for DIR in $PATH_LIST
+ do
+ if [ -d $DIR/Conf ]
+ then
+ export CONF_PATH=$DIR/Conf
+ break
+ fi
+ done
+ fi
+ fi
+
+ PREVIOUS_CONF_FILE=$CONF_PATH/BuildEnv.sh
if [ -e $PREVIOUS_CONF_FILE ]
then
- echo Loading previous configuration from \$WORKSPACE/$PREVIOUS_CONF_FILE
- . $WORKSPACE/$PREVIOUS_CONF_FILE
+ echo Loading previous configuration from $PREVIOUS_CONF_FILE
+ . $PREVIOUS_CONF_FILE
fi
}
@@ -79,10 +88,9 @@ StoreCurrentConfiguration() {
# Write configuration to a shell script to allow for configuration to be
# easily reloaded.
#
- OUTPUT_FILE=Conf/BuildEnv.sh
- #echo Storing current configuration into \$WORKSPACE/$OUTPUT_FILE
- OUTPUT_FILE=$WORKSPACE/$OUTPUT_FILE
- echo "# Auto-generated by ${BASH_SOURCE[0]}" > $OUTPUT_FILE
+ OUTPUT_FILE=$CONF_PATH/BuildEnv.sh
+ #echo Storing current configuration into $OUTPUT_FILE
+ echo "# Auto-generated by ${BASH_SOURCE[0]}" >| $OUTPUT_FILE
GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
GenerateShellCodeToUpdatePath $OUTPUT_FILE
@@ -99,20 +107,20 @@ SetEdkToolsPath() {
fi
#
- # Try $WORKSPACE/Conf/EdkTools
+ # Try $CONF_PATH/EdkTools
#
- if [ -e $WORKSPACE/Conf/EdkTools ]
+ if [ -e $CONF_PATH/EdkTools ]
then
- export EDK_TOOLS_PATH=$WORKSPACE/Conf/EdkTools
+ export EDK_TOOLS_PATH=$CONF_PATH/EdkTools
return 0
fi
#
- # Try $WORKSPACE/Conf/BaseToolsSource
+ # Try $CONF_PATH/BaseToolsSource
#
- if [ -e $WORKSPACE/Conf/BaseToolsSource ]
+ if [ -e $CONF_PATH/BaseToolsSource ]
then
- export EDK_TOOLS_PATH=$WORKSPACE/Conf/BaseToolsSource
+ export EDK_TOOLS_PATH=$CONF_PATH/BaseToolsSource
return 0
fi
@@ -125,6 +133,22 @@ SetEdkToolsPath() {
return 0
fi
+ #
+ # Try $PACKAGES_PATH
+ #
+ if [ -n "$PACKAGES_PATH"]
+ then
+ PATH_LIST=${PACKAGES_PATH//:/ }
+ for DIR in $PATH_LIST
+ do
+ if [ -d $DIR/BaseTools ]
+ then
+ export EDK_TOOLS_PATH=$DIR/BaseTools
+ return 0
+ fi
+ done
+ fi
+
echo "Unable to determine EDK_TOOLS_PATH"
echo
echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
@@ -188,17 +212,16 @@ AddEdkToolsToPath() {
CopySingleTemplateFile() {
SRC_FILENAME=Conf/$1.template
- DST_FILENAME=Conf/$1.txt
+ DST_FILENAME=$CONF_PATH/$1.txt
- if [ -e $WORKSPACE/$DST_FILENAME ]
+ if [ -e $DST_FILENAME ]
then
- return
+ [ $RECONFIG != TRUE ] && return
fi
echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
- echo " to \$WORKSPACE/$DST_FILENAME"
+ echo " to $DST_FILENAME"
SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
- DST_FILENAME=$WORKSPACE/$DST_FILENAME
cp $SRC_FILENAME $DST_FILENAME
}
@@ -239,6 +262,7 @@ ScriptMain() {
echo WORKSPACE: $WORKSPACE
echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
+ echo CONF_PATH: $CONF_PATH
CopyTemplateFiles