#
CROSSGCC_DATE="November 1st, 2011"
-CROSSGCC_VERSION="1.06"
+CROSSGCC_VERSION="1.07"
# default settings
TARGETDIR=`pwd`/xgcc
MPFR_VERSION=3.1.0
MPC_VERSION=0.9
LIBELF_VERSION=0.8.13
-GCC_VERSION=4.6.1
+GCC_VERSION=4.6.2
GCC_AUTOCONF_VERSION=2.64
BINUTILS_VERSION=2.21.1
GDB_VERSION=7.3.1
printf " [-h|--help] print this help and exit\n"
printf " [-c|--clean] remove temporary files before build\n"
printf " [-t|--savetemps] don't remove temporary files after build\n"
+ printf " [-y|--ccache] Use ccache when building cross compiler\n"
printf " [-j|--jobs <num>] run <num> jobs in parallel in make\n"
printf " [-p|--platform <platform>] target platform to build cross compiler for\n"
printf " (defaults to $TARGETARCH)\n"
getoptbrand="`getopt -V | sed -e '1!d' -e 's,^\(......\).*,\1,'`"
if [ "${getoptbrand}" = "getopt" ]; then
# Detected GNU getopt that supports long options.
- args=`getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb Vhcd:p:j:D:tG -- "$@"`
+ args=`getopt -l version,help,clean,directory:,platform:,jobs:,destdir:,savetemps,skip-gdb,ccache Vhcd:p:j:D:tGy -- "$@"`
eval set "$args"
else
# Detected non-GNU getopt
- args=`getopt Vhcd:p:j:D:tG $*`
+ args=`getopt Vhcd:p:j:D:tGy $*`
set -- $args
fi
-j|--jobs) shift; JOBS="-j $1"; shift;;
-G|--gdb) shift; SKIPGDB=0;;
-S|--scripting) shift; SKIPPYTHON=0;;
+ -y|--ccache) shift; USECCACHE=1;;
--) shift; break;;
-*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;;
fi
fi
if [ $SKIPPYTHON -eq 1 ]; then
+ PYTHON_ARCHIVE=""
PYTHON_PACKAGE=""
+ EXPAT_ARCHIVE=""
EXPAT_PACKAGE=""
fi
USE_GOLD=""
GCC_OPTIONS="--enable-lto"
-if [ ${GCC_VERSION} = "4.6.2" ]; then
+if [ ${GCC_VERSION} = "trunk" ]; then
if [ ! -r tarballs/gcc-core-${GCC_VERSION}.tar.bz2 ]; then
printf "Pre-Release GCC ${GCC_VERSION}, checking out subversion trunk\n"
mkdir -p tarballs/.tmp
fi
fi
+if [ "$USECCACHE" = 1 ]; then
+ CC="ccache $CC"
+fi
+
mkdir -p build-gmp build-mpfr build-mpc build-libelf build-binutils \
build-gcc build-python build-expat
if [ $SKIPGDB -eq 0 ]; then
(
cd build-gmp
rm -f .failed
- ../${GMP_DIR}/configure --disable-shared --prefix=$TARGETDIR $OPTIONS \
+ CC="$CC" ../${GMP_DIR}/configure --disable-shared --prefix=$TARGETDIR $OPTIONS \
|| touch .failed
$MAKE $JOBS || touch .failed
$MAKE install DESTDIR=$DESTDIR || touch .failed
test `uname` = "Darwin" && CFLAGS="$CFLAGS -force_cpusubtype_ALL"
cd build-mpfr
rm -f .failed
- ../${MPFR_DIR}/configure --disable-shared --prefix=$TARGETDIR \
+ CC="$CC" ../${MPFR_DIR}/configure --disable-shared --prefix=$TARGETDIR \
--infodir=$TARGETDIR/info \
--with-gmp=$DESTDIR$TARGETDIR CFLAGS="$HOSTCFLAGS" || \
touch .failed
#test `uname` = "Darwin" && CFLAGS="$CFLAGS -force_cpusubtype_ALL"
cd build-mpc
rm -f .failed
- ../${MPC_DIR}/configure --disable-shared --prefix=$TARGETDIR \
+ CC="$CC" ../${MPC_DIR}/configure --disable-shared --prefix=$TARGETDIR \
--infodir=$TARGETDIR/info --with-mpfr=$DESTDIR$TARGETDIR \
--with-gmp=$DESTDIR$TARGETDIR CFLAGS="$HOSTCFLAGS" || \
touch .failed
cd build-libelf
rm -f .failed
echo "$HOSTCFLAGS"
- CFLAGS="$HOSTCFLAGS" libelf_cv_elf_h_works=no \
+ CC="$CC" CFLAGS="$HOSTCFLAGS" libelf_cv_elf_h_works=no \
../${LIBELF_DIR}/configure --disable-shared --prefix=$TARGETDIR \
--infodir=$TARGETDIR/info CFLAGS="$HOSTCFLAGS" || touch .failed
$MAKE $JOBS || touch .failed
# Now build binutils
cd build-binutils
rm -f .failed
- ../binutils-${BINUTILS_VERSION}/configure --prefix=$TARGETDIR \
+ CC="$CC" ../binutils-${BINUTILS_VERSION}/configure --prefix=$TARGETDIR \
--target=${TARGETARCH} --disable-werror --disable-nls \
$USE_GOLD CFLAGS="$HOSTCFLAGS" || touch .failed
$MAKE $JOBS || touch .failed
if [ -f build-expat/.success ]; then
printf "Skipping Expat as it is already built\n"
-elif [ $SKIPGDB -eq 1 ]; then
- printf "Skipping Expat as requested by command line (skip GDB)\n"
+elif [ $SKIPPYTHON -eq 1 ]; then
+ printf "Skipping Expat (Python scripting not enabled)\n"
else
printf "Building Expat ${EXPAT_VERSION} ... "
(
cd build-expat
export PATH=$PATH:$DESTDIR$TARGETDIR/bin
rm -f .failed
- CFLAGS="$HOSTCFLAGS" ../${EXPAT_DIR}/configure --disable-shared \
+ CC="$CC" CFLAGS="$HOSTCFLAGS" ../${EXPAT_DIR}/configure --disable-shared \
--prefix=$TARGETDIR --target=${TARGETARCH} || touch .failed
$MAKE || touch .failed
$MAKE install DESTDIR=$DESTDIR || touch .failed
if [ -f build-python/.success ]; then
printf "Skipping Python as it is already built\n"
-elif [ $SKIPGDB -eq 1 ]; then
- printf "Skipping Python as requested by command line (skip GDB)\n"
+elif [ $SKIPPYTHON -eq 1 ]; then
+ printf "Skipping Python (Python scripting not enabled)\n"
else
printf "Building Python ${PYTHON_VERSION} ... "
(
cd build-python
export PATH=$PATH:$DESTDIR$TARGETDIR/bin
rm -f .failed
- CFLAGS="$HOSTCFLAGS" ../${PYTHON_DIR}/configure --prefix=$TARGETDIR \
+ CC="$CC" CFLAGS="$HOSTCFLAGS" ../${PYTHON_DIR}/configure --prefix=$TARGETDIR \
--target=${TARGETARCH} || touch .failed
$MAKE $JOBS || touch .failed
$MAKE install DESTDIR=$DESTDIR || touch .failed
if [ -f build-gdb/.success ]; then
printf "Skipping GDB as it is already built\n"
elif [ $SKIPGDB -eq 1 ]; then
- printf "Skipping GDB as requested by command line\n"
+ printf "Skipping GDB (GDB support not enabled)\n"
else
printf "Building GDB ${GDB_VERSION} ... "
(
rm -f .failed
LDFLAGS="-Wl,-rpath,\$\$ORIGIN/../lib/ -L$DESTDIR$TARGETDIR/lib \
-lpthread -ldl -lutil" \
- CFLAGS="$HOSTCFLAGS -I$DESTDIR$TARGETDIR/include" \
+ CC="$CC" CFLAGS="$HOSTCFLAGS -I$DESTDIR$TARGETDIR/include" \
../gdb-${GDB_VERSION}/configure --prefix=$TARGETDIR \
--target=${TARGETARCH} --disable-werror --disable-nls
$MAKE $JOBS || touch .failed
export PATH=$PATH:$DESTDIR$TARGETDIR/bin
rm -f .failed
CFLAGS="$HOSTCFLAGS"
- $MAKE || touch .failed
+ $MAKE CC="$CC" || touch .failed
rm -f $DESTDIR$TARGETDIR/bin/iasl || touch .failed
cp iasl $DESTDIR$TARGETDIR/bin || touch .failed
if [ ! -f .failed ]; then touch .success; fi