[llvm-commits] [llvm-gcc-4.2] r43759 - /llvm-gcc-4.2/trunk/build_gcc

Bill Wendling isanbard at gmail.com
Mon Nov 5 22:41:58 PST 2007


Author: void
Date: Tue Nov  6 00:41:57 2007
New Revision: 43759

URL: http://llvm.org/viewvc/llvm-project?rev=43759&view=rev
Log:
A long time ago, and yet somehow in the future...

                            Chapter IV

It was a dark time in the Subversion tree. The Federation, headed by
the dark Sith Lord Vader, managed to break into the Subversion tree of
the small band of rebels and submit a patch to build_gcc under the
pseudonym "void".

All was not lost! Jedi Devang noticed this breach and informed our
hero that this was in error! And that the LLVM core was to be compiled
separately from the LLVM-GCC front-ends.

The patch will hence be reverted...plus a couple of new things to help
it along...

[Cue star field and space ship]

Modified:
    llvm-gcc-4.2/trunk/build_gcc

Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=43759&r1=43758&r2=43759&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Tue Nov  6 00:41:57 2007
@@ -22,22 +22,10 @@
 # installed.
 TARGETS=`echo $2 | $TRANSLATE_ARCH`
 
-# LLVM LOCAL begin
-# LLVM does not require host name translation. 
-LLVM_HOSTS=$1
-# LLVM target list is comma separated list. 
-#FIXME : Hard code targets. See LLVMTARGETOBJ comment in gcc/Makefile.in
-LLVM_TARGETS="x86,powerpc"
-# LLVm LOCAL end
-
 # The GNU makefile target ('bootstrap' by default).
 BOOTSTRAP=${BOOTSTRAP-bootstrap}
-if [ "x$LLVM_DEBUG" == "x" ]; then
-    if [ "$BOOTSTRAP" != bootstrap ]; then
-	bootstrap=--disable-bootstrap
-    fi
-else
-    BOOTSTRAP=
+if [ "$BOOTSTRAP" != bootstrap ]; then
+    bootstrap=--disable-bootstrap
 fi
 
 # The B&I build srcript (~rc/bin/buildit) accepts an '-othercflags'
@@ -45,13 +33,7 @@
 # $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto).
 # We will allow this to override the default $CFLAGS and $CXXFLAGS.
 
-if [ "x$LLVM_DEBUG" == "x" ]; then
-    CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
-    OPTIMIZE_OPTS="ENABLE_OPTIMIZED=1"
-else
-    CFLAGS="-g"
-    OPTIMIZE_OPTS=
-fi
+CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
 
 # This isn't a parameter; it is the architecture of the current machine.
 BUILD=`arch | $TRANSLATE_ARCH`
@@ -86,20 +68,10 @@
 # The nineth parameter is the subversion number of the submission, e.g. 03.
 LLVM_GCC_SUBMIT_SUBVERSION="$9"
 
-# The tenth parameter is a yes/no that indicates whether assertions should be
-# enabled in the LLVM libs/tools.
-LLVM_ASSERTIONS="${10}"
-
 # LLVM_INSTALL_PREFIX - This is the prefix where LLVM tools/headers/libraries
 # and the llvm-gcc/llvm-g++ symlinks get installed.
 LLVM_INSTALL_PREFIX=/usr/local
 
-# LLVM_ARCHS - This tells us which architectures we'd like the libraries to be
-# build for. The default is 4-way.
-if [ "x$LLVM_ARCHS" == "x" ]; then
-    LLVM_ARCHS="ppc i386 ppc64 x86_64"
-fi
-# APPLE LOCAL end LLVM
 
 # The current working directory is where the build will happen.
 # It may already contain a partial result of an interrupted build,
@@ -125,12 +97,6 @@
 fi
 # LLVM LOCAL end
 
-# APPLE LOCAL begin ARM ARM_CONFIGFLAGS
-# For ARM, grab all system files from an SDK.
-ARM_SYSROOT="/Developer/SDKs/Extra"
-ARM_CONFIGFLAGS="--with-sysroot=\"$ARM_SYSROOT\""
-# APPLE LOCAL end ARM ARM_CONFIGFLAGS
-
 # This is the libstdc++ version to use.
 LIBSTDCXX_VERSION=4.0.0
 
