2 # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
3 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 # In *inux environment, the build tools's source is required and need to be compiled
13 # firstly, please reference https://github.com/tianocore/tianocore.github.io/wiki/SourceForge-to-Github-Quick-Start
14 # to get how to setup build tool.
16 # Setup the environment for unix-like systems running a bash-like shell.
17 # This file must be "sourced" not merely executed. For example: ". edksetup.sh"
19 # CYGWIN users: Your path and filename related environment variables should be
20 # set up in the unix style. This script will make the necessary conversions to
23 # Please reference edk2 user manual for more detail descriptions at https://github.com/tianocore-docs/Docs/raw/master/User_Docs/EDK_II_UserManual_0_7.pdf
26 SCRIPTNAME
="edksetup.sh"
31 echo "Usage: $SCRIPTNAME [Options]"
33 echo "The system environment variable, WORKSPACE, is always set to the current"
34 echo "working directory."
37 echo " --help, -h, -? Print this help screen and exit."
39 echo " --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the"
40 echo " template files from the BaseTools/Conf directory."
42 echo Please note
: This
script must be
\'sourced
\' so the environment can be changed.
44 echo "source $SCRIPTNAME"
47 function SetWorkspace
()
50 # If WORKSPACE is already set, then we can return right now
52 if [ -n "$WORKSPACE" ]
57 if [ ! ${BASH_SOURCE[0]} -ef .
/edksetup.sh
] && [ -z "$PACKAGES_PATH" ]
59 echo Run this
script from the base of your tree. For example
:
60 echo " cd /Path/To/Edk/Root"
66 # Check for BaseTools/BuildEnv before dirtying the user's environment.
68 if [ ! -f BaseTools
/BuildEnv
] && [ -z "$EDK_TOOLS_PATH" ]
70 echo BaseTools not found
in your tree
, and EDK_TOOLS_PATH is not
set.
71 echo Please point EDK_TOOLS_PATH
at the directory that contains
72 echo the EDK2 BuildEnv
script.
79 export WORKSPACE
=`pwd`
86 if [ -n "$EDK_TOOLS_PATH" ]
88 .
$EDK_TOOLS_PATH/BuildEnv
89 elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
91 .
$WORKSPACE/BaseTools
/BuildEnv
92 elif [ -n "$PACKAGES_PATH" ]
94 PATH_LIST
=$PACKAGES_PATH
95 PATH_LIST
=${PATH_LIST//:/ }
98 if [ -f "$DIR/BaseTools/BuildEnv" ]
100 export EDK_TOOLS_PATH
=$DIR/BaseTools
101 .
$DIR/BaseTools
/BuildEnv
106 echo BaseTools not found
in your tree
, and EDK_TOOLS_PATH is not
set.
107 echo Please check that WORKSPACE or PACKAGES_PATH is not
set incorrectly
108 echo in your shell
, or point EDK_TOOLS_PATH
at the directory that contains
109 echo the EDK2 BuildEnv
script.
125 # Ignore argument for backwards compatibility
147 unset SCRIPTNAME RECONFIG