]>
Commit | Line | Data |
---|---|---|
949f388f | 1 | #!/bin/bash |
2 | # | |
3 | # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR> | |
53a6813f | 4 | # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> |
949f388f | 5 | # |
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 | |
10 | # | |
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. | |
13 | # | |
14 | ||
15 | set -e | |
16 | shopt -s nocasematch | |
17 | ||
18 | ||
19 | # | |
20 | # Setup workspace if it is not set | |
21 | # | |
22 | if [ -z "$WORKSPACE" ] | |
23 | then | |
24 | echo Initializing workspace | |
25 | if [ ! -e `pwd`/edksetup.sh ] | |
26 | then | |
27 | cd ../.. | |
28 | fi | |
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 | |
34 | echo $EDK_TOOLS_PATH | |
35 | source edksetup.sh BaseTools | |
36 | else | |
37 | echo Building from: $WORKSPACE | |
38 | fi | |
39 | ||
40 | # | |
41 | # Pick a default tool type for a given OS | |
42 | # | |
949f388f | 43 | UNIXPKG_TOOLS=GCC44 |
44 | NETWORK_SUPPORT= | |
d59326d3 | 45 | BUILD_NEW_SHELL= |
46 | BUILD_FAT= | |
949f388f | 47 | case `uname` in |
48 | CYGWIN*) echo Cygwin not fully supported yet. ;; | |
49 | Darwin*) | |
50 | Major=$(uname -r | cut -f 1 -d '.') | |
51 | if [[ $Major == 9 ]] | |
52 | then | |
53 | echo UnixPkg requires Snow Leopard or later OS | |
54 | exit 1 | |
55 | else | |
56 | TARGET_TOOLS=XCODE32 | |
57 | UNIXPKG_TOOLS=XCLANG | |
58 | fi | |
d59326d3 | 59 | # NETWORK_SUPPORT="-D NETWORK_SUPPORT" |
033d0e5f | 60 | BUILD_NEW_SHELL="-D BUILD_NEW_SHELL" |
61 | BUILD_FAT="-D BUILD_FAT" | |
949f388f | 62 | ;; |
949f388f | 63 | esac |
64 | ||
27f6b4f8 | 65 | if [ -d /lib64 ] |
66 | then | |
67 | export LIB_ARCH_SFX=64 | |
68 | fi | |
69 | ||
53a6813f | 70 | if [ -z "$TARGET_TOOLS" ] |
71 | then | |
72 | TARGET_TOOLS=$UNIXPKG_TOOLS | |
73 | fi | |
74 | ||
949f388f | 75 | BUILD_ROOT_ARCH=$WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64 |
76 | ||
77 | if [[ ! -f `which build` || ! -f `which GenFv` ]]; | |
78 | then | |
79 | # build the tools if they don't yet exist. Bin scheme | |
80 | echo Building tools as they are not in the path | |
81 | make -C $WORKSPACE/BaseTools | |
82 | elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]]; | |
83 | then | |
84 | # build the tools if they don't yet exist. BinWrapper scheme | |
85 | echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory | |
86 | make -C $WORKSPACE/BaseTools | |
87 | else | |
88 | echo using prebuilt tools | |
89 | fi | |
90 | ||
91 | ||
92 | for arg in "$@" | |
93 | do | |
94 | if [[ $arg == run ]]; then | |
95 | case `uname` in | |
96 | Darwin*) | |
97 | # | |
98 | # On Darwin we can't use dlopen, so we have to load the real PE/COFF images. | |
99 | # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE | |
100 | # images that get loaded in SecMain | |
101 | # | |
102 | cp $WORKSPACE/InOsEmuPkg/Unix/.gdbinit $WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64 | |
103 | ;; | |
104 | esac | |
105 | ||
fe7e504f | 106 | /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/InOsEmuPkg/Unix/GdbRun |
949f388f | 107 | exit |
108 | fi | |
109 | ||
110 | if [[ $arg == cleanall ]]; then | |
111 | make -C $WORKSPACE/BaseTools clean | |
112 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean | |
113 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean | |
114 | build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean | |
115 | exit $? | |
116 | fi | |
117 | ||
118 | if [[ $arg == clean ]]; then | |
119 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean | |
120 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean | |
121 | exit $? | |
122 | fi | |
123 | ||
949f388f | 124 | done |
125 | ||
126 | ||
127 | # | |
128 | # Build the edk2 UnixPkg | |
129 | # | |
53a6813f | 130 | if [[ $TARGET_TOOLS == $UNIXPKG_TOOLS ]]; then |
131 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -D UNIX_SEC_BUILD $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8 | |
132 | else | |
133 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D UNIX_SEC_BUILD -D SKIP_MAIN_BUILD -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules | |
134 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8 | |
135 | cp $WORKSPACE/Build/EmuUnixX64/DEBUG_"$TARGET_TOOLS"/X64/SecMain $WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64 | |
136 | fi | |
949f388f | 137 | exit $? |
138 |