3 # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
4 # Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
14 # Setup workspace if it is not set
16 if [ -z "$WORKSPACE" ]
18 echo Initializing workspace
19 if [ ! -e `pwd`/edksetup.sh
]
23 # This version is for the tools in the BaseTools project.
24 # this assumes svn pulls have the same root dir
25 # export EDK_TOOLS_PATH=`pwd`/../BaseTools
26 # This version is for the tools source in edk2
27 export EDK_TOOLS_PATH
=`pwd`/BaseTools
29 source edksetup.sh BaseTools
31 echo Building from
: $WORKSPACE
35 # Configure defaults for various options
52 CYGWIN
*) echo Cygwin not fully supported yet.
;;
54 Major
=$
(uname
-r | cut
-f 1 -d '.')
57 echo UnixPkg requires Snow Leopard or later OS
60 CLANG_VER
=$
(clang
-ccc-host-triple x86_64-pc-win32-macho
2>&1 >/dev
/null
) || true
61 if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
63 # only older versions of Xcode support -ccc-host-triple, for newer versions
72 BUILD_NEW_SHELL
="-D BUILD_NEW_SHELL"
73 BUILD_FAT
="-D BUILD_FAT"
88 gcc_version
=$
(gcc
-v 2>&1 |
tail -1 |
awk '{print $3}')
91 echo EmulatorPkg requires GCC4.8 or later
108 # Scan command line to override defaults
113 if [ -z "$LAST_ARG" ]; then
129 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
147 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
154 if [ -z "$HOST_TOOLS" ]
156 HOST_TOOLS
=$TARGET_TOOLS
159 if [ -z "$PROCESSOR" ]
161 PROCESSOR
=$HOST_PROCESSOR
164 BUILD_OUTPUT_DIR
=$WORKSPACE/Build
/Emulator
$PROCESSOR
169 LIB_NAMES
="ld-linux.so.2 libdl.so.2 crt1.o crti.o crtn.o"
170 LIB_SEARCH_PATHS
="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 /usr/lib /lib"
174 LIB_NAMES
="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
175 LIB_SEARCH_PATHS
="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/lib /lib"
179 for libname
in $LIB_NAMES
181 for dirname in $LIB_SEARCH_PATHS
183 if [ -e $dirname/$libname ]; then
184 export HOST_DLINK_PATHS
="$HOST_DLINK_PATHS $dirname/$libname"
190 PLATFORMFILE
=$WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
191 BUILD_DIR
="$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS"
192 BUILD_ROOT_ARCH
=$BUILD_DIR/$PROCESSOR
194 if [[ ! -f `which build` ||
! -f `which GenFv` ]];
196 # build the tools if they don't yet exist. Bin scheme
197 echo Building tools as they are not
in the path
198 make -C $WORKSPACE/BaseTools
199 elif [[ ( -f `which build` ||
-f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source
/C
/bin
]];
201 # build the tools if they don't yet exist. BinWrapper scheme
202 echo Building tools no
$EDK_TOOLS_PATH/Source
/C
/bin directory
203 make -C $WORKSPACE/BaseTools
205 echo using prebuilt tools
209 if [[ "$RUN_EMULATOR" == "yes" ]]; then
213 # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
214 # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
215 # images that get loaded in Host
217 if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
219 # only older versions of Xcode support -ccc-host-tripe, for newer versions
221 cp $WORKSPACE/EmulatorPkg
/Unix
/lldbefi.py
"$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS/$PROCESSOR"
222 cd $BUILD_ROOT_ARCH; /usr
/bin
/lldb
--source $WORKSPACE/EmulatorPkg
/Unix
/lldbinit Host
225 cp $WORKSPACE/EmulatorPkg
/Unix
/.gdbinit
"$BUILD_OUTPUT_DIR/${BUILDTARGET}_$TARGET_TOOLS/$PROCESSOR"
230 /usr
/bin
/gdb
$BUILD_ROOT_ARCH/Host
-q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg
/Unix
/GdbRun.sh
236 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD
-n 3 clean
237 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
241 make -C $WORKSPACE/BaseTools clean
242 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD
-n 3 clean
243 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
244 build
-p $WORKSPACE/ShellPkg
/ShellPkg.dsc
-a IA32
-b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
251 # Build the edk2 EmulatorPkg
253 if [[ $HOST_TOOLS == $TARGET_TOOLS ]]; then
254 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
$BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_
$ARCH_SIZE -D UNIX_SEC_BUILD
$NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3
256 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
$BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D BUILD_
$ARCH_SIZE -D UNIX_SEC_BUILD
-D SKIP_MAIN_BUILD
-n 3 modules
257 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
$BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -D BUILD_
$ARCH_SIZE $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3
258 cp "$BUILD_OUTPUT_DIR/${BUILDTARGET}_$HOST_TOOLS/$PROCESSOR/Host" $BUILD_ROOT_ARCH