]>
Commit | Line | Data |
---|---|---|
7ee3b613 A |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (c) 2008 - 2009, Apple, Inc. All rights reserved. | |
4 | # All rights reserved. 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 | |
8 | # | |
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. | |
11 | # | |
12 | ||
13 | set -e | |
14 | shopt -s nocasematch | |
15 | ||
16 | ||
17 | ||
18 | # | |
19 | # Setup workspace if it is not set | |
20 | # | |
21 | if [ -z "$WORKSPACE" ] | |
22 | then | |
23 | echo Initializing workspace | |
24 | cd .. | |
b395a08d | 25 | # This version is for the tools in the BaseTools project. |
26 | # this assumes svn pulls have the same root dir | |
27 | export EDK_TOOLS_PATH=`pwd`/../BaseTools | |
28 | # This version is for the tools source in edk2 | |
29 | # export EDK_TOOLS_PATH=`pwd`/BaseTools | |
7ee3b613 A |
30 | echo $EDK_TOOLS_PATH |
31 | source edksetup.sh BaseTools | |
32 | else | |
33 | echo Building from: $WORKSPACE | |
34 | fi | |
35 | ||
36 | # | |
37 | # Pick a default tool type for a given OS | |
38 | # | |
39 | TARGET_TOOLS=MYTOOLS | |
40 | case `uname` in | |
41 | CYGWIN*) echo Cygwin not fully supported yet. ;; | |
42 | Darwin*) | |
43 | Major=$(uname -r | cut -f 1 -d '.') | |
44 | if [[ $Major == 9 ]] | |
45 | then | |
46 | echo UnixPkg requires Snow Leopard or later OS | |
47 | exit 1 | |
48 | else | |
49 | TARGET_TOOLS=XCODE32 | |
50 | fi | |
51 | ;; | |
52 | Linux*) TARGET_TOOLS=ELFGCC ;; | |
53 | ||
54 | esac | |
55 | ||
56 | BUILD_ROOT_ARCH=$WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32 | |
57 | ||
58 | if [[ ! -f `which build` || ! -f `which GenFv` ]]; | |
59 | then | |
60 | # build the tools if they don't yet exist | |
61 | echo Building tools | |
62 | make -C $WORKSPACE/BaseTools | |
63 | else | |
64 | echo using prebuilt tools | |
65 | fi | |
66 | ||
67 | ||
68 | for arg in "$@" | |
69 | do | |
70 | if [[ $arg == run ]]; then | |
71 | case `uname` in | |
72 | Darwin*) | |
73 | # | |
74 | # On Darwin we can't use dlopen, so we have to load the real PE/COFF images. | |
75 | # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE | |
76 | # images that get loaded in SecMain | |
77 | # | |
78 | cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32 | |
79 | ;; | |
80 | esac | |
81 | ||
82 | /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH | |
83 | exit | |
84 | fi | |
85 | ||
86 | if [[ $arg == cleanall ]]; then | |
87 | make -C $WORKSPACE/BaseTools clean | |
88 | fi | |
89 | done | |
90 | ||
91 | ||
92 | # | |
93 | # Build the edk2 UnixPkg | |
94 | # | |
95 | echo $PATH | |
96 | echo `which build` | |
b395a08d | 97 | # Uncomment this if you want to build the shell. |
98 | #build -p $WORKSPACE/EdkShellPkg/EdkShellPkg.dsc -a IA32 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 | |
7ee3b613 A |
99 | build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS $1 $2 $3 $4 $5 $6 $7 $8 |
100 | exit $? | |
101 |