#!/bin/sh
abort() {
echo $@
exec false
}
# Script to download sources for, build, and test a gnu/linux toolchain
# Copyright (c) 2003 by Dan Kegel, Ixia Communications.
# All rights reserved. This script is provided under the terms of the GPL.
# For questions, comments or improvements see the crossgcc mailing
# list at http://sources.redhat.com/ml/crossgcc, but do your homework first.
# As Bill Gatliff says, "THINK!"
#
# Meant to be invoked from another shell script.
# Usage: six environment variables must be set, namely:
test -z "${TARGET}" && abort "Please set TARGET to the Gnu target identifier (e.g. pentium-linux)"
test -z "${TARGET_CFLAGS}" && abort "Please set TARGET_CFLAGS to any compiler flags needed when building glibc (-O recommended)"
test -z "${BINUTILS_DIR}" && abort "Please set BINUTILS_DIR to the bare filename of the binutils tarball or directory"
test -z "${GCC_DIR}" && abort "Please set GCC_DIR to the bare filename of the gcc tarball or directory"
# When building a cygwin target LINUX_DIR and GLIBC_DIR are not needed.
if test "${CYGWIN_DIR}" = ""; then
if test -z "${LINUX_SANITIZED_HEADER_DIR}" ; then
test -z "${LINUX_DIR}" && abort "Please set either LINUX_DIR or LINUX_SANITIZED_HEADER_DIR to the bare filename of the tarball or direc$
else
test -n "${LINUX_DIR}" && echo "You set both LINUX_DIR and LINUX_SANITIZED_HEADER_DIR - ignoring LINUX_DIR for the build"
fi
test -z "${GLIBC_DIR}" && abort "Please set GLIBC_DIR to the bare filename of the glibc tarball or directory"
fi
# Four environment variables are optional, namely:
test -z "${DEJAGNU}" && echo "DEJAGNU not set, so not running any regression tests"
test -z "${GCC_EXTRA_CONFIG}" && echo "GCC_EXTRA_CONFIG not set, so not passing any extra options to gcc's configure script"
test -z "${GLIBC_ADDON_OPTIONS}" && echo "GLIBC_ADDON_OPTIONS not set, so building all glibc add-on's"
test -z "${KERNELCONFIG}" && echo "KERNELCONFIG not set, so not configuring linux kernel"
test -z "${KERNELCONFIG}" || test -r "${KERNELCONFIG}" || abort "Can't read file KERNELCONFIG = $KERNELCONFIG, please fix."
set -ex
TOOLCOMBO=$GCC_DIR-$GLIBC_DIR
BUILD_DIR=`pwd`/build/$TARGET/$TOOLCOMBO