]>
Commit | Line | Data |
---|---|---|
112a857f | 1 | #!/bin/bash |
2 | # | |
3 | # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR> | |
4 | # Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> | |
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 | # | |
43 | TARGET_TOOLS=MYTOOLS | |
44 | UNIXPKG_TOOLS=GCC44 | |
45 | NETWORK_SUPPORT= | |
46 | BUILD_NEW_SHELL= | |
47 | BUILD_FAT= | |
48 | case `uname` in | |
49 | CYGWIN*) echo Cygwin not fully supported yet. ;; | |
50 | Darwin*) | |
51 | Major=$(uname -r | cut -f 1 -d '.') | |
52 | if [[ $Major == 9 ]] | |
53 | then | |
54 | echo UnixPkg requires Snow Leopard or later OS | |
55 | exit 1 | |
56 | else | |
57 | TARGET_TOOLS=XCODE32 | |
58 | UNIXPKG_TOOLS=XCLANG | |
59 | fi | |
112a857f | 60 | BUILD_NEW_SHELL="-D BUILD_NEW_SHELL" |
61 | BUILD_FAT="-D BUILD_FAT" | |
62 | ;; | |
63 | Linux*) TARGET_TOOLS=ELFGCC ;; | |
64 | ||
65 | esac | |
66 | ||
e7523e06 | 67 | BUILD_ROOT_ARCH=$WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32 |
112a857f | 68 | |
69 | if [[ ! -f `which build` || ! -f `which GenFv` ]]; | |
70 | then | |
71 | # build the tools if they don't yet exist. Bin scheme | |
72 | echo Building tools as they are not in the path | |
73 | make -C $WORKSPACE/BaseTools | |
74 | elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]]; | |
75 | then | |
76 | # build the tools if they don't yet exist. BinWrapper scheme | |
77 | echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory | |
78 | make -C $WORKSPACE/BaseTools | |
79 | else | |
80 | echo using prebuilt tools | |
81 | fi | |
82 | ||
83 | ||
84 | for arg in "$@" | |
85 | do | |
86 | if [[ $arg == run ]]; then | |
87 | case `uname` in | |
88 | Darwin*) | |
89 | # | |
90 | # On Darwin we can't use dlopen, so we have to load the real PE/COFF images. | |
91 | # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE | |
92 | # images that get loaded in SecMain | |
93 | # | |
e7523e06 | 94 | cp $WORKSPACE/InOsEmuPkg/Unix/.gdbinit $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32 |
112a857f | 95 | ;; |
96 | esac | |
97 | ||
fe7e504f | 98 | /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/InOsEmuPkg/Unix/GdbRun |
112a857f | 99 | exit |
100 | fi | |
101 | ||
102 | if [[ $arg == cleanall ]]; then | |
103 | make -C $WORKSPACE/BaseTools clean | |
104 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean | |
105 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean | |
106 | build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean | |
107 | exit $? | |
108 | fi | |
109 | ||
110 | if [[ $arg == clean ]]; then | |
111 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean | |
112 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean | |
113 | exit $? | |
114 | fi | |
115 | ||
116 | done | |
117 | ||
118 | ||
119 | # | |
120 | # Build the edk2 UnixPkg | |
121 | # | |
122 | echo $PATH | |
123 | echo `which build` | |
ea203f22 | 124 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D SEC_ONLY -D BUILD_32 -D SKIP_MAIN_BUILD -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules |
e7523e06 | 125 | build -p $WORKSPACE/InOsEmuPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -D BUILD_32 $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8 |
126 | cp $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$TARGET_TOOLS"/IA32/SecMain $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32 | |
112a857f | 127 | exit $? |
128 |