toaruos/toolchain/cross-gcc.sh

79 lines
2.0 KiB
Bash
Raw Normal View History

2013-05-08 11:48:15 +04:00
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $DIR/config.sh
. $DIR/util.sh
. $DIR/activate.sh
pushd $DIR
# Grab extras
./extras.sh
MPC=mpc-0.9
GMP=gmp-5.0.1
MPFR=mpfr-3.0.1
2013-06-09 06:44:28 +04:00
GCCV=4.6.4
2013-05-08 11:48:15 +04:00
GCC=gcc-$GCCV
BINUTILS=binutils-2.22
VIRTPREFIX=/usr
REALPREFIX=$TOARU_SYSROOT
2013-05-08 11:48:15 +04:00
if [ ! -d tarballs/$GCC/mpfr ]; then
mv tarballs/$MPFR tarballs/$GCC/mpfr
fi
2013-05-16 05:33:30 +04:00
if [ ! -d tarballs/$GCC/gmp ]; then
2013-05-08 11:48:15 +04:00
mv tarballs/$GMP tarballs/$GCC/gmp
fi
2013-05-16 05:33:30 +04:00
if [ ! -d tarballs/$GCC/mpc ]; then
2013-05-08 11:48:15 +04:00
mv tarballs/$MPC tarballs/$GCC/mpc
fi
# Actual build process
echo "Building GCC for native installation targetting $TARGET, installed into $TOARU_SYSROOT$VIRTPREFIX"
2013-05-08 11:48:15 +04:00
pushd build || bail
if [ -d binutils-native ]; then
rm -rf binutils-native
fi
mkdir binutils-native
pushd binutils-native || bail
$DIR/tarballs/$BINUTILS/configure --prefix=$VIRTPREFIX --host=$TARGET --target=$TARGET || bail
make || bail
make DESTDIR=$REALPREFIX install || bail
popd
#if [ -d gcc-native ]; then
# rm -rf gcc-native
#fi
#mkdir gcc-native
#pushd gcc-native || bail
# make distclean
# $DIR/tarballs/$GCC/configure --prefix=$VIRTPREFIX --host=$TARGET --target=$TARGET --disable-nls --enable-languages=c,c++ --disable-libssp --with-newlib || bail
# make DESTDIR=$REALPREFIX all-gcc || bail
# make DESTDIR=$REALPREFIX install-gcc || bail
# make DESTDIR=$REALPREFIX all-target-libgcc || bail
# make DESTDIR=$REALPREFIX install-target-libgcc || bail
# touch $TOARU_SYSROOT/usr/include/fenv.h
# make DESTDIR=$REALPREFIX all-target-libstdc++-v3 || bail
# make DESTDIR=$REALPREFIX install-target-libstdc++-v3 || bail
#popd
2013-05-08 11:48:15 +04:00
#TMP_INCFIX=$REALPREFIX$VIRTPREFIX/lib/gcc/$TARGET/$GCCV/include-fixed
2013-05-08 11:48:15 +04:00
#if [ -d $TMP_INCFIX ]; then
# rm -r "$TMP_INCFIX"
#fi
2013-05-08 11:48:15 +04:00
2013-05-12 11:38:56 +04:00
pushd $REALPREFIX$VIRTPREFIX/bin || bail
2013-05-08 11:48:15 +04:00
$TARGET-strip *
popd
pushd $REALPREFIX$VIRTPREFIX/libexec/gcc/$TARGET/$GCCV || bail
$TARGET-strip cc1 collect2
popd
popd