view @ 1028:5897a868313e

Jean-Christophe Dubois pointed out that if doesn't source config, it doesn't get things like NO_NATIVE_COMPILER.
author Rob Landley <>
date Mon, 05 Apr 2010 18:39:09 -0500
parents 48784ae8533e
children 27c38c82401d
line wrap: on
line source


# Build a compiler for a given target, using one or more existing simple
# cross compilers.

# This can be used to build a native compiler for an aribitrary target, or to
# build a more portable and capable cross compiler for an arbitrary host.

# The new compiler is built --with-shared and has uClibc++ installed, and is
# statically linked against uClibc (for portability) unless BUILD_STATIC=none.

source sources/ && read_arch_dir "$1" || exit 1
check_for_base_arch || exit 0

# Building a cross compiler requires _two_ existing simple compilers: one for
# the host (to build the executables), and one for the target (to build
# the libraries).  For native compilers both checks test for the same thing.

check_prerequisite "${ARCH}-cc"
check_prerequisite "${FROM_ARCH}-cc"

mkdir -p "$STAGE_DIR/bin" || dienow


# Build C Library

build_section linux-headers
build_section uClibc

# Build binutils, gcc, and ccwrap

build_section binutils
build_section gcc
build_section ccwrap

# Tell future packages to link against the libraries in the new root filesystem,
# rather than the ones in the cross compiler directory.

export "$(echo $ARCH | sed 's/-/_/g')"_CCWRAP_TOPDIR="$STAGE_DIR"

build_section uClibc++

# Delete some unneeded files

[ -z "$SKIP_STRIP" ] && rm -rf "$STAGE_DIR"/{info,man}