[llvm-commits] [llvm-gcc-4.2] r44071 - /llvm-gcc-4.2/trunk/build_gcc
Bill Wendling
isanbard at gmail.com
Tue Nov 13 14:03:46 PST 2007
Author: void
Date: Tue Nov 13 16:03:46 2007
New Revision: 44071
URL: http://llvm.org/viewvc/llvm-project?rev=44071&view=rev
Log:
Apple way build changes
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=44071&r1=44070&r2=44071&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Tue Nov 13 16:03:46 2007
@@ -6,7 +6,9 @@
# -arch arguments are different than configure arguments. We need to
# translate them.
-TRANSLATE_ARCH="sed -e s/ppc/powerpc/ -e s/i386/i686/"
+TRANSLATE_ARCH="sed -e s/ppc/powerpc/ -e s/i386/i686/ -e s/ppc64/powerpc64/"
+TRANSLATE_TARGETS="sed -e s/ppc/powerpc/ -e s/i386/i686/ -e s/x86_64// \
+ -e s/powerpc64// -e s/ppc64//"
# Build GCC the "Apple way".
# Parameters:
@@ -20,7 +22,7 @@
# compilers will generate code for. If the current machine isn't in
# the list, a compiler for it will get built anyway, but won't be
# installed.
-TARGETS=`echo $2 | $TRANSLATE_ARCH`
+TARGETS=`echo $2 | $TRANSLATE_TARGETS`
# The GNU makefile target ('bootstrap' by default).
BOOTSTRAP=${BOOTSTRAP-bootstrap}
@@ -33,7 +35,11 @@
# $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto).
# We will allow this to override the default $CFLAGS and $CXXFLAGS.
-CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
+if [ "x$LLVM_DEBUG" == "x" ]; then
+ CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
+else
+ CFLAGS="-g"
+fi
# This isn't a parameter; it is the architecture of the current machine.
BUILD=`arch | $TRANSLATE_ARCH`
@@ -71,6 +77,13 @@
# LLVM_BIN_DIR - This is the place where llvm-gcc/llvm-g++ symlinks get installed.
LLVM_BIN_DIR=/Developer/usr/bin
+# 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
+
+# LLVM LOCAL end
# The current working directory is where the build will happen.
# It may already contain a partial result of an interrupted build,
@@ -109,18 +122,26 @@
mkdir $SRC_DIR || exit 1
ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1
rm -rf $SRC_DIR/tcl $SRC_DIR/expect $SRC_DIR/dejagnu || exit 1
+
# Also remove libstdc++ since it is built from a separate project.
rm -rf $SRC_DIR/libstdc++-v3 || exit 1
# Clean out old specs files
rm -f /usr/lib/gcc/*/4.0.0/specs
# These are the configure and build flags that are used.
-CONFIGFLAGS="--disable-checking -enable-werror \
+
+if [ "x$LLVM_DEBUG" == "x" ]; then
+ CHECKING_FLAGS="--disable-checking --enable-werror"
+else
+ CHECKING_FLAGS="--enable-checking"
+fi
+
+CONFIGFLAGS="$CHECKING_FLAGS \
--prefix=$DEST_ROOT \
--mandir=\${prefix}/share/man \
--enable-languages=c,objc,c++,obj-c++ \
--program-prefix=llvm- \
- --program-suffix=-$MAJ_VERS \
+ --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
--with-gxx-include-dir=/usr/include/c++/$LIBSTDCXX_VERSION \
--with-slibdir=/usr/lib \
--build=$BUILD-apple-darwin$DARWIN_VERS"
@@ -129,6 +150,7 @@
if [ "$ENABLE_LLVM" == true ]; then
CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=/usr/local"
fi
+# LLVM LOCAL end
# Figure out how many make processes to run.
SYSCTL=`sysctl -n hw.activecpu`
@@ -176,7 +198,7 @@
# Add the compiler we just built to the path, giving it appropriate names.
# LLVM LOCAL Support for non /usr $DEST_ROOT
D=$DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin
-ln -f $D/gcc-$MAJ_VERS $D/gcc || exit 1
+ln -f $D/llvm-gcc $D/gcc || exit 1
ln -f $D/gcc $D/$BUILD-apple-darwin$DARWIN_VERS-gcc || exit 1
# LLVM LOCAL Support for non /usr $DEST_ROOT
PATH=$DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin:$PATH
@@ -206,8 +228,17 @@
done
PATH=$DIR/bin:$PATH
+# Determine which cross-compilers we should build. If our build architecture is
+# one of our hosts, add all of the targets to the list.
+if echo $HOSTS | grep $BUILD
+then
+ CROSS_TARGETS=`echo $TARGETS $HOSTS | tr ' ' '\n' | sort -u`
+else
+ CROSS_TARGETS="$HOSTS"
+fi
+
# Build the cross-compilers, using the compiler we just built.
-for t in $TARGETS ; do
+for t in $CROSS_TARGETS ; do
if [ $t != $BUILD ] ; then
mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1
cd $DIR/obj-$BUILD-$t || exit 1
@@ -220,16 +251,16 @@
make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$t install-gcc install-target \
CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
- # Add the compiler we just built to the path.
-# LLVM LOCAL Support for non /usr $DEST_ROOT
+ # Add the compiler we just built to the path.
+ # LLVM LOCAL Support for non /usr $DEST_ROOT
PATH=$DIR/dst-$BUILD-$t/$DEST_ROOT/bin:$PATH
fi
done
# Rearrange various libraries, for no really good reason.
-for t in $TARGETS ; do
+for t in $CROSS_TARGETS ; do
DT=$DIR/dst-$BUILD-$t
-# LLVM LOCAL begin Support for non /usr $DEST_ROOT
+ # LLVM LOCAL begin Support for non /usr $DEST_ROOT
D=`echo $DT/$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS`
mv $D/static/libgcc.a $D/libgcc_static.a || exit 1
mv $D/kext/libgcc.a $D/libcc_kext.a || exit 1
@@ -275,13 +306,14 @@
# Clean out DEST_DIR in case -noclean was passed to buildit.
rm -rf * || exit 1
-# LLVM LOCAL Don't install HTML docs.
+# LLVM LOCAL begin - 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
+# LLVM LOCAL end - Don't install docs.
# Manual pages
mkdir -p .$DEST_ROOT/share || exit 1
@@ -328,24 +360,24 @@
$DIR/dst-*-$TARG0$DEST_ROOT/bin/*gcov* || exit 1
# The fully-named drivers, which have the same target on every host.
for t in $TARGETS ; do
+# APPLE LOCAL LLVM build_gcc bug with non-/usr $DEST_ROOT
lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS -create \
- $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS || exit 1
+ $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc || exit 1
+# APPLE LOCAL LLVM build_gcc bug with non-/usr $DEST_ROOT
lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS -create \
- $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS || exit 1
+ $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++ || exit 1
done
# lib
mkdir -p .$DEST_ROOT/lib/gcc || exit 1
for t in $TARGETS ; do
- cp -Rp $DIR/dst-$BUILD-$t$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS \
+# APPLE LOCAL LLVM build_gcc bug with non-/usr $DEST_ROOT
+ cp -Rp $DIR/dst-$BUILD-$t/$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS \
.$DEST_ROOT/lib/gcc || exit 1
done
# 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 \
@@ -353,17 +385,11 @@
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 \
@@ -377,7 +403,8 @@
cp -p /usr/lib/libstdc++.6.dylib \
.$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib \
|| exit 1
- strip -x -c .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib || exit 1
+# LLVM LOCAL
+# strip -x -c .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib || exit 1
done
# include
@@ -406,19 +433,19 @@
# Add extra man page symlinks for 'c++' and for arch-specific names.
MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
-ln -f $MDIR/llvm-g++-$MAJ_VERS.1 $MDIR/llvm-c++-$MAJ_VERS.1 || exit 1
+ln -f $MDIR/llvm-g++.1 $MDIR/llvm-c++.1 || exit 1
for t in $TARGETS ; do
- ln -f $MDIR/llvm-gcc-$MAJ_VERS.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS.1 \
+ ln -f $MDIR/llvm-gcc.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-gcc.1 \
|| exit 1
- ln -f $MDIR/llvm-g++-$MAJ_VERS.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS.1 \
+ ln -f $MDIR/llvm-g++.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-g++.1 \
|| exit 1
done
# Build driver-driver using fully-named drivers
for h in $HOSTS ; do
- $DEST_DIR$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-llvm-gcc-$VERS \
+ $h-apple-darwin$DARWIN_VERS-gcc \
$ORIG_SRC_DIR/driverdriver.c \
- -DPDN="\"-apple-darwin$DARWIN_VERS-llvm-gcc-$VERS\"" \
+ -DPDN="\"-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS\"" \
-DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
-I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
-liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/ \
@@ -426,9 +453,9 @@
-L$DIR/obj-$h-$BUILD/libiberty/ \
-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-llvm-gcc-$MAJ_VERS || exit 1
- $DEST_DIR$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-llvm-gcc-$VERS \
+ $h-apple-darwin$DARWIN_VERS-gcc \
$ORIG_SRC_DIR/driverdriver.c \
- -DPDN="\"-apple-darwin$DARWIN_VERS-llvm-g++-$VERS\"" \
+ -DPDN="\"-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS\"" \
-DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
-I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
-liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/ \
@@ -472,7 +499,7 @@
########################################
# Remove debugging information from DEST_DIR.
-find $DEST_DIR -perm -0111 \! -name fixinc.sh \
+find $DEST_DIR -perm -0111 \! -name \*.dylib \! -name fixinc.sh \
\! -name mkheaders \! -name libstdc++.dylib -type f -print \
| xargs strip || exit 1
# APPLE LOCAL begin LLVM - Strip with -Sx instead of -SX
More information about the llvm-commits
mailing list