mirror of https://github.com/acidanthera/audk.git
BaseTools: Update edksetup.sh to support multiple workspaces
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Wu Hao A <hao.a.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18584 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
485eb3a252
commit
094a67398f
|
@ -2,7 +2,7 @@
|
||||||
# Setup the environment for unix-like systems running a bash-like shell.
|
# Setup the environment for unix-like systems running a bash-like shell.
|
||||||
# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
|
# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -35,11 +35,28 @@ RestorePreviousConfiguration() {
|
||||||
#
|
#
|
||||||
# Restore previous configuration
|
# 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
|
||||||
|
PACKAGES_PATH=${PACKAGES_PATH//:/ }
|
||||||
|
for DIR in $PACKAGES_PATH
|
||||||
|
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 ]
|
if [ -e $PREVIOUS_CONF_FILE ]
|
||||||
then
|
then
|
||||||
echo Loading previous configuration from \$WORKSPACE/$PREVIOUS_CONF_FILE
|
echo Loading previous configuration from $PREVIOUS_CONF_FILE
|
||||||
. $WORKSPACE/$PREVIOUS_CONF_FILE
|
. $PREVIOUS_CONF_FILE
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +87,8 @@ StoreCurrentConfiguration() {
|
||||||
# Write configuration to a shell script to allow for configuration to be
|
# Write configuration to a shell script to allow for configuration to be
|
||||||
# easily reloaded.
|
# easily reloaded.
|
||||||
#
|
#
|
||||||
OUTPUT_FILE=Conf/BuildEnv.sh
|
OUTPUT_FILE=$CONF_PATH/BuildEnv.sh
|
||||||
#echo Storing current configuration into \$WORKSPACE/$OUTPUT_FILE
|
#echo Storing current configuration into $OUTPUT_FILE
|
||||||
OUTPUT_FILE=$WORKSPACE/$OUTPUT_FILE
|
|
||||||
echo "# Auto-generated by ${BASH_SOURCE[0]}" > $OUTPUT_FILE
|
echo "# Auto-generated by ${BASH_SOURCE[0]}" > $OUTPUT_FILE
|
||||||
GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
|
GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
|
||||||
GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
|
GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
|
||||||
|
@ -90,20 +106,20 @@ SetEdkToolsPath() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try $WORKSPACE/Conf/EdkTools
|
# Try $CONF_PATH/EdkTools
|
||||||
#
|
#
|
||||||
if [ -e $WORKSPACE/Conf/EdkTools ]
|
if [ -e $CONF_PATH/EdkTools ]
|
||||||
then
|
then
|
||||||
export EDK_TOOLS_PATH=$WORKSPACE/Conf/EdkTools
|
export EDK_TOOLS_PATH=$CONF_PATH/EdkTools
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try $WORKSPACE/Conf/BaseToolsSource
|
# Try $CONF_PATH/BaseToolsSource
|
||||||
#
|
#
|
||||||
if [ -e $WORKSPACE/Conf/BaseToolsSource ]
|
if [ -e $CONF_PATH/BaseToolsSource ]
|
||||||
then
|
then
|
||||||
export EDK_TOOLS_PATH=$WORKSPACE/Conf/BaseToolsSource
|
export EDK_TOOLS_PATH=$CONF_PATH/BaseToolsSource
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -116,6 +132,22 @@ SetEdkToolsPath() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Try $PACKAGES_PATH
|
||||||
|
#
|
||||||
|
if [ -n "$PACKAGES_PATH"]
|
||||||
|
then
|
||||||
|
PACKAGES_PATH=${PACKAGES_PATH//:/ }
|
||||||
|
for DIR in $PACKAGES_PATH
|
||||||
|
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 "Unable to determine EDK_TOOLS_PATH"
|
||||||
echo
|
echo
|
||||||
echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
|
echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
|
||||||
|
@ -179,17 +211,16 @@ AddEdkToolsToPath() {
|
||||||
CopySingleTemplateFile() {
|
CopySingleTemplateFile() {
|
||||||
|
|
||||||
SRC_FILENAME=Conf/$1.template
|
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
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
|
echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
|
||||||
echo " to \$WORKSPACE/$DST_FILENAME"
|
echo " to $DST_FILENAME"
|
||||||
SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
|
SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
|
||||||
DST_FILENAME=$WORKSPACE/$DST_FILENAME
|
|
||||||
cp $SRC_FILENAME $DST_FILENAME
|
cp $SRC_FILENAME $DST_FILENAME
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -230,6 +261,7 @@ ScriptMain() {
|
||||||
|
|
||||||
echo WORKSPACE: $WORKSPACE
|
echo WORKSPACE: $WORKSPACE
|
||||||
echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
|
echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
|
||||||
|
echo CONF_PATH: $CONF_PATH
|
||||||
|
|
||||||
CopyTemplateFiles
|
CopyTemplateFiles
|
||||||
|
|
||||||
|
|
19
edksetup.sh
19
edksetup.sh
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -78,10 +78,23 @@ function SetupEnv()
|
||||||
elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
|
elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
|
||||||
then
|
then
|
||||||
. $WORKSPACE/BaseTools/BuildEnv $*
|
. $WORKSPACE/BaseTools/BuildEnv $*
|
||||||
|
elif [ -n "$PACKAGES_PATH" ]
|
||||||
|
then
|
||||||
|
PATH_LIST=$PACKAGES_PATH
|
||||||
|
PATH_LIST=${PATH_LIST//:/ }
|
||||||
|
for DIR in $PATH_LIST
|
||||||
|
do
|
||||||
|
if [ -f "$DIR/BaseTools/BuildEnv" ]
|
||||||
|
then
|
||||||
|
export EDK_TOOLS_PATH=$DIR/BaseTools
|
||||||
|
. $DIR/BaseTools/BuildEnv $*
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo BaseTools not found in your tree, and EDK_TOOLS_PATH is not set.
|
echo BaseTools not found in your tree, and EDK_TOOLS_PATH is not set.
|
||||||
echo Please check that WORKSPACE is not set incorrectly in your
|
echo Please check that WORKSPACE or PACKAGES_PATH is not set incorrectly
|
||||||
echo shell, or point EDK_TOOLS_PATH at the directory that contains
|
echo in your shell, or point EDK_TOOLS_PATH at the directory that contains
|
||||||
echo the EDK2 BuildEnv script.
|
echo the EDK2 BuildEnv script.
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue