+ if ! ( ${MAKE} -j $NumJobs -k check-all \
+ 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
+ deferred_error $Phase $Flavor "check-all failed"
+ fi
+
+ if [ "$use_autoconf" = "yes" ]; then
+ # In the cmake build, unit tests are run as part of check-all.
+ if ! ( ${MAKE} -k unittests 2>&1 | \
+ tee $LogDir/llvm.unittests-Phase$Phase-$Flavor.log ) ; then
+ deferred_error $Phase $Flavor "unittests failed"
+ fi
+ fi
+
+ cd $BuildDir
+}
+
+# Clean RPATH. Libtool adds the build directory to the search path, which is
+# not necessary --- and even harmful --- for the binary packages we release.
+function clean_RPATH() {
+ if [ `uname -s` = "Darwin" ]; then
+ return
+ fi
+ local InstallPath="$1"
+ for Candidate in `find $InstallPath/{bin,lib} -type f`; do
+ if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
+ if rpath=`objdump -x $Candidate | grep 'RPATH'` ; then
+ rpath=`echo $rpath | sed -e's/^ *RPATH *//'`
+ if [ -n "$rpath" ]; then
+ newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
+ chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
+ fi
+ fi
+ fi
+ done
+}
+
+# Create a package of the release binaries.
+function package_release() {
+ cwd=`pwd`
+ cd $BuildDir/Phase3/Release
+ mv llvmCore-$Release-$RC.install/usr/local $Package
+ if [ "$use_gzip" = "yes" ]; then
+ tar cfz $BuildDir/$Package.tar.gz $Package
+ else
+ tar cfJ $BuildDir/$Package.tar.xz $Package
+ fi
+ mv $Package llvmCore-$Release-$RC.install/usr/local
+ cd $cwd
+}
+
+# Build and package the OpenMP run-time. This is still experimental and not
+# meant for official testing in the release, but as a way for providing
+# binaries as a convenience to those who want to try it out.
+function build_OpenMP() {
+ cwd=`pwd`
+
+ rm -rf $BuildDir/Phase3/openmp
+ rm -rf $BuildDir/Phase3/openmp.install
+ mkdir -p $BuildDir/Phase3/openmp
+ cd $BuildDir/Phase3/openmp
+ clang=$BuildDir/Phase3/Release/llvmCore-$Release-$RC.install/usr/local/bin/clang
+
+ echo "#" cmake -DCMAKE_C_COMPILER=${clang} -DCMAKE_CXX_COMPILER=${clang}++ \
+ -DCMAKE_BUILD_TYPE=Release -DLIBOMP_MICRO_TESTS=on \
+ $BuildDir/openmp.src/runtime
+ cmake -DCMAKE_C_COMPILER=${clang} -DCMAKE_CXX_COMPILER=${clang}++ \
+ -DCMAKE_BUILD_TYPE=Release -DLIBOMP_MICRO_TESTS=on \
+ $BuildDir/openmp.src/runtime
+
+ echo "# Building OpenMP run-time"
+ echo "# ${MAKE} -j $NumJobs VERBOSE=1"
+ ${MAKE} -j $NumJobs VERBOSE=1
+ echo "# ${MAKE} libomp-micro-tests VERBOSE=1"
+ ${MAKE} libomp-micro-tests VERBOSE=1
+ echo "# ${MAKE} install DESTDIR=$BuildDir/Phase3/openmp.install"
+ ${MAKE} install DESTDIR=$BuildDir/Phase3/openmp.install
+
+ OpenMPPackage=OpenMP-$Release
+ if [ $RC != "final" ]; then
+ OpenMPPackage=$OpenMPPackage-$RC
+ fi
+ OpenMPPackage=$OpenMPPackage-$Triple
+
+ mv $BuildDir/Phase3/openmp.install/usr/local $BuildDir/$OpenMPPackage