diff mbox

Generic companion libs

Message ID 515c5c4635d99ebe4877.1353074410@macbook-smorlat.local
State Accepted
Commit 1c68438f44f7
Headers show

Commit Message

Yann Diorcet Nov. 16, 2012, 2 p.m. UTC
# HG changeset patch
# User Yann Diorcet (diorcet.yann@gmail.com)
# Date 1353074367 -3600
# Node ID 515c5c4635d99ebe4877e1cbb52af227cfd75d5f
# Parent  8453ccdc509862c0b7cb8c0641d912bfafd00e7c
Generic companion libs

scripts: Use the same method as companion tools for providing generic and
         extendable companion libs

Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Yann E. MORIN Nov. 16, 2012, 6:48 p.m. UTC | #1
Yann, All,

Your patch:
    complibs: introduce generic multi-complibs infrastructure

has been applied as: #1c68438f44f7
    http://crosstool-ng.org/hg/crosstool-ng/rev/1c68438f44f7

Thank you!

Regards,
Yann E. MORIN.



--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,39 @@ 
+# Wrapper to build the companion libs facilities
+
+# List all companion tools facilities, and parse their scripts
+CT_COMP_LIBS_FACILITY_LIST=
+for f in "${CT_LIB_DIR}/scripts/build/companion_libs/"*.sh; do
+    _f="$(basename "${f}" .sh)"
+    _f="${_f#???-}"
+    . "${f}"
+    CT_COMP_LIBS_FACILITY_LIST="${CT_COMP_LIBS_FACILITY_LIST} ${_f}"
+done
+
+# Download the companion libs facilities
+do_companion_libs_get() {
+    for f in ${CT_COMP_LIBS_FACILITY_LIST}; do
+        do_${f}_get
+    done
+}
+
+# Extract and patch the companion libs facilities
+do_companion_libs_extract() {
+    for f in ${CT_COMP_LIBS_FACILITY_LIST}; do
+        do_${f}_extract
+    done
+}
+
+# Build the companion libs facilities for build
+do_companion_libs_for_build() {
+    for f in ${CT_COMP_LIBS_FACILITY_LIST}; do
+        do_${f}_for_build
+    done
+}
+
+# Build the companion libs facilities for host
+do_companion_libs_for_host() {
+    for f in ${CT_COMP_LIBS_FACILITY_LIST}; do
+        do_${f}_for_host
+    done
+}
+
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/100-gmp.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/100-gmp.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,103 @@ 
+# This file adds the functions to build the GMP library
+# Copyright 2008 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_gmp_get() { :; }
+do_gmp_extract() { :; }
+do_gmp_for_build() { :; }
+do_gmp_for_host() { :; }
+
+# Overide functions depending on configuration
+if [ "${CT_GMP}" = "y" ]; then
+
+# Download GMP
+do_gmp_get() {
+    CT_GetFile "gmp-${CT_GMP_VERSION}" {ftp,http}://{ftp.sunet.se/pub,ftp.gnu.org}/gnu/gmp
+}
+
+# Extract GMP
+do_gmp_extract() {
+    CT_Extract "gmp-${CT_GMP_VERSION}"
+    CT_Patch "gmp" "${CT_GMP_VERSION}"
+}
+
+# Build GMP for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_gmp_for_build() {
+    local -a gmp_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing GMP for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-build-${CT_BUILD}"
+
+    gmp_opts+=( "host=${CT_BUILD}" )
+    gmp_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_gmp_backend "${gmp_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build GMP for running on host
+do_gmp_for_host() {
+    local -a gmp_opts
+
+    CT_DoStep INFO "Installing GMP for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
+
+    gmp_opts+=( "host=${CT_HOST}" )
+    gmp_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_gmp_backend "${gmp_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build GMP
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_gmp_backend() {
+    local host
+    local prefix
+    local cflags
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring GMP"
+
+    CT_DoExecLog CFG                                \
+    CFLAGS="${cflags} -fexceptions"                 \
+    "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
+        --build=${CT_BUILD}                         \
+        --host=${host}                              \
+        --prefix="${prefix}"                        \
+        --enable-fft                                \
+        --enable-mpbsd                              \
+        --enable-cxx                                \
+        --disable-shared                            \
+        --enable-static
+
+    CT_DoLog EXTRA "Building GMP"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
+        CT_DoLog EXTRA "Checking GMP"
+        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+    fi
+
+    CT_DoLog EXTRA "Installing GMP"
+    CT_DoExecLog ALL make install
+}
+
+fi # CT_GMP
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/110-mpfr.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/110-mpfr.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,152 @@ 
+# This file adds the functions to build the MPFR library
+# Copyright 2008 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_mpfr_get() { :; }
+do_mpfr_extract() { :; }
+do_mpfr_for_build() { :; }
+do_mpfr_for_host() { :; }
+
+# Overide function depending on configuration
+if [ "${CT_MPFR}" = "y" ]; then
+
+# Download MPFR
+do_mpfr_get() {
+    CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/  \
+                                 http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
+}
+
+# Extract MPFR
+do_mpfr_extract() {
+    CT_Extract "mpfr-${CT_MPFR_VERSION}"
+    CT_Patch "mpfr" "${CT_MPFR_VERSION}"
+
+    # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
+    # same version number. Unfortunately, some tarballs of MPFR are not
+    # built sanely, and thus ./configure fails on Gentoo.
+    # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
+    # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
+    # This hack is not bad per se, but the MPFR guys would be better not to
+    # do that in the future...
+    # It seems that MPFR >= 2.4.0 do not need this...
+    case "${CT_MPFR_VERSION}" in
+        2.4.*)
+            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
+            if [ ! -f .autoreconf.ct-ng ]; then
+                CT_DoLog DEBUG "Running autoreconf"
+                CT_DoExecLog ALL autoreconf
+                touch .autoreconf.ct-ng
+            fi
+            CT_Popd
+            ;;
+        1.*|2.0.*|2.1.*|2.2.*|2.3.*)
+            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
+            if [ ! -f .autotools.ct-ng ]; then
+                CT_DoLog DEBUG "Re-building autotools files"
+                CT_DoExecLog ALL autoreconf -fi
+                # Starting with libtool-1.9f, config.{guess,sub} are no longer
+                # installed without -i, but starting with libtool-2.2.6, they
+                # are no longer removed without -i. Sight... Just use -i with
+                # libtool >=2
+                # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
+                # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
+                libtoolize_opt=
+                case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
+                    0.*)    ;;
+                    1.*)    ;;
+                    *)      libtoolize_opt=-i;;
+                esac
+                CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
+                touch .autotools.ct-ng
+            fi
+            CT_Popd
+            ;;
+    esac
+}
+
+# Build MPFR for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_mpfr_for_build() {
+    local -a mpfr_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing MPFR for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-build-${CT_BUILD}"
+
+    mpfr_opts+=( "host=${CT_BUILD}" )
+    mpfr_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_mpfr_backend "${mpfr_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build MPFR for running on host
+do_mpfr_for_host() {
+    local -a mpfr_opts
+
+    CT_DoStep INFO "Installing MPFR for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
+
+    mpfr_opts+=( "host=${CT_HOST}" )
+    mpfr_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_mpfr_backend "${mpfr_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build MPFR
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_mpfr_backend() {
+    local host
+    local prefix
+    local cflags
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    # Under Cygwin, we can't build a thread-safe library
+    case "${CT_HOST}" in
+        *cygwin*)   mpfr_opts+=( --disable-thread-safe );;
+        *mingw*)    mpfr_opts+=( --disable-thread-safe );;
+        *darwin*)   mpfr_opts+=( --disable-thread-safe );;
+        *)          mpfr_opts+=( --enable-thread-safe  );;
+    esac
+
+    CT_DoLog EXTRA "Configuring MPFR"
+    CT_DoExecLog CFG                                    \
+    CC="${host}-gcc"                                    \
+    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
+    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
+        --build=${CT_BUILD}                             \
+        --host=${host}                                  \
+        --prefix="${prefix}"                            \
+        --with-gmp="${prefix}"                          \
+        --disable-shared                                \
+        --enable-static
+
+    CT_DoLog EXTRA "Building MPFR"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
+        CT_DoLog EXTRA "Checking MPFR"
+        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+    fi
+
+    CT_DoLog EXTRA "Installing MPFR"
+    CT_DoExecLog ALL make install
+}
+
+fi # CT_MPFR
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/120-ppl.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/120-ppl.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,119 @@ 
+# This file adds the functions to build the PPL library
+# Copyright 2009 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_ppl_get() { :; }
+do_ppl_extract() { :; }
+do_ppl_for_build() { :; }
+do_ppl_for_host() { :; }
+
+# Overide functions depending on configuration
+if [ "${CT_PPL}" = "y" ]; then
+
+# Download PPL
+do_ppl_get() {
+    CT_GetFile "ppl-${CT_PPL_VERSION}"                                      \
+        http://www.cs.unipr.it/ppl/Download/ftp/releases/${CT_PPL_VERSION}  \
+        ftp://ftp.cs.unipr.it/pub/ppl/releases/${CT_PPL_VERSION}            \
+        ftp://gcc.gnu.org/pub/gcc/infrastructure
+}
+
+# Extract PPL
+do_ppl_extract() {
+    CT_Extract "ppl-${CT_PPL_VERSION}"
+    CT_Patch "ppl" "${CT_PPL_VERSION}"
+}
+
+# Build PPL for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_ppl_for_build() {
+    local -a ppl_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing PPL for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-build-${CT_BUILD}"
+
+    ppl_opts+=( "host=${CT_BUILD}" )
+    ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_ppl_backend "${ppl_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build PPL for running on host
+do_ppl_for_host() {
+    local -a ppl_opts
+
+    CT_DoStep INFO "Installing PPL for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
+
+    ppl_opts+=( "host=${CT_HOST}" )
+    ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_ppl_backend "${ppl_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build PPL
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_ppl_backend() {
+    local host
+    local prefix
+    local cflags
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring PPL"
+
+    CT_DoExecLog CFG                                \
+    CFLAGS="${cflags}"                              \
+    CXXFLAGS="${cflags}"                            \
+    "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
+        --build=${CT_BUILD}                         \
+        --host=${host}                              \
+        --prefix="${prefix}"                        \
+        --with-libgmp-prefix="${prefix}"            \
+        --with-libgmpxx-prefix="${prefix}"          \
+        --with-gmp-prefix="${prefix}"               \
+        --enable-watchdog                           \
+        --disable-debugging                         \
+        --disable-assertions                        \
+        --disable-ppl_lcdd                          \
+        --disable-ppl_lpsol                         \
+        --disable-shared                            \
+        --enable-interfaces='c c++'                 \
+        --enable-static
+
+    # Maybe-options:
+    # --enable-optimization=speed  or sspeed (yes, with 2 's')
+
+    CT_DoLog EXTRA "Building PPL"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
+        CT_DoLog EXTRA "Checking PPL"
+        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+    fi
+
+    CT_DoLog EXTRA "Installing PPL"
+    CT_DoExecLog ALL make install
+
+    # Remove spuriously installed file
+    CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
+}
+
+fi # CT_PPL
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/130-cloog.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/130-cloog.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,122 @@ 
+# This file adds the functions to build the CLooG library
+# Copyright 2009 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_cloog_get() { :; }
+do_cloog_extract() { :; }
+do_cloog_for_build() { :; }
+do_cloog_for_host() { :; }
+
+# Overide functions depending on configuration
+if [ "${CT_CLOOG}" = "y" ]; then
+
+# Download CLooG
+do_cloog_get() {
+    CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
+        ftp://gcc.gnu.org/pub/gcc/infrastructure
+}
+
+# Extract CLooG
+do_cloog_extract() {
+    local _t
+
+    # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
+    # while versions 0.15.4 onward do have the version in the dirname.
+    # But, because the infrastructure properly creates the extracted
+    # directories (with tar's --strip-components), we can live safely...
+    CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
+    CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
+
+    # Help the autostuff in case it thinks there are things to regenerate...
+    CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}/m4"
+
+    if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
+        CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
+        CT_DoExecLog CFG ./autogen.sh
+        CT_Popd
+    fi
+}
+
+# Build CLooG/PPL for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_cloog_for_build() {
+    local -a cloog_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing CLooG/PPL for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-build-${CT_BUILD}"
+
+    cloog_opts+=( "host=${CT_BUILD}" )
+    cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_cloog_backend "${cloog_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build CLooG/PPL for running on host
+do_cloog_for_host() {
+    local -a cloog_opts
+
+    CT_DoStep INFO "Installing CLooG/PPL for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
+
+    cloog_opts+=( "host=${CT_HOST}" )
+    cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_cloog_backend "${cloog_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build ClooG/PPL
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_cloog_backend() {
+    local host
+    local prefix
+    local cflags
+    local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring CLooG/ppl"
+
+    CT_DoExecLog CFG                            \
+    CFLAGS="${cflags}"                          \
+    LIBS="-lm"                                  \
+    "${cloog_src_dir}/configure"                \
+        --build=${CT_BUILD}                     \
+        --host=${host}                          \
+        --prefix="${prefix}"                    \
+        --with-gmp="${prefix}"                  \
+        --with-ppl="${prefix}"                  \
+        --with-bits=gmp                         \
+        --with-host-libstdcxx='-lstdc++'        \
+        --disable-shared                        \
+        --enable-static
+
+    CT_DoLog EXTRA "Building CLooG/ppl"
+    CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
+
+    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
+        CT_DoLog EXTRA "Checking CLooG/ppl"
+        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+    fi
+
+    CT_DoLog EXTRA "Installing CLooG/ppl"
+    CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
+}
+
+fi # CT_CLOOG
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/140-mpc.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/140-mpc.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,103 @@ 
+# This file adds the functions to build the MPC library
+# Copyright 2009 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+do_mpc_get() { :; }
+do_mpc_extract() { :; }
+do_mpc_for_build() { :; }
+do_mpc_for_host() { :; }
+
+# Overide functions depending on configuration
+if [ "${CT_MPC}" = "y" ]; then
+
+# Download MPC
+do_mpc_get() {
+    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
+        http://www.multiprecision.org/mpc/download
+}
+
+# Extract MPC
+do_mpc_extract() {
+    CT_Extract "mpc-${CT_MPC_VERSION}"
+    CT_Patch "mpc" "${CT_MPC_VERSION}"
+}
+
+# Build MPC for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_mpc_for_build() {
+    local -a mpc_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing MPC for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-build-${CT_BUILD}"
+
+    mpc_opts+=( "host=${CT_BUILD}" )
+    mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_mpc_backend "${mpc_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build MPC for running on host
+do_mpc_for_host() {
+    local -a mpc_opts
+
+    CT_DoStep INFO "Installing MPC for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
+
+    mpc_opts+=( "host=${CT_HOST}" )
+    mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_mpc_backend "${mpc_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build MPC
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_mpc_backend() {
+    local host
+    local prefix
+    local cflags
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring MPC"
+
+    CT_DoExecLog CFG                                \
+    CFLAGS="${cflags}"                              \
+    "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
+        --build=${CT_BUILD}                         \
+        --host=${host}                              \
+        --prefix="${prefix}"                        \
+        --with-gmp="${prefix}"                      \
+        --with-mpfr="${prefix}"                     \
+        --disable-shared                            \
+        --enable-static
+
+    CT_DoLog EXTRA "Building MPC"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
+        CT_DoLog EXTRA "Checking MPC"
+        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
+    fi
+
+    CT_DoLog EXTRA "Installing MPC"
+    CT_DoExecLog ALL make install
+}
+
+fi # CT_MPC
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/200-libelf.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/200-libelf.sh	Fri Nov 16 14:59:27 2012 +0100
@@ -0,0 +1,135 @@ 
+# Build script for libelf
+
+do_libelf_get() { :; }
+do_libelf_extract() { :; }
+do_libelf_for_build() { :; }
+do_libelf_for_host() { :; }
+do_libelf_for_target() { :; }
+
+if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
+
+do_libelf_get() {
+    # The server hosting libelf will return an "HTTP 300 : Multiple Choices"
+    # error code if we try to download a file that does not exists there.
+    # So we have to request the file with an explicit extension.
+    CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
+}
+
+do_libelf_extract() {
+    CT_Extract "libelf-${CT_LIBELF_VERSION}"
+    CT_Patch "libelf" "${CT_LIBELF_VERSION}"
+}
+
+if [ "${CT_LIBELF}" = "y" ]; then
+
+# Build libelf for running on build
+# - always build statically
+# - we do not have build-specific CFLAGS
+# - install in build-tools prefix
+do_libelf_for_build() {
+    local -a libelf_opts
+
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    CT_DoStep INFO "Installing libelf for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-build-${CT_BUILD}"
+
+    libelf_opts+=( "host=${CT_BUILD}" )
+    libelf_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+    do_libelf_backend "${libelf_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+# Build libelf for running on host
+do_libelf_for_host() {
+    local -a libelf_opts
+
+    CT_DoStep INFO "Installing libelf for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
+
+    libelf_opts+=( "host=${CT_HOST}" )
+    libelf_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
+    libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
+    do_libelf_backend "${libelf_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+fi # CT_LIBELF
+
+if [ "${CT_LIBELF_TARGET}" = "y" ]; then
+
+do_libelf_for_target() {
+    local -a libelf_opts
+
+    CT_DoStep INFO "Installing libelf for the target"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
+
+    libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
+    libelf_opts+=( "host=${CT_TARGET}" )
+    libelf_opts+=( "prefix=/usr" )
+    libelf_opts+=( "shared=y" )
+    do_libelf_backend "${libelf_opts[@]}"
+
+    CT_Popd
+    CT_EndStep
+}
+
+fi # CT_LIBELF_TARGET
+
+# Build libelf
+#     Parameter     : description               : type      : default
+#     destdir       : out-of-tree install dir   : string    : /
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+#     shared        : also buils shared lib     : bool      : n
+do_libelf_backend() {
+    local destdir="/"
+    local host
+    local prefix
+    local cflags
+    local shared
+    local -a extra_config
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring libelf"
+
+    if [ "${shared}" = "y" ]; then
+        extra_config+=( --enable-shared )
+    else
+        extra_config+=( --disable-shared )
+    fi
+
+    CT_DoExecLog CFG                                        \
+    CC="${host}-gcc"                                        \
+    RANLIB="${host}-ranlib"                                 \
+    CFLAGS="${cflags} -fPIC"                                \
+    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
+        --build=${CT_BUILD}                                 \
+        --host=${host}                                      \
+        --target=${CT_TARGET}                               \
+        --prefix="${prefix}"                                \
+        --enable-compat                                     \
+        --enable-elf64                                      \
+        --enable-extended-format                            \
+        --enable-static                                     \
+        "${extra_config[@]}"
+
+    CT_DoLog EXTRA "Building libelf"
+    CT_DoExecLog ALL make
+
+    CT_DoLog EXTRA "Installing libelf"
+    CT_DoExecLog ALL make instroot="${destdir}" install
+}
+
+fi # CT_LIBELF || CT_LIBELF_TARGET
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/cloog.sh
--- a/scripts/build/companion_libs/cloog.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@ 
-# This file adds the functions to build the CLooG library
-# Copyright 2009 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-do_cloog_get() { :; }
-do_cloog_extract() { :; }
-do_cloog_for_build() { :; }
-do_cloog_for_host() { :; }
-
-# Overide functions depending on configuration
-if [ "${CT_CLOOG}" = "y" ]; then
-
-# Download CLooG
-do_cloog_get() {
-    CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
-        ftp://gcc.gnu.org/pub/gcc/infrastructure
-}
-
-# Extract CLooG
-do_cloog_extract() {
-    local _t
-
-    # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
-    # while versions 0.15.4 onward do have the version in the dirname.
-    # But, because the infrastructure properly creates the extracted
-    # directories (with tar's --strip-components), we can live safely...
-    CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
-    CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
-
-    # Help the autostuff in case it thinks there are things to regenerate...
-    CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}/m4"
-
-    if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
-        CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
-        CT_DoExecLog CFG ./autogen.sh
-        CT_Popd
-    fi
-}
-
-# Build CLooG/PPL for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_cloog_for_build() {
-    local -a cloog_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing CLooG/PPL for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-build-${CT_BUILD}"
-
-    cloog_opts+=( "host=${CT_BUILD}" )
-    cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_cloog_backend "${cloog_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build CLooG/PPL for running on host
-do_cloog_for_host() {
-    local -a cloog_opts
-
-    CT_DoStep INFO "Installing CLooG/PPL for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
-
-    cloog_opts+=( "host=${CT_HOST}" )
-    cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_cloog_backend "${cloog_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build ClooG/PPL
-#     Parameter     : description               : type      : default
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-do_cloog_backend() {
-    local host
-    local prefix
-    local cflags
-    local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    CT_DoLog EXTRA "Configuring CLooG/ppl"
-
-    CT_DoExecLog CFG                            \
-    CFLAGS="${cflags}"                          \
-    LIBS="-lm"                                  \
-    "${cloog_src_dir}/configure"                \
-        --build=${CT_BUILD}                     \
-        --host=${host}                          \
-        --prefix="${prefix}"                    \
-        --with-gmp="${prefix}"                  \
-        --with-ppl="${prefix}"                  \
-        --with-bits=gmp                         \
-        --with-host-libstdcxx='-lstdc++'        \
-        --disable-shared                        \
-        --enable-static
-
-    CT_DoLog EXTRA "Building CLooG/ppl"
-    CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
-
-    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
-        CT_DoLog EXTRA "Checking CLooG/ppl"
-        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
-    fi
-
-    CT_DoLog EXTRA "Installing CLooG/ppl"
-    CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
-}
-
-fi # CT_CLOOG
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/gmp.sh
--- a/scripts/build/companion_libs/gmp.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@ 
-# This file adds the functions to build the GMP library
-# Copyright 2008 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-do_gmp_get() { :; }
-do_gmp_extract() { :; }
-do_gmp_for_build() { :; }
-do_gmp_for_host() { :; }
-
-# Overide functions depending on configuration
-if [ "${CT_GMP}" = "y" ]; then
-
-# Download GMP
-do_gmp_get() {
-    CT_GetFile "gmp-${CT_GMP_VERSION}" {ftp,http}://{ftp.sunet.se/pub,ftp.gnu.org}/gnu/gmp
-}
-
-# Extract GMP
-do_gmp_extract() {
-    CT_Extract "gmp-${CT_GMP_VERSION}"
-    CT_Patch "gmp" "${CT_GMP_VERSION}"
-}
-
-# Build GMP for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_gmp_for_build() {
-    local -a gmp_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing GMP for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-build-${CT_BUILD}"
-
-    gmp_opts+=( "host=${CT_BUILD}" )
-    gmp_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_gmp_backend "${gmp_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build GMP for running on host
-do_gmp_for_host() {
-    local -a gmp_opts
-
-    CT_DoStep INFO "Installing GMP for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
-
-    gmp_opts+=( "host=${CT_HOST}" )
-    gmp_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_gmp_backend "${gmp_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build GMP
-#     Parameter     : description               : type      : default
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-do_gmp_backend() {
-    local host
-    local prefix
-    local cflags
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    CT_DoLog EXTRA "Configuring GMP"
-
-    CT_DoExecLog CFG                                \
-    CFLAGS="${cflags} -fexceptions"                 \
-    "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
-        --build=${CT_BUILD}                         \
-        --host=${host}                              \
-        --prefix="${prefix}"                        \
-        --enable-fft                                \
-        --enable-mpbsd                              \
-        --enable-cxx                                \
-        --disable-shared                            \
-        --enable-static
-
-    CT_DoLog EXTRA "Building GMP"
-    CT_DoExecLog ALL make ${JOBSFLAGS}
-
-    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
-        CT_DoLog EXTRA "Checking GMP"
-        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
-    fi
-
-    CT_DoLog EXTRA "Installing GMP"
-    CT_DoExecLog ALL make install
-}
-
-fi # CT_GMP
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/libelf.sh
--- a/scripts/build/companion_libs/libelf.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@ 
-# Build script for libelf
-
-do_libelf_get() { :; }
-do_libelf_extract() { :; }
-do_libelf_for_build() { :; }
-do_libelf_for_host() { :; }
-do_libelf_for_target() { :; }
-
-if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
-
-do_libelf_get() {
-    # The server hosting libelf will return an "HTTP 300 : Multiple Choices"
-    # error code if we try to download a file that does not exists there.
-    # So we have to request the file with an explicit extension.
-    CT_GetFile "libelf-${CT_LIBELF_VERSION}" .tar.gz http://www.mr511.de/software/
-}
-
-do_libelf_extract() {
-    CT_Extract "libelf-${CT_LIBELF_VERSION}"
-    CT_Patch "libelf" "${CT_LIBELF_VERSION}"
-}
-
-if [ "${CT_LIBELF}" = "y" ]; then
-
-# Build libelf for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_libelf_for_build() {
-    local -a libelf_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing libelf for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-build-${CT_BUILD}"
-
-    libelf_opts+=( "host=${CT_BUILD}" )
-    libelf_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_libelf_backend "${libelf_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build libelf for running on host
-do_libelf_for_host() {
-    local -a libelf_opts
-
-    CT_DoStep INFO "Installing libelf for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
-
-    libelf_opts+=( "host=${CT_HOST}" )
-    libelf_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_libelf_backend "${libelf_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-fi # CT_LIBELF
-
-if [ "${CT_LIBELF_TARGET}" = "y" ]; then
-
-do_libelf_for_target() {
-    local -a libelf_opts
-
-    CT_DoStep INFO "Installing libelf for the target"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
-
-    libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
-    libelf_opts+=( "host=${CT_TARGET}" )
-    libelf_opts+=( "prefix=/usr" )
-    libelf_opts+=( "shared=y" )
-    do_libelf_backend "${libelf_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-fi # CT_LIBELF_TARGET
-
-# Build libelf
-#     Parameter     : description               : type      : default
-#     destdir       : out-of-tree install dir   : string    : /
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-#     shared        : also buils shared lib     : bool      : n
-do_libelf_backend() {
-    local destdir="/"
-    local host
-    local prefix
-    local cflags
-    local shared
-    local -a extra_config
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    CT_DoLog EXTRA "Configuring libelf"
-
-    if [ "${shared}" = "y" ]; then
-        extra_config+=( --enable-shared )
-    else
-        extra_config+=( --disable-shared )
-    fi
-
-    CT_DoExecLog CFG                                        \
-    CC="${host}-gcc"                                        \
-    RANLIB="${host}-ranlib"                                 \
-    CFLAGS="${cflags} -fPIC"                                \
-    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
-        --build=${CT_BUILD}                                 \
-        --host=${host}                                      \
-        --target=${CT_TARGET}                               \
-        --prefix="${prefix}"                                \
-        --enable-compat                                     \
-        --enable-elf64                                      \
-        --enable-extended-format                            \
-        --enable-static                                     \
-        "${extra_config[@]}"
-
-    CT_DoLog EXTRA "Building libelf"
-    CT_DoExecLog ALL make
-
-    CT_DoLog EXTRA "Installing libelf"
-    CT_DoExecLog ALL make instroot="${destdir}" install
-}
-
-fi # CT_LIBELF || CT_LIBELF_TARGET
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/mpc.sh
--- a/scripts/build/companion_libs/mpc.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@ 
-# This file adds the functions to build the MPC library
-# Copyright 2009 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-do_mpc_get() { :; }
-do_mpc_extract() { :; }
-do_mpc_for_build() { :; }
-do_mpc_for_host() { :; }
-
-# Overide functions depending on configuration
-if [ "${CT_MPC}" = "y" ]; then
-
-# Download MPC
-do_mpc_get() {
-    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
-        http://www.multiprecision.org/mpc/download
-}
-
-# Extract MPC
-do_mpc_extract() {
-    CT_Extract "mpc-${CT_MPC_VERSION}"
-    CT_Patch "mpc" "${CT_MPC_VERSION}"
-}
-
-# Build MPC for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_mpc_for_build() {
-    local -a mpc_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing MPC for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-build-${CT_BUILD}"
-
-    mpc_opts+=( "host=${CT_BUILD}" )
-    mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_mpc_backend "${mpc_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build MPC for running on host
-do_mpc_for_host() {
-    local -a mpc_opts
-
-    CT_DoStep INFO "Installing MPC for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
-
-    mpc_opts+=( "host=${CT_HOST}" )
-    mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_mpc_backend "${mpc_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build MPC
-#     Parameter     : description               : type      : default
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-do_mpc_backend() {
-    local host
-    local prefix
-    local cflags
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    CT_DoLog EXTRA "Configuring MPC"
-
-    CT_DoExecLog CFG                                \
-    CFLAGS="${cflags}"                              \
-    "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
-        --build=${CT_BUILD}                         \
-        --host=${host}                              \
-        --prefix="${prefix}"                        \
-        --with-gmp="${prefix}"                      \
-        --with-mpfr="${prefix}"                     \
-        --disable-shared                            \
-        --enable-static
-
-    CT_DoLog EXTRA "Building MPC"
-    CT_DoExecLog ALL make ${JOBSFLAGS}
-
-    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
-        CT_DoLog EXTRA "Checking MPC"
-        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
-    fi
-
-    CT_DoLog EXTRA "Installing MPC"
-    CT_DoExecLog ALL make install
-}
-
-fi # CT_MPC
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/mpfr.sh
--- a/scripts/build/companion_libs/mpfr.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@ 
-# This file adds the functions to build the MPFR library
-# Copyright 2008 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-do_mpfr_get() { :; }
-do_mpfr_extract() { :; }
-do_mpfr_for_build() { :; }
-do_mpfr_for_host() { :; }
-
-# Overide function depending on configuration
-if [ "${CT_MPFR}" = "y" ]; then
-
-# Download MPFR
-do_mpfr_get() {
-    CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/  \
-                                 http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
-}
-
-# Extract MPFR
-do_mpfr_extract() {
-    CT_Extract "mpfr-${CT_MPFR_VERSION}"
-    CT_Patch "mpfr" "${CT_MPFR_VERSION}"
-
-    # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
-    # same version number. Unfortunately, some tarballs of MPFR are not
-    # built sanely, and thus ./configure fails on Gentoo.
-    # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
-    # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
-    # This hack is not bad per se, but the MPFR guys would be better not to
-    # do that in the future...
-    # It seems that MPFR >= 2.4.0 do not need this...
-    case "${CT_MPFR_VERSION}" in
-        2.4.*)
-            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
-            if [ ! -f .autoreconf.ct-ng ]; then
-                CT_DoLog DEBUG "Running autoreconf"
-                CT_DoExecLog ALL autoreconf
-                touch .autoreconf.ct-ng
-            fi
-            CT_Popd
-            ;;
-        1.*|2.0.*|2.1.*|2.2.*|2.3.*)
-            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
-            if [ ! -f .autotools.ct-ng ]; then
-                CT_DoLog DEBUG "Re-building autotools files"
-                CT_DoExecLog ALL autoreconf -fi
-                # Starting with libtool-1.9f, config.{guess,sub} are no longer
-                # installed without -i, but starting with libtool-2.2.6, they
-                # are no longer removed without -i. Sight... Just use -i with
-                # libtool >=2
-                # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
-                # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
-                libtoolize_opt=
-                case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
-                    0.*)    ;;
-                    1.*)    ;;
-                    *)      libtoolize_opt=-i;;
-                esac
-                CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
-                touch .autotools.ct-ng
-            fi
-            CT_Popd
-            ;;
-    esac
-}
-
-# Build MPFR for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_mpfr_for_build() {
-    local -a mpfr_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing MPFR for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-build-${CT_BUILD}"
-
-    mpfr_opts+=( "host=${CT_BUILD}" )
-    mpfr_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_mpfr_backend "${mpfr_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build MPFR for running on host
-do_mpfr_for_host() {
-    local -a mpfr_opts
-
-    CT_DoStep INFO "Installing MPFR for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
-
-    mpfr_opts+=( "host=${CT_HOST}" )
-    mpfr_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_mpfr_backend "${mpfr_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build MPFR
-#     Parameter     : description               : type      : default
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-do_mpfr_backend() {
-    local host
-    local prefix
-    local cflags
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    # Under Cygwin, we can't build a thread-safe library
-    case "${CT_HOST}" in
-        *cygwin*)   mpfr_opts+=( --disable-thread-safe );;
-        *mingw*)    mpfr_opts+=( --disable-thread-safe );;
-        *darwin*)   mpfr_opts+=( --disable-thread-safe );;
-        *)          mpfr_opts+=( --enable-thread-safe  );;
-    esac
-
-    CT_DoLog EXTRA "Configuring MPFR"
-    CT_DoExecLog CFG                                    \
-    CC="${host}-gcc"                                    \
-    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
-    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
-        --build=${CT_BUILD}                             \
-        --host=${host}                                  \
-        --prefix="${prefix}"                            \
-        --with-gmp="${prefix}"                          \
-        --disable-shared                                \
-        --enable-static
-
-    CT_DoLog EXTRA "Building MPFR"
-    CT_DoExecLog ALL make ${JOBSFLAGS}
-
-    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
-        CT_DoLog EXTRA "Checking MPFR"
-        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
-    fi
-
-    CT_DoLog EXTRA "Installing MPFR"
-    CT_DoExecLog ALL make install
-}
-
-fi # CT_MPFR
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/build/companion_libs/ppl.sh
--- a/scripts/build/companion_libs/ppl.sh	Thu Nov 15 20:51:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@ 
-# This file adds the functions to build the PPL library
-# Copyright 2009 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-do_ppl_get() { :; }
-do_ppl_extract() { :; }
-do_ppl_for_build() { :; }
-do_ppl_for_host() { :; }
-
-# Overide functions depending on configuration
-if [ "${CT_PPL}" = "y" ]; then
-
-# Download PPL
-do_ppl_get() {
-    CT_GetFile "ppl-${CT_PPL_VERSION}"                                      \
-        http://www.cs.unipr.it/ppl/Download/ftp/releases/${CT_PPL_VERSION}  \
-        ftp://ftp.cs.unipr.it/pub/ppl/releases/${CT_PPL_VERSION}            \
-        ftp://gcc.gnu.org/pub/gcc/infrastructure
-}
-
-# Extract PPL
-do_ppl_extract() {
-    CT_Extract "ppl-${CT_PPL_VERSION}"
-    CT_Patch "ppl" "${CT_PPL_VERSION}"
-}
-
-# Build PPL for running on build
-# - always build statically
-# - we do not have build-specific CFLAGS
-# - install in build-tools prefix
-do_ppl_for_build() {
-    local -a ppl_opts
-
-    case "${CT_TOOLCHAIN_TYPE}" in
-        native|cross)   return 0;;
-    esac
-
-    CT_DoStep INFO "Installing PPL for build"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-build-${CT_BUILD}"
-
-    ppl_opts+=( "host=${CT_BUILD}" )
-    ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
-    do_ppl_backend "${ppl_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build PPL for running on host
-do_ppl_for_host() {
-    local -a ppl_opts
-
-    CT_DoStep INFO "Installing PPL for host"
-    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
-
-    ppl_opts+=( "host=${CT_HOST}" )
-    ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
-    ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
-    do_ppl_backend "${ppl_opts[@]}"
-
-    CT_Popd
-    CT_EndStep
-}
-
-# Build PPL
-#     Parameter     : description               : type      : default
-#     host          : machine to run on         : tuple     : (none)
-#     prefix        : prefix to install into    : dir       : (none)
-#     cflags        : host cflags to use        : string    : (empty)
-do_ppl_backend() {
-    local host
-    local prefix
-    local cflags
-    local arg
-
-    for arg in "$@"; do
-        eval "${arg// /\\ }"
-    done
-
-    CT_DoLog EXTRA "Configuring PPL"
-
-    CT_DoExecLog CFG                                \
-    CFLAGS="${cflags}"                              \
-    CXXFLAGS="${cflags}"                            \
-    "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
-        --build=${CT_BUILD}                         \
-        --host=${host}                              \
-        --prefix="${prefix}"                        \
-        --with-libgmp-prefix="${prefix}"            \
-        --with-libgmpxx-prefix="${prefix}"          \
-        --with-gmp-prefix="${prefix}"               \
-        --enable-watchdog                           \
-        --disable-debugging                         \
-        --disable-assertions                        \
-        --disable-ppl_lcdd                          \
-        --disable-ppl_lpsol                         \
-        --disable-shared                            \
-        --enable-interfaces='c c++'                 \
-        --enable-static
-
-    # Maybe-options:
-    # --enable-optimization=speed  or sspeed (yes, with 2 's')
-
-    CT_DoLog EXTRA "Building PPL"
-    CT_DoExecLog ALL make ${JOBSFLAGS}
-
-    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
-        CT_DoLog EXTRA "Checking PPL"
-        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
-    fi
-
-    CT_DoLog EXTRA "Installing PPL"
-    CT_DoExecLog ALL make install
-
-    # Remove spuriously installed file
-    CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
-}
-
-fi # CT_PPL
diff -r 8453ccdc5098 -r 515c5c4635d9 scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Thu Nov 15 20:51:31 2012 +0100
+++ b/scripts/crosstool-NG.sh.in	Fri Nov 16 14:59:27 2012 +0100
@@ -126,12 +126,7 @@ 
 . "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
 . "${CT_LIB_DIR}/scripts/build/companion_tools.sh"
 . "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/gmp.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/mpfr.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/ppl.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/cloog.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/mpc.sh"
