]> git.proxmox.com Git - mirror_edk2.git/blob - edksetup.sh
edksetup.sh: Look for BuildEnv under EDK_TOOLS_PATH
[mirror_edk2.git] / edksetup.sh
1 #
2 # Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
3 # This program and the accompanying materials
4 # are licensed and made available under the terms and conditions of the BSD License
5 # which accompanies this distribution. The full text of the license may be found at
6 # http://opensource.org/licenses/bsd-license.php
7 #
8 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 #
11 # In *inux environment, the build tools's source is required and need to be compiled
12 # firstly, please reference https://edk2.tianocore.org/unix-getting-started.html to
13 # to get how to setup build tool.
14 #
15 # After build tool is downloaded and compiled, a soft symbol linker need to be created
16 # at <workspace>/Conf. For example: ln -s /work/BaseTools /work/edk2/Conf/BaseToolsSource.
17 #
18 # Setup the environment for unix-like systems running a bash-like shell.
19 # This file must be "sourced" not merely executed. For example: ". edksetup.sh"
20 #
21 # CYGWIN users: Your path and filename related environment variables should be
22 # set up in the unix style. This script will make the necessary conversions to
23 # windows style.
24 #
25 # Please reference edk2 user manual for more detail descriptions at https://edk2.tianocore.org/files/documents/64/494/EDKII_UserManual.pdf
26 #
27
28 function HelpMsg()
29 {
30 echo Please note: This script must be \'sourced\' so the environment can be changed.
31 echo ". edksetup.sh"
32 echo "source edksetup.sh"
33 return 1
34 }
35
36 function SetupEnv()
37 {
38 if [ -n "$EDK_TOOLS_PATH" ]
39 then
40 . $EDK_TOOLS_PATH/BuildEnv $*
41 elif [ -n "$WORKSPACE" ]
42 then
43 . $WORKSPACE/BaseTools/BuildEnv $*
44 else
45 . BaseTools/BuildEnv $*
46 fi
47 }
48
49 function SourceEnv()
50 {
51 if [ \
52 "$1" = "-?" -o \
53 "$1" = "-h" -o \
54 "$1" = "--help" \
55 ]
56 then
57 HelpMsg
58 else
59 SetupEnv "$*"
60 fi
61 }
62
63 if [ $# -gt 1 ]
64 then
65 HelpMsg
66 elif [ $# -eq 1 ] && [ "$1" != "BaseTools" ]
67 then
68 HelpMsg
69 fi
70
71 RETVAL=$?
72 if [ $RETVAL -ne 0 ]
73 then
74 return $RETVAL
75 fi
76
77 SourceEnv "$*"
78