]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - UnixPkg/build.sh
Fixed an error when parse time opcode.
[mirror_edk2.git] / UnixPkg / build.sh
... / ...
CommitLineData
1#!/bin/bash
2#
3# Copyright (c) 2008 - 2009, 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
15set -e
16shopt -s nocasematch
17
18
19#
20# Setup workspace if it is not set
21#
22if [ -z "$WORKSPACE" ]
23then
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
36else
37 echo Building from: $WORKSPACE
38fi
39
40#
41# Pick a default tool type for a given OS
42#
43TARGET_TOOLS=MYTOOLS
44NETWORK_SUPPORT=
45case `uname` in
46 CYGWIN*) echo Cygwin not fully supported yet. ;;
47 Darwin*)
48 Major=$(uname -r | cut -f 1 -d '.')
49 if [[ $Major == 9 ]]
50 then
51 echo UnixPkg requires Snow Leopard or later OS
52 exit 1
53 else
54 TARGET_TOOLS=XCODE32
55 fi
56 NETWORK_SUPPORT="-D NETWORK_SUPPORT"
57 ;;
58 Linux*) TARGET_TOOLS=ELFGCC ;;
59
60esac
61
62BUILD_ROOT_ARCH=$WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32
63
64if [[ ! -f `which build` || ! -f `which GenFv` ]];
65then
66 # build the tools if they don't yet exist. Bin scheme
67 echo Building tools as they are not in the path
68 make -C $WORKSPACE/BaseTools
69elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
70then
71 # build the tools if they don't yet exist. BinWrapper scheme
72 echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
73 make -C $WORKSPACE/BaseTools
74else
75 echo using prebuilt tools
76fi
77
78
79for arg in "$@"
80do
81 if [[ $arg == run ]]; then
82 case `uname` in
83 Darwin*)
84 #
85 # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
86 # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
87 # images that get loaded in SecMain
88 #
89 cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/Unix/DEBUG_"$TARGET_TOOLS"/IA32
90 ;;
91 esac
92
93 /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH
94 exit
95 fi
96
97 if [[ $arg == cleanall ]]; then
98 make -C $WORKSPACE/BaseTools clean
99 build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 clean
100 exit $?
101 fi
102
103 if [[ $arg == clean ]]; then
104 build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 clean
105 exit $?
106 fi
107
108 if [[ $arg == shell ]]; then
109 build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 $2 $3 $4 $5 $6 $7 $8
110 exit $?
111 fi
112done
113
114
115#
116# Build the edk2 UnixPkg
117#
118echo $PATH
119echo `which build`
120build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
121exit $?
122