-. "${CT_LIB_DIR}/scripts/build/companion_libs/libelf.sh"
+. "${CT_LIB_DIR}/scripts/build/companion_libs.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/sstrip.sh"
@@ -539,12 +534,7 @@ 
     CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
     do_companion_tools_get
     do_kernel_get
-    do_gmp_get
-    do_mpfr_get
-    do_ppl_get
-    do_cloog_get
-    do_mpc_get
-    do_libelf_get
+    do_companion_libs_get
     do_binutils_get
     do_elf2flt_get
     do_sstrip_get
@@ -569,12 +559,7 @@ 
 
         CT_DoStep INFO "Extracting and patching toolchain components"
         do_kernel_extract
-        do_gmp_extract
-        do_mpfr_extract
-        do_ppl_extract
-        do_cloog_extract
-        do_mpc_extract
-        do_libelf_extract
+        do_companion_libs_extract
         do_binutils_extract
         do_elf2flt_extract
         do_sstrip_extract
diff -r 8453ccdc5098 -r 515c5c4635d9 steps.mk
--- a/steps.mk	Thu Nov 15 20:51:31 2012 +0100
+++ b/steps.mk	Fri Nov 16 14:59:27 2012 +0100
@@ -18,37 +18,27 @@ 
 # but are actual steps for canadian and cross-native.
 # Please keep the last line with a '\' and keep the following empy line:
 # it helps when diffing and merging.
