-# Note: If compiling with GCC 4.0, don't pass the -jN flag. Building universal
-# already has parallelism and we don't want to make the builders hit swap by
-# firing off too many gccs at the same time.
-if [ "x$MAJ_VER" != "x4" -o "x$MIN_VER" != "x0" ]; then
- # Figure out how many make processes to run.
- SYSCTL=`sysctl -n hw.activecpu`
+if [ "$ARM_HOSTED_BUILD" = yes ]; then
+ # The cross-tools' build process expects to find an existing cross toolchain
+ # under names like 'arm-apple-darwin$DARWIN_VERS-as'; so make them.
+ rm -rf $DIR/bin || exit 1
+ mkdir $DIR/bin || exit 1
+ for prog in ar nm ranlib strip lipo ld as ; do
+ P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog}
+ T=`xcrun -sdk $SDKROOT -find ${prog}`
+ ln -s $T $DIR/bin/$prog
+ echo '#!/bin/sh' > $P || exit 1
+ echo 'exec '$T' "$@"' >> $P || exit 1
+ chmod a+x $P || exit 1
+ done
+ # Set up the links for clang.
+ for prog in clang clang++ ; do
+ P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog}
+ T=`xcrun -sdk $SDKROOT -find ${prog}`
+ ln -s $T $DIR/bin/$prog
+ echo '#!/bin/sh' > $P || exit 1
+ echo 'exec '$T' -arch armv7 -isysroot '${SDKROOT}' "$@"' >> $P || exit 1
+ chmod a+x $P || exit 1
+ done
+
+ PATH=$DIR/bin:$PATH
+
+ unset SDKROOT && \
+ $SRC_DIR/configure $COMMON_CONFIGURE_OPTS \
+ --enable-targets=arm \
+ --host=arm-apple-darwin10 \
+ --target=arm-apple-darwin10 \
+ --build=i686-apple-darwin10 \
+ --program-prefix="" \
+ || exit 1
+
+ if [ -n "$IPHONEOS_DEPLOYMENT_TARGET" ]; then
+ COMMON_MAKEFLAGS="$COMMON_MAKEFLAGS \
+ DEPLOYMENT_TARGET=-mios-version-min=$IPHONEOS_DEPLOYMENT_TARGET"
+ fi
+
+ make $JOBS_FLAG $COMMON_MAKEFLAGS SDKROOT= UNIVERSAL_ARCH="$HOSTS" \
+ CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'"
+ if [ $? != 0 ] ; then
+ echo "error: LLVM 'make' failed!"
+ exit 1
+ fi