Make it work with versions 2, 3 and 4 of the toolchain.

This commit is contained in:
Krystian Bacławski
2013-05-22 17:26:04 +02:00
parent 29ad97d7a3
commit 11b7edda1c
+34 -25
View File
@@ -191,7 +191,8 @@ function build_tools {
mkdir_empty "${GMP}" mkdir_empty "${GMP}"
pushd "${GMP}" pushd "${GMP}"
"${SOURCES}/${GMP}/configure" \ "${SOURCES}/${GMP}/configure" \
--prefix="${HOST_DIR}" --prefix="${HOST_DIR}" \
--disable-shared
${MAKE} && make install ${MAKE} && make install
popd popd
@@ -199,6 +200,7 @@ function build_tools {
pushd "${MPFR}" pushd "${MPFR}"
"${SOURCES}/${MPFR}/configure" \ "${SOURCES}/${MPFR}/configure" \
--prefix="${HOST_DIR}" \ --prefix="${HOST_DIR}" \
--disable-shared \
--with-gmp="${HOST_DIR}" --with-gmp="${HOST_DIR}"
${MAKE} && make install ${MAKE} && make install
popd popd
@@ -207,6 +209,7 @@ function build_tools {
pushd "${MPC}" pushd "${MPC}"
"${SOURCES}/${MPC}/configure" \ "${SOURCES}/${MPC}/configure" \
--prefix="${HOST_DIR}" \ --prefix="${HOST_DIR}" \
--disable-shared \
--with-gmp="${HOST_DIR}" \ --with-gmp="${HOST_DIR}" \
--with-mpfr="${HOST_DIR}" --with-mpfr="${HOST_DIR}"
${MAKE} && make install ${MAKE} && make install
@@ -326,7 +329,7 @@ function build_binutils {
pushd "${BUILD_DIR}" pushd "${BUILD_DIR}"
mkdir_empty "${BINUTILS}" mkdir_empty "${BINUTILS}"
cd "${BINUTILS}" cd "${BINUTILS}"
"${SOURCES}/${BINUTILS}/configure" \ CC="${CC} ${ARCH:-}" "${SOURCES}/${BINUTILS}/configure" \
--prefix="${PREFIX}" \ --prefix="${PREFIX}" \
--host="i686-linux-gnu" \ --host="i686-linux-gnu" \
--target="m68k-amigaos" --target="m68k-amigaos"
@@ -494,31 +497,44 @@ function build {
# (probably) miscalculated structure sizes. There could be some other bugs # (probably) miscalculated structure sizes. There could be some other bugs
# lurking there in 64-bit mode, but I have little incentive chasing them. # lurking there in 64-bit mode, but I have little incentive chasing them.
# Just compile everything in 32-bit mode and forget about the issues. # Just compile everything in 32-bit mode and forget about the issues.
CFLAGS=""
if [ "$(uname -m)" == "x86_64" ]; then if [ "$(uname -m)" == "x86_64" ]; then
CFLAGS="-m32" ARCH="-m32"
fi fi
# Make sure we always choose known compiler (from the distro) and not one
# in user's path that could shadow the original one.
CC="$(which gcc)"
CXX="$(which g++)"
# Define extra options for gcc's configure script. # Define extra options for gcc's configure script.
if [ "${VERSION}" != "4" ]; then if [ "${VERSION}" != "4" ]; then
# Older gcc compilers (i.e. 2.95.3 and 3.4.6) have to be tricked into # Older gcc compilers (i.e. 2.95.3 and 3.4.6) have to be tricked into
# thinking that they're being compiled on IA-32 architecture. # thinking that they're being compiled on IA-32 architecture.
CC="${CC} ${ARCH:-}"
CXX="${CXX} ${ARCH:-}"
GCC_CONFIGURE_OPTS+=("--host=i686-linux-gnu") GCC_CONFIGURE_OPTS+=("--host=i686-linux-gnu")
else else
# GCC 4.x requires some extra dependencies to be supplied. # GCC 4.x requires some extra dependencies to be supplied.
GCC_CONFIGURE_OPTS+=("--with-gmp=${HOST_DIR}" \ GCC_CONFIGURE_OPTS+=("--with-gmp=${HOST_DIR}" \
"--with-mpfr=${HOST_DIR}" \ "--with-mpfr=${HOST_DIR}" \
"--with-mpc=${HOST_DIR}") "--with-mpc=${HOST_DIR}" \
"--disable-shared")
fi fi
# Take over the path -- to preserve hermetic build. # Take over the path -- to preserve hermetic build.
export PATH="/opt/local/bin:/usr/local/bin:/usr/bin:/bin" export PATH="/opt/local/bin:/usr/local/bin:/usr/bin:/bin"
export CC CXX
# Make sure we always choose known compiler (from the distro) and not one readonly FLAGS_FOR_TARGET=( \
# in user's path that could shadow the original one. "MAKEINFO=makeinfo" \
export CC="$(which gcc) ${CFLAGS}" "CFLAGS_FOR_TARGET=-noixemul" \
export CXX="$(which g++) ${CFLAGS}" "AR_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ar" \
"AS_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-as" \
"LD_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ld" \
"NM_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-nm" \
"OBJCOPY_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-objcopy" \
"OBJDUMP_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-objdump" \
"RANLIB_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ranlib")
prepare_target prepare_target
unpack_sources unpack_sources
@@ -560,30 +576,23 @@ function main {
--prefix=*) --prefix=*)
PREFIX=${1#*=} PREFIX=${1#*=}
;; ;;
--clean)
action="clean"
;;
--version=*) --version=*)
VERSION=${1#*=} VERSION=${1#*=}
;; ;;
*) --*)
echo "Unknown option: $1" echo "Unknown option: $1"
exit 1 exit 1
;; ;;
*)
break
;;
esac esac
shift shift
done done
readonly FLAGS_FOR_TARGET=( \ if [ -n "${1:-}" ]; then
"MAKEINFO=makeinfo" \ action="$1"
"CFLAGS_FOR_TARGET=-noixemul" \ fi
"AR_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ar" \
"AS_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-as" \
"LD_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ld" \
"NM_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-nm" \
"OBJCOPY_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-objcopy" \
"OBJDUMP_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-objdump" \
"RANLIB_FOR_TARGET=${PREFIX}/bin/m68k-amigaos-ranlib")
case "${action}" in case "${action}" in
"build") "build")
@@ -595,7 +604,7 @@ function main {
done done
;; ;;
*) *)
echo "action '${action}' not supported!" echo "Unknown action '${action}'!"
exit 1 exit 1
;; ;;
esac esac