-CT_STEPS := libc_check_config   \
-            gmp_for_build       \
-            mpfr_for_build      \
-            ppl_for_build       \
-            cloog_for_build     \
-            mpc_for_build       \
-            libelf_for_build    \
-            binutils_for_build  \
-            elf2flt_for_build   \
-            gmp_for_host        \
-            mpfr_for_host       \
-            ppl_for_host        \
-            cloog_for_host      \
-            mpc_for_host        \
-            libelf_for_host     \
-            binutils_for_host   \
-            elf2flt_for_host    \
-            sstrip_for_host     \
-            cc_core_pass_1      \
-            kernel_headers      \
-            libc_start_files    \
-            cc_core_pass_2      \
-            libc                \
-            cc_for_build        \
-            cc_for_host         \
-            libc_finish         \
-            libelf_for_target   \
-            binutils_for_target \
-            debug               \
-            test_suite          \
-            finish              \
+CT_STEPS := libc_check_config        \
+            companion_libs_for_build \
+            binutils_for_build       \
+            elf2flt_for_build        \
+            companion_libs_for_host  \
+            binutils_for_host        \
+            elf2flt_for_host         \
+            sstrip_for_host          \
+            cc_core_pass_1           \
+            kernel_headers           \
+            libc_start_files         \
+            cc_core_pass_2           \
+            libc                     \
+            cc_for_build             \
+            cc_for_host              \
+            libc_finish              \
+            libelf_for_target        \
+            binutils_for_target      \
+            debug                    \
+            test_suite               \
+            finish                   \
 
 # Keep an empty line above this comment, so the last
 # back-slash terminated line works as expected.