@@ -157,17 +123,10 @@
 rm -f /usr/lib/gcc/*/4.0.0/specs
 
 # These are the configure and build flags that are used.
-# APPLE LOCAL begin LLVM  Support for non /usr $DEST_ROOT, use libstdc++
-
-if [ "x$LLVM_DEBUG" == "x" ]; then
-    CHECKING_FLAGS="--disable-checking --enable-werror"
-else
-    CHECKING_FLAGS="--enable-checking"
-fi
-
-CONFIGFLAGS="$CHECKING_FLAGS \
+CONFIGFLAGS="--disable-checking -enable-werror \
+  --disable-multilib \
   --prefix=$DEST_ROOT \
-  --mandir=$LLVM_INSTALL_PREFIX/share/man \
+  --mandir=\${prefix}/share/man \
   --enable-languages=c,objc,c++,obj-c++ \
   --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
   --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \
@@ -176,38 +135,8 @@
 
 # LLVM LOCAL begin
 if [ "$ENABLE_LLVM" == true ]; then
-    CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=$DIR/obj-llvm"
-
-    # Build the LLVM tree universal.
-    LLVMCONFIGFLAGS="--prefix=$DEST_DIR$LLVM_INSTALL_PREFIX \
-                     --enable-targets=$LLVM_TARGETS \
-                     --enable-assertions=$LLVM_ASSERTIONS"
-    mkdir -p $DIR/obj-llvm || exit 1
-    cd $DIR/obj-llvm || exit 1
-    if [ \! -f Makefile.config ]; then
-	$SRC_DIR/llvm/configure $LLVMCONFIGFLAGS || exit 1
-    fi
-
-    if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then
-	LLVM_VERSION="$LLVM_SUBMIT_VERSION"
-    else
-	LLVM_VERSION="$LLVM_SUBMIT_VERSION-$LLVM_SUBMIT_SUBVERSION"
-    fi
-
-    # Note: Don't pass -jN here.  Building universal already has
-    # parallelism and we don't want to make the builders hit swap by
-    # firing off too many gcc's at the same time.
-    ## FIXME: Remove -O2 when rdar://4560645 is fixed.
-    make $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$LLVM_ARCHS" \
-         OPTIMIZE_OPTION='-O2' \
-	 CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'"
-
-    if ! test $? == 0 ; then
-	echo "error: LLVM 'make' failed!"
-	exit 1
-    fi 
+  CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=/usr/local"
 fi
-# LLVM LOCAL end
 
 # Figure out how many make processes to run.
 SYSCTL=`sysctl -n hw.activecpu`
@@ -232,10 +161,6 @@
   # Build llvm-gcc in 'dylib mode'.
   MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1"
   MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_GCC_SUBMIT_VERSION"
-
-  if [ "$LLVM_ASSERTIONS" == no ]; then
-    MAKEFLAGS="$MAKEFLAGS DISABLE_LLVMASSERTIONS=1"
-  fi
 fi
 # LLVM LOCAL end
 
@@ -248,10 +173,8 @@
    --host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1
 fi
 # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
-# Also keep unset for cross compilers so that the cross built libraries are
-# comparable to the native built libraries.
-unset RC_DEBUG_OPTIONS
-make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
+RC_DEBUG_OPTIONS= \
+  make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
 make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
   CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
@@ -295,12 +218,7 @@
   mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1
    cd $DIR/obj-$BUILD-$t || exit 1
    if [ \! -f Makefile ]; then
-     if [ "x$LLVM_DEBUG" == "x" ]; then
-       WERROR_FLAGS="--enable-werror-always"
-     else
-       WERROR_FLAGS=""
-     fi
-     $SRC_DIR/configure $CONFIGFLAGS $WERROR_FLAGS \
+    $SRC_DIR/configure $CONFIGFLAGS --enable-werror-always \
       --program-prefix=$t-apple-darwin$DARWIN_VERS- \
       --host=$BUILD-apple-darwin$DARWIN_VERS --target=$t-apple-darwin$DARWIN_VERS || exit 1
    fi
@@ -365,16 +283,15 @@
 
 # LLVM LOCAL Don't install HTML docs.
 if [ "$ENABLE_LLVM" == false ]; then
-  # HTML documentation
-  HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
-  mkdir -p ".$HTMLDIR" || exit 1
-  cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
+# HTML documentation
+HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
+mkdir -p ".$HTMLDIR" || exit 1
+cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
 fi
 
 # Manual pages
-mkdir -p .$LLVM_INSTALL_PREFIX/share || exit 1
-# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT
-cp -Rp $DIR/dst-$BUILD-$BUILD$LLVM_INSTALL_PREFIX/share/man .$LLVM_INSTALL_PREFIX/share/ \
+mkdir -p .$DEST_ROOT/share || exit 1
+cp -Rp $DIR/dst-$BUILD-$BUILD$DEST_ROOT/share/man .$DEST_ROOT/share/ \
   || exit 1
 # exclude fsf-funding.7 gfdl.7 gpl.7 as they are currently built in
 # the gcc project
@@ -432,6 +349,9 @@
 
 # And copy libgomp stuff by hand...
 for t in $TARGETS ; do
+    if [ ! -d .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ ]; then
+	mkdir -p .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ || exit 1
+    fi
     for h in $HOSTS ; do
 	if [ $h = $t ] ; then
 	    cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/libgomp.a \
@@ -439,11 +359,17 @@
 	    cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/libgomp.spec \
 		.$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ || exit 1
 	    if [ $h = 'powerpc' ] ; then
+		if [ ! -d .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ ]; then
+		    mkdir -p .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ || exit 1
+		fi
 		cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/ppc64/libgomp.a \
 		    .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ || exit 1
 		cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/ppc64/libgomp.spec \
 		    .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ppc64/ || exit 1
 	    elif [ $h = 'i686' ] ; then
+		if [ ! -d .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/x86_64/ ]; then
+		    mkdir -p .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/x86_64/ || exit 1
+		fi
 		cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/x86_64/libgomp.a \
 		    .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/x86_64/ || exit 1
 		cp -p $DIR/dst-$h-$t$DEST_ROOT/lib/x86_64/libgomp.spec \
@@ -485,7 +411,7 @@
 done
 
 # Add extra man page symlinks for 'c++' and for arch-specific names.
-MDIR=$DEST_DIR$LLVM_INSTALL_PREFIX/share/man/man1
+MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
 ln -f $MDIR/g++-$MAJ_VERS.1 $MDIR/c++-$MAJ_VERS.1 || exit 1
 for t in $TARGETS ; do
   ln -f $MDIR/gcc-$MAJ_VERS.1 $MDIR/$t-apple-darwin$DARWIN_VERS-gcc-$VERS.1 \
@@ -557,77 +483,6 @@
   | xargs strip || exit 1
 find $DEST_DIR -name \*.a -print | xargs strip -SX || exit 1
 find $DEST_DIR -name \*.a -print | xargs ranlib || exit 1
-
-# LLVM LOCAL begin
-# Install LLVM libraries/headers/tools.
-if [ "$ENABLE_LLVM" == true ]; then
-  cd $DIR/obj-llvm || exit 1
-
-  ## Install the tree into the destination directory.
-  make $MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 OPTIMIZE_OPTION='-O2' install
-
-  if ! test $? == 0 ; then
-      echo "error: LLVM 'make install' failed!"
-      exit 1
-  fi 
-
-  ## Install Version.h
-  if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then
-      RC_ProjectSourceSubversion=0
-  else
-      case "$LLVM_SUBMIT_SUBVERSION" in
-          01) RC_ProjectSourceSubversion=1 ;;
-          02) RC_ProjectSourceSubversion=2 ;;
-          03) RC_ProjectSourceSubversion=3 ;;
-          04) RC_ProjectSourceSubversion=4 ;;
-          05) RC_ProjectSourceSubversion=5 ;;
-          06) RC_ProjectSourceSubversion=6 ;;
-          07) RC_ProjectSourceSubversion=7 ;;
-          08) RC_ProjectSourceSubversion=8 ;;
-          09) RC_ProjectSourceSubversion=9 ;;
-          *)  RC_ProjectSourceSubversion=$LLVM_SUBMIT_SUBVERSION ;;
-      esac
-  fi
-
-  echo "#define LLVM_VERSION ${RC_ProjectSourceVersion}" > $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h
-  echo "#define LLVM_MINOR_VERSION ${RC_ProjectSourceSubversion}" >> $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h
-
-  ## Strip local symbols from llvm libraries.
-  strip -S $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.[oa]
-  strip -Sx $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.so
-
-  # Remove .dir files 
-  cd $DEST_DIR$LLVM_INSTALL_PREFIX/
-  rm bin/.dir etc/llvm/.dir lib/.dir
-
-  # Remove PPC64 fat slices.
-  cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin
-  if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then
-    find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \;
-  else
-    find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \;
-  fi
-  cd $DEST_DIR$LLVM_INSTALL_PREFIX
-  lipo -extract ppc -extract i386 lib/LLVMlto.0.0.0.so -output lib/LLVMlto.0.0.0.so
-
-  # Set up the llvm-gcc/llvm-g++ symlinks.
-  cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin
-  ln -s -f ../../../$DEST_ROOT/bin/gcc-$MAJ_VERS llvm-gcc || exit 1
-  ln -s -f ../../../$DEST_ROOT/bin/g++-$MAJ_VERS llvm-g++ || exit 1
-
-  # Copy one of the libllvmgcc.dylib's up to libexec/gcc.
-  cp $DEST_DIR/$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS/libllvmgcc.dylib \
-     $DEST_DIR/$DEST_ROOT/libexec/gcc/
-
-  # Replace the installed ones with symlinks to the common one.
-  for t in $TARGETS ; do
-    cd $DEST_DIR/$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/
-    rm libllvmgcc.dylib
-    ln -s ../../libllvmgcc.dylib
-  done
-fi
-# LLVM LOCAL end
-
 find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1
 chgrp -h -R wheel $DEST_DIR
 chgrp -R wheel $DEST_DIR





More information about the llvm-commits mailing list