3 # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
6 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 # Setup workspace if it is not set
22 if [ -z "$WORKSPACE" ]
24 echo Initializing workspace
25 if [ ! -e `pwd`/edksetup.sh
]
29 # This version is for the tools in the BaseTools project.
30 # this assumes svn pulls have the same root dir
31 # export EDK_TOOLS_PATH=`pwd`/../BaseTools
32 # This version is for the tools source in edk2
33 export EDK_TOOLS_PATH
=`pwd`/BaseTools
35 source edksetup.sh BaseTools
37 echo Building from
: $WORKSPACE
41 # Configure defaults for various options
58 CYGWIN
*) echo Cygwin not fully supported yet.
;;
60 Major
=$
(uname
-r | cut
-f 1 -d '.')
63 echo UnixPkg requires Snow Leopard or later OS
66 CLANG_VER
=$
(clang
-ccc-host-triple x86_64-pc-win32-macho
2>&1 >/dev
/null
) || true
67 if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
69 # only older versions of Xcode support -ccc-host-tripe, for newer versions
78 BUILD_NEW_SHELL
="-D BUILD_NEW_SHELL"
79 BUILD_FAT
="-D BUILD_FAT"
94 gcc_version
=$
(gcc
-v 2>&1 |
tail -1 |
awk '{print $3}')
108 4.9.
*|
4.1[0-9].
*|
5.
*.
*)
119 # Scan command line to override defaults
124 if [ -z "$LAST_ARG" ]; then
140 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
158 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
165 if [ -z "$HOST_TOOLS" ]
167 HOST_TOOLS
=$TARGET_TOOLS
170 if [ -z "$PROCESSOR" ]
172 PROCESSOR
=$HOST_PROCESSOR
178 BUILD_OUTPUT_DIR
=$WORKSPACE/Build
/Emulator32
179 LIB_NAMES
="ld-linux.so.2 libdl.so.2 crt1.o crti.o crtn.o"
180 LIB_SEARCH_PATHS
="/usr/lib/i386-linux-gnu /usr/lib32 /lib32 /usr/lib /lib"
184 BUILD_OUTPUT_DIR
=$WORKSPACE/Build
/Emulator
185 LIB_NAMES
="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
186 LIB_SEARCH_PATHS
="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/lib /lib"
190 for libname
in $LIB_NAMES
192 for dirname in $LIB_SEARCH_PATHS
194 if [ -e $dirname/$libname ]; then
195 export HOST_DLINK_PATHS
="$HOST_DLINK_PATHS $dirname/$libname"
201 PLATFORMFILE
=$WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
202 BUILD_DIR
=$BUILD_OUTPUT_DIR/DEBUG_
"$TARGET_TOOLS"
203 BUILD_ROOT_ARCH
=$BUILD_DIR/$PROCESSOR
205 if [[ ! -f `which build` ||
! -f `which GenFv` ]];
207 # build the tools if they don't yet exist. Bin scheme
208 echo Building tools as they are not
in the path
209 make -C $WORKSPACE/BaseTools
210 elif [[ ( -f `which build` ||
-f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source
/C
/bin
]];
212 # build the tools if they don't yet exist. BinWrapper scheme
213 echo Building tools no
$EDK_TOOLS_PATH/Source
/C
/bin directory
214 make -C $WORKSPACE/BaseTools
216 echo using prebuilt tools
220 if [[ "$RUN_EMULATOR" == "yes" ]]; then
224 # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
225 # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
226 # images that get loaded in Host
228 if [[ "$CLANG_VER" == *-ccc-host-triple* ]]
230 # only older versions of Xcode support -ccc-host-tripe, for newer versions
232 cp $WORKSPACE/EmulatorPkg
/Unix
/lldbefi.py
$BUILD_OUTPUT_DIR/DEBUG_
"$TARGET_TOOLS"/$PROCESSOR
233 cd $BUILD_ROOT_ARCH; /usr
/bin
/lldb
--source $WORKSPACE/EmulatorPkg
/Unix
/lldbinit Host
236 cp $WORKSPACE/EmulatorPkg
/Unix
/.gdbinit
$BUILD_OUTPUT_DIR/DEBUG_
"$TARGET_TOOLS"/$PROCESSOR
241 /usr
/bin
/gdb
$BUILD_ROOT_ARCH/Host
-q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg
/Unix
/GdbRun
247 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD
-n 3 clean
248 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
252 make -C $WORKSPACE/BaseTools clean
253 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $HOST_TOOLS -D UNIX_SEC_BUILD
-n 3 clean
254 build
-p $WORKSPACE/EmulatorPkg
/EmulatorPkg.dsc
-a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
255 build
-p $WORKSPACE/ShellPkg
/ShellPkg.dsc
-a IA32
-b $BUILDTARGET -t $TARGET_TOOLS -n 3 clean
262 # Build the edk2 EmulatorPkg
264 if [[ $HOST_TOOLS == $TARGET_TOOLS ]]; then
265 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
267 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
268 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
269 cp $BUILD_OUTPUT_DIR/DEBUG_
"$HOST_TOOLS"/$PROCESSOR/Host
$BUILD_ROOT_ARCH