3 # Cross-Compiler Toolchain for ${PLATFORM}
4 # by Martin Decky <martin@decky.cz>
11 if [ "$1" -ne "0" ]; then
13 echo "Script failed: $2"
18 BINUTILS_VERSION
="2.16.1"
21 BINUTILS
="binutils-${BINUTILS_VERSION}.tar.gz"
22 GCC
="gcc-core-${GCC_VERSION}.tar.bz2"
24 BINUTILS_SOURCE
="ftp://ftp.gnu.org/gnu/binutils/"
25 GCC_SOURCE
="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
29 TARGET
="${PLATFORM}-linux-gnu"
30 HOST
="i686-pc-linux-gnu"
31 PREFIX
="/usr/local/${PLATFORM}"
32 BINUTILSDIR
="${WORKDIR}/binutils-${BINUTILS_VERSION}"
33 GCCDIR
="${WORKDIR}/gcc-${GCC_VERSION}"
34 OBJDIR
="${WORKDIR}/gcc-obj"
36 echo ">>> Downloading tarballs"
38 if [ ! -f "${BINUTILS}" ]; then
39 wget
-c "${BINUTILS_SOURCE}${BINUTILS}"
40 check_error $?
"Error downloading binutils."
42 if [ ! -f "${GCC}" ]; then
43 wget
-c "${GCC_SOURCE}${GCC}"
44 check_error $?
"Error downloading GCC."
47 echo ">>> Creating destionation directory"
48 if [ ! -d "${PREFIX}" ]; then
51 check_error $?
"Unable to create ${PREFIX}."
54 echo ">>> Creating GCC work directory"
55 if [ ! -d "${OBJDIR}" ]; then
58 check_error $?
"Unable to create ${OBJDIR}."
61 echo ">>> Unpacking tarballs"
62 tar -xvzf "${BINUTILS}"
63 check_error $?
"Error unpacking binutils."
65 check_error $?
"Error unpacking GCC."
67 echo ">>> Compiling and installing binutils"
69 check_error $?
"Change directory failed."
70 .
/configure
"--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
71 check_error $?
"Error configuring binutils."
73 check_error $?
"Error compiling/installing binutils."
75 echo ">>> Compiling and installing GCC"
77 check_error $?
"Change directory failed."
78 "${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c
--disable-multilib --disable-libgcj --without-headers --disable-shared
79 check_error $?
"Error configuring GCC."
80 PATH
="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
81 check_error $?
"Error compiling/installing GCC."
84 echo ">>> Cross-compiler for ${TARGET} installed."