VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/edksetup.sh

Last change on this file was 101291, checked in by vboxsync, 8 months ago

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#
2# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
3# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
4# SPDX-License-Identifier: BSD-2-Clause-Patent
5#
6# In *inux environment, the build tools's source is required and need to be compiled
7# firstly, please reference https://github.com/tianocore/tianocore.github.io/wiki/SourceForge-to-Github-Quick-Start
8# to get how to setup build tool.
9#
10# Setup the environment for unix-like systems running a bash-like shell.
11# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
12#
13# CYGWIN users: Your path and filename related environment variables should be
14# set up in the unix style. This script will make the necessary conversions to
15# windows style.
16#
17# 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
18#
19
20SCRIPTNAME="edksetup.sh"
21RECONFIG=FALSE
22
23HelpMsg()
24{
25 echo "Usage: $SCRIPTNAME [Options]"
26 echo
27 echo "The system environment variable, WORKSPACE, is always set to the current"
28 echo "working directory."
29 echo
30 echo "Options: "
31 echo " --help, -h, -? Print this help screen and exit."
32 echo
33 echo " --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the"
34 echo " template files from the BaseTools/Conf directory."
35 echo
36 echo Please note: This script must be \'sourced\' so the environment can be changed.
37 echo ". $SCRIPTNAME"
38 echo "source $SCRIPTNAME"
39}
40
41SetWorkspace()
42{
43 #
44 # If WORKSPACE is already set, then we can return right now
45 #
46 export PYTHONHASHSEED=1
47 if [ -n "$WORKSPACE" ]
48 then
49 return 0
50 fi
51
52 if [ ! -f ${SCRIPTNAME} ] && [ -z "$PACKAGES_PATH" ]
53 then
54 echo Source this script from the base of your tree. For example:
55 echo " cd /Path/To/Edk2/Clone"
56 echo " . $SCRIPTNAME"
57 return 1
58 fi
59
60 #
61 # Check for BaseTools/BuildEnv before dirtying the user's environment.
62 #
63 if [ ! -f BaseTools/BuildEnv ] && [ -z "$EDK_TOOLS_PATH" ]
64 then
65 echo BaseTools not found in your tree, and EDK_TOOLS_PATH is not set.
66 echo Please point EDK_TOOLS_PATH at the directory that contains
67 echo the EDK2 BuildEnv script.
68 return 1
69 fi
70
71 #
72 # Set $WORKSPACE
73 #
74 export WORKSPACE=$PWD
75 return 0
76}
77
78SetupEnv()
79{
80 if [ -n "$EDK_TOOLS_PATH" ]
81 then
82 . $EDK_TOOLS_PATH/BuildEnv
83 elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
84 then
85 . $WORKSPACE/BaseTools/BuildEnv
86 elif [ -n "$PACKAGES_PATH" ]
87 then
88 for DIR in $(echo $PACKAGES_PATH | tr ':' ' ')
89 do
90 if [ -f "$DIR/BaseTools/BuildEnv" ]
91 then
92 export EDK_TOOLS_PATH=$DIR/BaseTools
93 . $DIR/BaseTools/BuildEnv
94 break
95 fi
96 done
97 else
98 echo BaseTools not found in your tree, and EDK_TOOLS_PATH is not set.
99 echo Please check that WORKSPACE or PACKAGES_PATH is not set incorrectly
100 echo in your shell, or point EDK_TOOLS_PATH at the directory that contains
101 echo the EDK2 BuildEnv script.
102 return 1
103 fi
104}
105
106SetupPython3()
107{
108 export PYTHON_COMMAND=python3
109}
110
111SourceEnv()
112{
113 SetupPython3
114 SetWorkspace
115 SetupEnv
116}
117
118I=$#
119while [ $I -gt 0 ]
120do
121 case "$1" in
122 BaseTools)
123 # Ignore argument for backwards compatibility
124 shift
125 ;;
126 --reconfig)
127 RECONFIG=TRUE
128 shift
129 ;;
130 *)
131 HelpMsg
132 break
133 ;;
134 esac
135 I=$((I - 1))
136done
137
138if [ $I -gt 0 ]
139then
140 return 1
141fi
142
143SourceEnv
144
145unset SCRIPTNAME RECONFIG
146
147return $?
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use