This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: shell script to build gcc with libstdc++-v3
On 07 Jul 2000 at 11:48 (-0400), brent verner wrote:
| On 07 Jul 2000 at 10:56 (-0400), brent verner wrote:
|
| sorry. that script will not work as advertised. It does not recover
| from the intial error. I'll post a working version later today...
| (hanging head in shame)
Give this one a shot :) Make sure you have a recent binutils with
the patch described in:
http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00138.html
then run this script as
./$WHATEVERYOUNAMEIT 20000619 bootstrap
Prior to running it you might want to modify the flags that will
be used to configure the build directory. It will grab the gcc
sources from 20000619 and recent libstdc++v3, then compile them
all.
Oh, if you have not cvs'd gcc or libstdc++-v3, you'll need to do
a cvs login before running this, by saying...
prompt$ cvs -d:pserver:anoncvs@anoncvs.cygnus.com:/cvs/gcc login
(enter 'anoncvs' when asked)
After you've built the source tree, you may run this script without
the 'bootstrap' argument to get fresh libstdc++-v3 and rebuild.
Feedback, comments, even you're-a-crackhead comments welcome.
Brent
=======================================================================
#!/bin/bash
#
# License: GPL
# Butcher: Brent Verner <brent@rcfile.org>
# Version: if this script stays around long enough to get versioned,
# we've got more problems than it could ever solve :o
#
# OK. this is nasty-a$$ shell scripting at its worst...
# I'm almost ashamed to share it, but if it gets one more user
# on libstdc++-v3, my shame is paid for :)
#
#-=db=-
INSTALL_PREFIX=/usr/local/opt
CONFIG_CMD="../${GCC}/configure --prefix=${INSTALL_PREFIX} \
--enable-libstdcxx-v3 --enable-threads=posix \
--enable-long-long --enable-cshadow-headers \
--enable-namespaces --enable-languages=c,c++ "
GCC=gcc
GCC_DATE=$1
BOOTSTRAP=$2
BEST_GCC="20000619"
CVSROOT=":pserver:anoncvs@anoncvs.cygnus.com:/cvs/gcc"
SCRIPT=`basename $0`
TOP=`pwd`
DATE=`date +%Y%m%d`
OUTFILE="${TOP}/mkegcs-${DATE}.out"
SRC_DIR="${TOP}/${GCC}"
BUILD_DIR="${TOP}/${GCC}-build"
JUST_UPDATE_PLACEHOLDER="${SRC_DIR}/.just_update_libstdc++-v3"
LIBSTDCXX_DIR="${BUILD_DIR}/*/libstdc++-v3"
export INSTALL_PREFIX
export GCC_DATE
export CONFIG_CMD
export CVSROOT
export SCRIPT
export TOP
function usage {
echo "Usage:"
echo " $SCRIPT YYYYMMDD [bootstrap]"
echo " - or -"
echo " $SCRIPT current [bootstrap]"
echo ""
echo " Hint: the most recent known-working gcc snapshot is $BEST_GCC,"
echo " so you'll probably want to say:"
echo " ./$SCRIPT $BEST_GCC bootstrap"
echo " to build the compiler"
echo ""
echo "Purpose:"
echo " $SCRIPT will check out a specified cvs source tree and the most"
echo " recent libstdc++-v3 tree and build it for you."
echo ""
exit
}
function try_make {
B=`make $* 2>&1 | tee -a $OUTFILE | grep -E '^make.*Error 1$' | sed 's/^.*\[\([^[]*\)\].*$/\1/g'`
BROKE_AT=`echo $B | cut -d ' ' -f 1`
if [ "$BROKE_AT" ]; then
if [ "x$LAST_BREAK" = "x$BROKE_AT" ]; then
echo "Fatal: error compiling $BROKE_AT occurred twice. I can't repair it."
echo "(all output from the build can be found in $OUTFILE)"
exit
fi
LAST_BREAK=$BROKE_AT
handle_error $BROKE_AT
try_make
fi
echo $BROKE_AT # success
}
function unrepaired {
echo "Fatal: I was unable to recover from the error encountered"
echo "while building $1. Sorry."
echo "(all output from the build can be found in $OUTFILE)"
exit
}
function handle_error {
A=$1
case "$A" in
locale-inst.lo)
echo "error encountered while building $A"
echo "trying to correct with:"
echo " make CXXFLAGS=\"-g -O1\" locale-inst.lo"
cd ${LIBSTDCXX_DIR}/src
RV=`try_make CXXFLAGS="-g -O1" locale-inst.lo`
if [ "$RV" ]; then
unrepaired $A
fi
cd $BUILD_DIR
;;
locale.lo)
echo "Error: while compiling $A"
echo "trying to correct with:"
echo " make WERROR= locale.lo"
cd ${LIBSTDCXX_DIR}/src
RV=`try_make WERROR= locale.lo`
if [ "$RV" ]; then
unrepaired $A
fi
cd $BUILD_DIR
;;
*)
echo "Sorry, an unexpected error was encountered compiling $A"
echo "I don't know how to workaround this error."
exit
;;
esac
}
if [ "$GCC_DATE" ]; then
if [ "x${GCC_DATE}" = "xcurrent" ]; then
GCC_TAG=""
UPDATE_LIBSTDCXX=
else
GCC_TAG="-rgcc_ss_${GCC_DATE}"
UPDATE_LIBSTDCXX="cvs co libstdc++-v3"
fi
else
usage
fi
HAVE_GCC_SRC="/bin/true"
if [ "x$BOOTSTRAP" = "xbootstrap" ]; then
if [ ! -d $GCC ]; then
HAVE_GCC_SRC="cvs co $GCC_TAG $GCC"
fi
fi
echo "Please be patient :)"
echo "Checking out $GCC cvs source..."
if eval $HAVE_GCC_SRC 2>&1 >> $OUTFILE; then
if [ "$UPDATE_LIBSTDCXX" ]; then
cd $SRC_DIR
if [ ! -e $JUST_UPDATE_PLACEHOLDER ]; then
echo "Removing old libstdc++-v3 sources"
rm -rf libstdc++-v3
fi
echo "Updating libstdc++-v3 with fresh cvs lovin'..."
eval $UPDATE_LIBSTDCXX 2>&1 >> $OUTFILE
touch $JUST_UPDATE_PLACEHOLDER
fi
if [ -d $LIBSTDCXX_DIR ]; then
cd $LIBSTDCXX_DIR;
make clean
fi
mkdir $BUILD_DIR
cd $BUILD_DIR
if [ $BOOTSTRAP ]; then
echo "Configuring the build directory..."
echo $CONFIG_CMD 2>&1 >> $OUTFILE
eval $CONFIG_CMD 2>&1 >> $OUTFILE
else
echo "Not reconfiguring build directory"
fi
echo "Running 'make $BOOTSTRAP' in the build directory..."
if try_make $BOOTSTRAP; then
echo "Build success!"
echo "You should run 'make check' from within $BUILD_DIR to verify"
echo "that the build is satisfactory."
echo "gcc-${DATE} currently configured to install to $INST_PREFIX"
echo "Enjoy!"
else
echo "Build failed!"
echo "(all output from the build can be found in $OUTFILE)"
fi
fi