Changed local variable "ran" to static class member to fix multi-thread build issue
[mirror_edk2.git] / edksetup.sh
1 #
2 # Copyright (c) 2006, Intel Corporation
3 # All rights reserved. This program and the accompanying materials
4 # are licensed and made available under the terms and conditions of the BSD License
5 # which accompanies this distribution. The full text of the license may be found at
6 # http://opensource.org/licenses/bsd-license.php
7 #
8 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 # Setup the environment for unix-like systems running a bash-like shell.
12 # This file must be "sourced" notcuted. For example: ". edksetup.sh"
13
14 export WORKSPACE=$(pwd)
15
16 # In unix-like system, gcc is the compiler for building tools
17 export TOOL_CHAIN=gcc
18
19 if [ "$JAVA_HOME" == "" ]
20 then
21 echo "Please set JAVA_HOME before sourcing this script."
22 else
23 if [ "$ANT_HOME" == "" ]
24 then
25 echo "Please set ANT_HOME before sourcing this script."
26 else
27 if [ "$XMLBEANS_HOME" == "" ]
28 then
29 echo "Please set XMLBEANS_HOME before sourcing this script."
30 else
31
32 case "`uname`" in
33 CYGWIN*)
34 # Convert paths to unix format.
35 # This is to remove possible wrong path when converting CLASSPATH back to windows format
36 export WORKSPACE=`cygpath -u $WORKSPACE`
37 export ANT_HOME=`cygpath -u $ANT_HOME`
38 export XMLBEANS_HOME=`cygpath -u $XMLBEANS_HOME`
39 export FRAMEWORK_TOOLS_PATH=`cygpath -u $FRAMEWORK_TOOLS_PATH`
40 ;;
41 esac
42
43 # These should be ok as they are.
44 export CLASSPATH=$WORKSPACE/Tools/Jars/SurfaceArea.jar:$WORKSPACE/Tools/Jars/frameworktasks.jar:$WORKSPACE/Tools/Jars/cpptasks.jar:$WORKSPACE/Tools/Jars/PcdTools.jar:$WORKSPACE/Tools/Jars/GenBuild.jar:$XMLBEANS_HOME/lib/resolver.jar:$XMLBEANS_HOME/lib/xbean.jar:$XMLBEANS_HOME/lib/xmlpublic.jar:$XMLBEANS_HOME/lib/jsr173_1.0_api.jar:$XMLBEANS_HOME/lib/saxon8.jar:$XMLBEANS_HOME/lib/xbean_xpath.jar
45 export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/Jars/Common.jar
46 export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/Jars/PcdTools.jar
47 export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/Bin/FrameworkWizard.jar
48 export FRAMEWORK_TOOLS_PATH=$WORKSPACE/Tools/bin
49 export PATH=$FRAMEWORK_TOOLS_PATH:$ANT_HOME/bin:$JAVA_HOME/bin:$PATH
50 # In some unix-like system, following export is to export system's environment to user's environment
51 export ANT_HOME=$ANT_HOME
52 export JAVA_HOME=$JAVA_HOME
53 export XMLBEANS_HOME=$XMLBEANS_HOME
54
55 # Handle any particulars down here.
56 case "`uname`" in
57 CYGWIN*)
58 # Convert paths to windows format.
59 export WORKSPACE=`cygpath -w $WORKSPACE`
60 export ANT_HOME=`cygpath -w -p $ANT_HOME`
61 export XMLBEANS_HOME=`cygpath -w -p $XMLBEANS_HOME`
62 export CLASSPATH=`cygpath -w -p $CLASSPATH`
63 export FRAMEWORK_TOOLS_PATH=`cygpath -w -p $FRAMEWORK_TOOLS_PATH`
64 ;;
65 esac
66
67 if [ \
68 "$1" = Rebuild -o \
69 "$1" = ForceRebuild -o \
70 ! -e "$WORKSPACE/Tools/Jars/Common.jar" -o \
71 ! -e "$WORKSPACE/Tools/Jars/PcdTools.jar" -o \
72 ! -e "$WORKSPACE/Tools/Jars/GenBuild.jar" -o \
73 ! -e "$WORKSPACE/Tools/Jars/SurfaceArea.jar" -o \
74 ! -e "$WORKSPACE/Tools/Jars/cpptasks.jar" -o \
75 ! -e "$WORKSPACE/Tools/Jars/frameworktasks.jar" -o \
76 ! -e "$WORKSPACE/Tools/bin/FrameworkWizard.jar" -o \
77 ! -e "$WORKSPACE/Tools/bin/CompressDll.dll" -o \
78 ! -e "$WORKSPACE/Tools/bin/CreateMtFile" -o \
79 ! -e "$WORKSPACE/Tools/bin/EfiCompress" -o \
80 ! -e "$WORKSPACE/Tools/bin/EfiRom" -o \
81 ! -e "$WORKSPACE/Tools/bin/FlashMap" -o \
82 ! -e "$WORKSPACE/Tools/bin/FwImage" -o \
83 ! -e "$WORKSPACE/Tools/bin/GenAcpiTable" -o \
84 ! -e "$WORKSPACE/Tools/bin/GenCRC32Section" -o \
85 ! -e "$WORKSPACE/Tools/bin/GenCapsuleHdr" -o \
86 ! -e "$WORKSPACE/Tools/bin/GenDepex" -o \
87 ! -e "$WORKSPACE/Tools/bin/GenFfsFile" -o \
88 ! -e "$WORKSPACE/Tools/bin/GenFvImage" -o \
89 ! -e "$WORKSPACE/Tools/bin/GenSection" -o \
90 ! -e "$WORKSPACE/Tools/bin/GenTEImage" -o \
91 ! -e "$WORKSPACE/Tools/bin/MakeDeps" -o \
92 ! -e "$WORKSPACE/Tools/bin/ModifyInf" -o \
93 ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ia32" -o \
94 ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ipf" -o \
95 ! -e "$WORKSPACE/Tools/bin/PeiRebase_X64" -o \
96 ! -e "$WORKSPACE/Tools/bin/SecApResetVectorFixup" -o \
97 ! -e "$WORKSPACE/Tools/bin/SecFixup" -o \
98 ! -e "$WORKSPACE/Tools/bin/SetStamp" -o \
99 ! -e "$WORKSPACE/Tools/bin/SplitFile" -o \
100 ! -e "$WORKSPACE/Tools/bin/StrGather" -o \
101 ! -e "$WORKSPACE/Tools/bin/Strip" -o \
102 ! -e "$WORKSPACE/Tools/bin/VfrCompile" -o \
103 ! -e "$WORKSPACE/Tools/bin/ZeroDebugData" -o \
104 ! -e "$WORKSPACE/Tools/bin/antlr" -o \
105 ! -e "$WORKSPACE/Tools/bin/dlg" ]
106 then
107 case "$1" in
108 ForceRebuild)
109 ant -noclasspath -f $WORKSPACE/Tools/build.xml cleanall all
110 ;;
111 *)
112 ant -noclasspath -f $WORKSPACE/Tools/build.xml all
113 ;;
114 esac
115 fi
116 fi
117 fi
118 fi