-#!/bin/sh
+#!/bin/bash
# Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain.
# Modified by Piot Esden-Tempski <piotr@esden.net>, released as public domain.
TARGET=arm-none-eabi # Or: TARGET=arm-none-eabi
-PREFIX=${HOME}/arm-none-eabi # Install location of your final toolchain
-PARALLEL="-j 5" # Or: PARALLEL=""
+PREFIX=${HOME}/arm-none-eabi # Install location of your final toolchain
+PARALLEL="" # Or: PARALLEL="-j 5" for 4 CPU's
+DARWIN_OPT_PATH=/opt/local # Path in which MacPorts or Fink is installed
BINUTILS=binutils-2.19.1
GCC=gcc-4.4.0
export PATH="${PREFIX}/bin:${PATH}"
+case "$(uname)" in
+ Linux)
+ echo "Found Linux OS."
+ GCCFLAGS=
+ GDBFLAGS=
+ ;;
+ Darwin)
+ echo "Found Darwin OS."
+ GCCFLAGS="--with-gmp=${DARWIN_OPT_PATH} \
+ --with-mpfr=${DARWIN_OPT_PATH} \
+ -with-libiconv-prefix=${DARWIN_OPT_PATH}"
+ GDBFLAGS="--disable-werror"
+ ;;
+ *)
+ echo "Found Unknown OS. Aborting!"
+ exit 1
+ ;;
+esac
+
if [ ! -e sources ]; then
mkdir sources
fi
--disable-shared \
--with-gnu-as \
--with-gnu-ld \
- --disable-nls || exit
+ --disable-nls \
+ ${GCCFLAGS} || exit
echo "******************************************************************"
echo "* Building ${GCC}-boot"
echo "******************************************************************"
--disable-shared \
--with-gnu-as \
--with-gnu-ld \
- --disable-nls || exit
+ --disable-nls \
+ ${GCCFLAGS} || exit
echo "******************************************************************"
echo "* Building ${GCC}"
echo "******************************************************************"
../${GDB}/configure --target=${TARGET} \
--prefix=${PREFIX} \
--enable-interwork \
- --enable-multilib || exit
+ --enable-multilib \
+ ${GDBFLAGS} || exit
echo "******************************************************************"
echo "* Building ${GDB}"
echo "******************************************************************"