It is possible for SimplifyCFG to cause PHI nodes to become redundant too late in...
[oota-llvm.git] / utils / buildit / build_llvm
index b4667551ff404f3065b014fe1cbebc58bc44f20b..adcbb3e561bca28fc0262dd3d4f682faf6cdac3d 100755 (executable)
@@ -49,11 +49,14 @@ INSTALL_LIBLTO="$9"
 # A yes/no parameter that controls whether to cross-build for an ARM host.
 ARM_HOSTED_BUILD="${10}"
 
+# A yes/no parameter that controls whether to cross-build for the iOS simulator
+IOS_SIM_BUILD="${11}"
+
 # The version number of the submission, e.g. 1007.
-LLVM_SUBMIT_VERSION="${11}"
+LLVM_SUBMIT_VERSION="${12}"
 
 # The subversion number of the submission, e.g. 03.
-LLVM_SUBMIT_SUBVERSION="${12}"
+LLVM_SUBMIT_SUBVERSION="${13}"
 
 # The current working directory is where the build will happen. It may already
 # contain a partial result of an interrupted build, in which case this script
@@ -63,15 +66,6 @@ DIR=`pwd`
 DARWIN_VERS=`uname -r | sed 's/\..*//'`
 echo DARWIN_VERS = $DARWIN_VERS
 
-DEVELOPER_DIR="${DEVELOPER_DIR-Developer}"
-if [ "$ARM_HOSTED_BUILD" = yes ]; then
-    DT_HOME="$DEST_DIR/usr"
-else
-    DT_HOME="$DEST_DIR/$DEVELOPER_DIR/usr"
-fi
-
-DEST_ROOT="/$DEVELOPER_DIR$DEST_ROOT"
-
 ################################################################################
 # Run the build.
 
@@ -106,12 +100,12 @@ if [ "$ARM_HOSTED_BUILD" = yes ]; then
   # Try to use the platform llvm-gcc. Fall back to gcc if it's not available.
   for prog in gcc g++ ; do
     P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog}
-    T=`xcrun -find llvm-${prog}`
+    T=`xcrun -sdk $SDKROOT -find llvm-${prog}`
     if [ "x$T" = "x" ] ; then
       T=`xcrun -sdk $SDKROOT -find ${prog}`
     fi
     echo '#!/bin/sh' > $P || exit 1
-    echo 'exec '$T' -arch armv6 -isysroot '${SDKROOT}' "$@"' >> $P || exit 1
+    echo 'exec '$T' -arch armv7 -isysroot '${SDKROOT}' "$@"' >> $P || exit 1
     chmod a+x $P || exit 1
   done
 
@@ -131,16 +125,18 @@ elif [ $DARWIN_VERS -gt 9 ]; then
 fi
 
 if [ "$ARM_HOSTED_BUILD" = yes ]; then
-  configure_prefix=$DT_HOME
   configure_opts="--enable-targets=arm --host=arm-apple-darwin10 \
                   --target=arm-apple-darwin10 --build=i686-apple-darwin10"
+elif [ "$IOS_SIM_BUILD" = yes ]; then
+  # Use a non-standard "darwin_sim" host triple to trigger a cross-build.
+  configure_opts="--enable-targets=x86 --host=i686-apple-darwin_sim \
+                  --build=i686-apple-darwin10"
 else
-  configure_prefix=$DT_HOME/local
   configure_opts="--enable-targets=arm,x86,powerpc,cbe"
 fi
 
 if [ \! -f Makefile.config ]; then
-  $SRC_DIR/configure --prefix=$configure_prefix $configure_opts \
+  $SRC_DIR/configure --prefix=$DEST_DIR$DEST_ROOT $configure_opts \
     --enable-assertions=$LLVM_ASSERTIONS \
     --enable-optimized=$LLVM_OPTIMIZED \
     --disable-bindings \
@@ -254,7 +250,7 @@ if [ "x$LLVM_DEBUG" != "x1" ]; then
 fi
 
 # Copy over the tblgen utility.
-cp `find $DIR -name tblgen` $DT_HOME/local/bin
+cp `find $DIR -name tblgen` $DEST_DIR$DEST_ROOT/bin
 
 # Remove .dir files 
 cd $DEST_DIR$DEST_ROOT
@@ -273,8 +269,11 @@ else
         -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \;
 fi
 
-# The Hello dylib is an example of how to build a pass. No need to install it.
+# The Hello dylib is an example of how to build a pass.
+# The BugpointPasses module is only used to test bugpoint.
+# These unversioned dylibs cause verification failures, so do not install them.
 rm $DEST_DIR$DEST_ROOT/lib/libLLVMHello.dylib
+rm $DEST_DIR$DEST_ROOT/lib/libBugpointPasses.dylib
 
 # Compress manpages
 MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
@@ -324,12 +323,26 @@ find obj-* -name \*.\[chy\] -o -name \*.cpp -print \
 
 cd $DEST_DIR$DEST_ROOT
 if [ "$INSTALL_LIBLTO" = "yes" ]; then
+  DT_HOME="$DEST_DIR/Developer/usr"
   mkdir -p $DT_HOME/lib
   mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
 
+  # Save a copy of the unstripped dylib
+  mkdir -p $SYM_DIR/Developer/usr/lib
+  cp $DT_HOME/lib/libLTO.dylib $SYM_DIR/Developer/usr/lib/libLTO.dylib
+
   # Use '-l' to strip i386 modules. N.B. that flag doesn't work with kext or
   # PPC objects!
   strip -arch all -Sl $DT_HOME/lib/libLTO.dylib
+
+  if [ "x$DISABLE_USR_LINKS" == "x" ]; then
+    # Add a symlink in /usr/lib for B&I.
+    mkdir -p $DEST_DIR/usr/lib/
+    (cd $DEST_DIR/usr/lib && \
+      ln -s ../../Developer/usr/lib/libLTO.dylib ./libLTO.dylib)
+  fi
+else
+  rm -f lib/libLTO.dylib
 fi
 rm -f lib/libLTO.a lib/libLTO.la
 
@@ -353,18 +366,9 @@ chgrp -h -R wheel $DEST_DIR
 chgrp -R wheel $DEST_DIR
 
 ################################################################################
-# Remove tar ball from docs directory
+# Remove the docs directory
 
-find $DEST_DIR -name html.tar.gz -exec rm {} \;
-
-################################################################################
-# symlinks so that B&I can find things
-
-if [ "$INSTALL_LIBLTO" = "yes" ]; then
-  mkdir -p $DEST_DIR/usr/lib/
-  cd $DEST_DIR/usr/lib && \
-    ln -s ../../$DEVELOPER_DIR/usr/lib/libLTO.dylib ./libLTO.dylib
-fi
+rm -rf $DEST_DIR$DEST_ROOT/docs
 
 ################################################################################
 # w00t! Done!