complibs: split companion libraries to backend/frontend, a-la cc_core
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 18:56:30 2011 +0200 (2011-07-17)
changeset 2927ddaae597fd7c
parent 2926 d304c8a7bfa8
child 2928 3f70dd642d34
complibs: split companion libraries to backend/frontend, a-la cc_core

Move the actual complibs codes to backend functions that builds the
required combo of build/host/target as requested by a frontend.

This split is currently a no-op, but is required for the upcoming
canadian-cross rework, where we'll be needing to build the complibs
twice, one for build/build, and one for build/host.

This applies to the six companion libraries:
- GMP
- MPFR
- PPL
- Cloog/PPL
- MPC
- libelf

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/companion_libs/cloog.sh
scripts/build/companion_libs/gmp.sh
scripts/build/companion_libs/libelf.sh
scripts/build/companion_libs/mpc.sh
scripts/build/companion_libs/mpfr.sh
scripts/build/companion_libs/ppl.sh
steps.mk
     1.1 --- a/scripts/build/companion_libs/cloog.sh	Sun Jul 17 18:29:35 2011 +0200
     1.2 +++ b/scripts/build/companion_libs/cloog.sh	Sun Jul 17 18:56:30 2011 +0200
     1.3 @@ -4,7 +4,7 @@
     1.4  
     1.5  do_cloog_get() { :; }
     1.6  do_cloog_extract() { :; }
     1.7 -do_cloog() { :; }
     1.8 +do_cloog_for_host() { :; }
     1.9  
    1.10  # Overide functions depending on configuration
    1.11  if [ "${CT_CLOOG}" = "y" ]; then
    1.12 @@ -33,25 +33,49 @@
    1.13      fi
    1.14  }
    1.15  
    1.16 -do_cloog() {
    1.17 +# Build CLooG/PPL for running on host
    1.18 +do_cloog_for_host() {
    1.19 +    local -a cloog_opts
    1.20 +
    1.21 +    CT_DoStep INFO "Installing CLooG/PPL for host"
    1.22 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
    1.23 +
    1.24 +    cloog_opts+=( "host=${CT_HOST}" )
    1.25 +    cloog_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    1.26 +    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.27 +    do_cloog_backend "${cloog_opts[@]}"
    1.28 +
    1.29 +    CT_Popd
    1.30 +    CT_EndStep
    1.31 +}
    1.32 +
    1.33 +# Build ClooG/PPL
    1.34 +#     Parameter     : description               : type      : default
    1.35 +#     host          : machine to run on         : tuple     : (none)
    1.36 +#     prefix        : prefix to install into    : dir       : (none)
    1.37 +#     cflags        : host cflags to use        : string    : (empty)
    1.38 +do_cloog_backend() {
    1.39 +    local host
    1.40 +    local prefix
    1.41 +    local cflags
    1.42      local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    1.43 +    local arg
    1.44  
    1.45 -    mkdir -p "${CT_BUILD_DIR}/build-cloog-ppl"
    1.46 -    cd "${CT_BUILD_DIR}/build-cloog-ppl"
    1.47 -
    1.48 -    CT_DoStep INFO "Installing CLooG/ppl"
    1.49 +    for arg in "$@"; do
    1.50 +        eval "${arg// /\\ }"
    1.51 +    done
    1.52  
    1.53      CT_DoLog EXTRA "Configuring CLooG/ppl"
    1.54  
    1.55      CT_DoExecLog CFG                            \
    1.56 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
    1.57 +    CFLAGS="${cflags}"                          \
    1.58      LIBS="-lm"                                  \
    1.59      "${cloog_src_dir}/configure"                \
    1.60          --build=${CT_BUILD}                     \
    1.61 -        --host=${CT_HOST}                       \
    1.62 -        --prefix="${CT_COMPLIBS_DIR}"           \
    1.63 -        --with-gmp="${CT_COMPLIBS_DIR}"         \
    1.64 -        --with-ppl="${CT_COMPLIBS_DIR}"         \
    1.65 +        --host=${host}                          \
    1.66 +        --prefix="${prefix}"                    \
    1.67 +        --with-gmp="${prefix}"                  \
    1.68 +        --with-ppl="${prefix}"                  \
    1.69          --with-bits=gmp                         \
    1.70          --with-host-libstdcxx='-lstdc++'        \
    1.71          --disable-shared                        \
    1.72 @@ -67,8 +91,6 @@
    1.73  
    1.74      CT_DoLog EXTRA "Installing CLooG/ppl"
    1.75      CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
    1.76 -
    1.77 -    CT_EndStep
    1.78  }
    1.79  
    1.80  fi # CT_CLOOG
     2.1 --- a/scripts/build/companion_libs/gmp.sh	Sun Jul 17 18:29:35 2011 +0200
     2.2 +++ b/scripts/build/companion_libs/gmp.sh	Sun Jul 17 18:56:30 2011 +0200
     2.3 @@ -4,7 +4,7 @@
     2.4  
     2.5  do_gmp_get() { :; }
     2.6  do_gmp_extract() { :; }
     2.7 -do_gmp() { :; }
     2.8 +do_gmp_for_host() { :; }
     2.9  
    2.10  # Overide functions depending on configuration
    2.11  if [ "${CT_GMP}" = "y" ]; then
    2.12 @@ -20,20 +20,45 @@
    2.13      CT_Patch "gmp" "${CT_GMP_VERSION}"
    2.14  }
    2.15  
    2.16 -do_gmp() {
    2.17 -    mkdir -p "${CT_BUILD_DIR}/build-gmp"
    2.18 -    cd "${CT_BUILD_DIR}/build-gmp"
    2.19 +# Build GMP for running on host
    2.20 +do_gmp_for_host() {
    2.21 +    local -a gmp_opts
    2.22  
    2.23 -    CT_DoStep INFO "Installing GMP"
    2.24 +    CT_DoStep INFO "Installing GMP for host"
    2.25 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
    2.26 +
    2.27 +    gmp_opts+=( "host=${CT_HOST}" )
    2.28 +    gmp_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    2.29 +    gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    2.30 +    do_gmp_backend "${gmp_opts[@]}"
    2.31 +
    2.32 +    CT_Popd
    2.33 +    CT_EndStep
    2.34 +}
    2.35 +
    2.36 +# Build GMP
    2.37 +#     Parameter     : description               : type      : default
    2.38 +#     host          : machine to run on         : tuple     : (none)
    2.39 +#     prefix        : prefix to install into    : dir       : (none)
    2.40 +#     cflags        : host cflags to use        : string    : (empty)
    2.41 +do_gmp_backend() {
    2.42 +    local host
    2.43 +    local prefix
    2.44 +    local cflags
    2.45 +    local arg
    2.46 +
    2.47 +    for arg in "$@"; do
    2.48 +        eval "${arg// /\\ }"
    2.49 +    done
    2.50  
    2.51      CT_DoLog EXTRA "Configuring GMP"
    2.52  
    2.53      CT_DoExecLog CFG                                \
    2.54 -    CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions"     \
    2.55 +    CFLAGS="${cflags} -fexceptions"                 \
    2.56      "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    2.57          --build=${CT_BUILD}                         \
    2.58 -        --host=${CT_HOST}                           \
    2.59 -        --prefix="${CT_COMPLIBS_DIR}"               \
    2.60 +        --host=${host}                              \
    2.61 +        --prefix="${prefix}"                        \
    2.62          --enable-fft                                \
    2.63          --enable-mpbsd                              \
    2.64          --enable-cxx                                \
    2.65 @@ -50,8 +75,6 @@
    2.66  
    2.67      CT_DoLog EXTRA "Installing GMP"
    2.68      CT_DoExecLog ALL make install
    2.69 -
    2.70 -    CT_EndStep
    2.71  }
    2.72  
    2.73  fi # CT_GMP
     3.1 --- a/scripts/build/companion_libs/libelf.sh	Sun Jul 17 18:29:35 2011 +0200
     3.2 +++ b/scripts/build/companion_libs/libelf.sh	Sun Jul 17 18:56:30 2011 +0200
     3.3 @@ -2,7 +2,7 @@
     3.4  
     3.5  do_libelf_get() { :; }
     3.6  do_libelf_extract() { :; }
     3.7 -do_libelf() { :; }
     3.8 +do_libelf_for_host() { :; }
     3.9  do_libelf_for_target() { :; }
    3.10  
    3.11  if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
    3.12 @@ -21,32 +21,17 @@
    3.13  
    3.14  if [ "${CT_LIBELF}" = "y" ]; then
    3.15  
    3.16 -do_libelf() {
    3.17 -    CT_DoStep INFO "Installing libelf"
    3.18 -    mkdir -p "${CT_BUILD_DIR}/build-libelf"
    3.19 -    CT_Pushd "${CT_BUILD_DIR}/build-libelf"
    3.20 +# Build libelf for running on host
    3.21 +do_libelf_for_host() {
    3.22 +    local -a libelf_opts
    3.23  
    3.24 -    CT_DoLog EXTRA "Configuring libelf"
    3.25 +    CT_DoStep INFO "Installing libelf for host"
    3.26 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
    3.27  
    3.28 -    CT_DoExecLog CFG                                        \
    3.29 -    CC="${CT_HOST}-gcc"                                     \
    3.30 -    CFLAGS="-fPIC"                                          \
    3.31 -    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    3.32 -        --build=${CT_BUILD}                                 \
    3.33 -        --host=${CT_HOST}                                   \
    3.34 -        --target=${CT_TARGET}                               \
    3.35 -        --prefix="${CT_COMPLIBS_DIR}"                       \
    3.36 -        --enable-compat                                     \
    3.37 -        --enable-elf64                                      \
    3.38 -        --enable-extended-format                            \
    3.39 -        --disable-shared                                    \
    3.40 -        --enable-static
    3.41 -
    3.42 -    CT_DoLog EXTRA "Building libelf"
    3.43 -    CT_DoExecLog ALL make
    3.44 -
    3.45 -    CT_DoLog EXTRA "Installing libelf"
    3.46 -    CT_DoExecLog ALL make install
    3.47 +    libelf_opts+=( "host=${CT_HOST}" )
    3.48 +    libelf_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    3.49 +    libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    3.50 +    do_libelf_backend "${libelf_opts[@]}"
    3.51  
    3.52      CT_Popd
    3.53      CT_EndStep
    3.54 @@ -57,31 +42,16 @@
    3.55  if [ "${CT_LIBELF_TARGET}" = "y" ]; then
    3.56  
    3.57  do_libelf_for_target() {
    3.58 +    local -a libelf_opts
    3.59 +
    3.60      CT_DoStep INFO "Installing libelf for the target"
    3.61 -    mkdir -p "${CT_BUILD_DIR}/build-libelf-for-target"
    3.62 -    CT_Pushd "${CT_BUILD_DIR}/build-libelf-for-target"
    3.63 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
    3.64  
    3.65 -    CT_DoLog EXTRA "Configuring libelf"
    3.66 -    CT_DoExecLog CFG                                        \
    3.67 -    CC="${CT_TARGET}-gcc"                                   \
    3.68 -    CFLAGS="-fPIC"                                          \
    3.69 -    RANLIB="${CT_TARGET}-ranlib"                            \
    3.70 -    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
    3.71 -        --build=${CT_BUILD}                                 \
    3.72 -        --host=${CT_TARGET}                                 \
    3.73 -        --target=${CT_TARGET}                               \
    3.74 -        --prefix=/usr                                       \
    3.75 -        --enable-compat                                     \
    3.76 -        --enable-elf64                                      \
    3.77 -        --enable-shared                                     \
    3.78 -        --enable-extended-format                            \
    3.79 -        --enable-static
    3.80 -
    3.81 -    CT_DoLog EXTRA "Building libelf"
    3.82 -    CT_DoExecLog ALL make
    3.83 -
    3.84 -    CT_DoLog EXTRA "Installing libelf"
    3.85 -    CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
    3.86 +    libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
    3.87 +    libelf_opts+=( "host=${CT_TARGET}" )
    3.88 +    libelf_opts+=( "prefix=/usr" )
    3.89 +    libelf_opts+=( "shared=y" )
    3.90 +    do_libelf_backend "${libelf_opts[@]}"
    3.91  
    3.92      CT_Popd
    3.93      CT_EndStep
    3.94 @@ -89,4 +59,54 @@
    3.95  
    3.96  fi # CT_LIBELF_TARGET
    3.97  
    3.98 +# Build libelf
    3.99 +#     Parameter     : description               : type      : default
   3.100 +#     destdir       : out-of-tree install dir   : string    : /
   3.101 +#     host          : machine to run on         : tuple     : (none)
   3.102 +#     prefix        : prefix to install into    : dir       : (none)
   3.103 +#     cflags        : host cflags to use        : string    : (empty)
   3.104 +#     shared        : also buils shared lib     : bool      : n
   3.105 +do_libelf_backend() {
   3.106 +    local destdir="/"
   3.107 +    local host
   3.108 +    local prefix
   3.109 +    local cflags
   3.110 +    local shared
   3.111 +    local -a extra_config
   3.112 +    local arg
   3.113 +
   3.114 +    for arg in "$@"; do
   3.115 +        eval "${arg// /\\ }"
   3.116 +    done
   3.117 +
   3.118 +    CT_DoLog EXTRA "Configuring libelf"
   3.119 +
   3.120 +    if [ "${shared}" = "y" ]; then
   3.121 +        extra_config+=( --enable-shared )
   3.122 +    else
   3.123 +        extra_config+=( --disable-shared )
   3.124 +    fi
   3.125 +
   3.126 +    CT_DoExecLog CFG                                        \
   3.127 +    CC="${host}-gcc"                                        \
   3.128 +    RANLIB="${host}-ranlib"                                 \
   3.129 +    CFLAGS="${cflags} -fPIC"                                \
   3.130 +    "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure"   \
   3.131 +        --build=${CT_BUILD}                                 \
   3.132 +        --host=${host}                                      \
   3.133 +        --target=${CT_TARGET}                               \
   3.134 +        --prefix="${prefix}"                                \
   3.135 +        --enable-compat                                     \
   3.136 +        --enable-elf64                                      \
   3.137 +        --enable-extended-format                            \
   3.138 +        --enable-static                                     \
   3.139 +        "${extra_config[@]}"
   3.140 +
   3.141 +    CT_DoLog EXTRA "Building libelf"
   3.142 +    CT_DoExecLog ALL make
   3.143 +
   3.144 +    CT_DoLog EXTRA "Installing libelf"
   3.145 +    CT_DoExecLog ALL make instroot="${destdir}" install
   3.146 +}
   3.147 +
   3.148  fi # CT_LIBELF || CT_LIBELF_TARGET
     4.1 --- a/scripts/build/companion_libs/mpc.sh	Sun Jul 17 18:29:35 2011 +0200
     4.2 +++ b/scripts/build/companion_libs/mpc.sh	Sun Jul 17 18:56:30 2011 +0200
     4.3 @@ -4,7 +4,7 @@
     4.4  
     4.5  do_mpc_get() { :; }
     4.6  do_mpc_extract() { :; }
     4.7 -do_mpc() { :; }
     4.8 +do_mpc_for_host() { :; }
     4.9  
    4.10  # Overide functions depending on configuration
    4.11  if [ "${CT_MPC}" = "y" ]; then
    4.12 @@ -21,22 +21,47 @@
    4.13      CT_Patch "mpc" "${CT_MPC_VERSION}"
    4.14  }
    4.15  
    4.16 -do_mpc() {
    4.17 -    mkdir -p "${CT_BUILD_DIR}/build-mpc"
    4.18 -    cd "${CT_BUILD_DIR}/build-mpc"
    4.19 +# Build MPC for running on host
    4.20 +do_mpc_for_host() {
    4.21 +    local -a mpc_opts
    4.22  
    4.23 -    CT_DoStep INFO "Installing MPC"
    4.24 +    CT_DoStep INFO "Installing MPC for host"
    4.25 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
    4.26 +
    4.27 +    mpc_opts+=( "host=${CT_HOST}" )
    4.28 +    mpc_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    4.29 +    mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    4.30 +    do_mpc_backend "${mpc_opts[@]}"
    4.31 +
    4.32 +    CT_Popd
    4.33 +    CT_EndStep
    4.34 +}
    4.35 +
    4.36 +# Build MPC
    4.37 +#     Parameter     : description               : type      : default
    4.38 +#     host          : machine to run on         : tuple     : (none)
    4.39 +#     prefix        : prefix to install into    : dir       : (none)
    4.40 +#     cflags        : host cflags to use        : string    : (empty)
    4.41 +do_mpc_backend() {
    4.42 +    local host
    4.43 +    local prefix
    4.44 +    local cflags
    4.45 +    local arg
    4.46 +
    4.47 +    for arg in "$@"; do
    4.48 +        eval "${arg// /\\ }"
    4.49 +    done
    4.50  
    4.51      CT_DoLog EXTRA "Configuring MPC"
    4.52  
    4.53      CT_DoExecLog CFG                                \
    4.54 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    4.55 +    CFLAGS="${cflags}"                              \
    4.56      "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
    4.57          --build=${CT_BUILD}                         \
    4.58 -        --host=${CT_HOST}                           \
    4.59 -        --prefix="${CT_COMPLIBS_DIR}"               \
    4.60 -        --with-gmp="${CT_COMPLIBS_DIR}"             \
    4.61 -        --with-mpfr="${CT_COMPLIBS_DIR}"            \
    4.62 +        --host=${host}                              \
    4.63 +        --prefix="${prefix}"                        \
    4.64 +        --with-gmp="${prefix}"                      \
    4.65 +        --with-mpfr="${prefix}"                     \
    4.66          --disable-shared                            \
    4.67          --enable-static
    4.68  
    4.69 @@ -50,8 +75,6 @@
    4.70  
    4.71      CT_DoLog EXTRA "Installing MPC"
    4.72      CT_DoExecLog ALL make install
    4.73 -
    4.74 -    CT_EndStep
    4.75  }
    4.76  
    4.77  fi # CT_MPC
     5.1 --- a/scripts/build/companion_libs/mpfr.sh	Sun Jul 17 18:29:35 2011 +0200
     5.2 +++ b/scripts/build/companion_libs/mpfr.sh	Sun Jul 17 18:56:30 2011 +0200
     5.3 @@ -4,7 +4,7 @@
     5.4  
     5.5  do_mpfr_get() { :; }
     5.6  do_mpfr_extract() { :; }
     5.7 -do_mpfr() { :; }
     5.8 +do_mpfr_for_host() { :; }
     5.9  
    5.10  # Overide function depending on configuration
    5.11  if [ "${CT_MPFR}" = "y" ]; then
    5.12 @@ -63,11 +63,36 @@
    5.13      esac
    5.14  }
    5.15  
    5.16 -do_mpfr() {
    5.17 -    mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    5.18 -    cd "${CT_BUILD_DIR}/build-mpfr"
    5.19 +# Build MPFR for running on host
    5.20 +do_mpfr_for_host() {
    5.21 +    local -a mpfr_opts
    5.22  
    5.23 -    CT_DoStep INFO "Installing MPFR"
    5.24 +    CT_DoStep INFO "Installing MPFR for host"
    5.25 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
    5.26 +
    5.27 +    mpfr_opts+=( "host=${CT_HOST}" )
    5.28 +    mpfr_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    5.29 +    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    5.30 +    do_mpfr_backend "${mpfr_opts[@]}"
    5.31 +
    5.32 +    CT_Popd
    5.33 +    CT_EndStep
    5.34 +}
    5.35 +
    5.36 +# Build MPFR
    5.37 +#     Parameter     : description               : type      : default
    5.38 +#     host          : machine to run on         : tuple     : (none)
    5.39 +#     prefix        : prefix to install into    : dir       : (none)
    5.40 +#     cflags        : host cflags to use        : string    : (empty)
    5.41 +do_mpfr_backend() {
    5.42 +    local host
    5.43 +    local prefix
    5.44 +    local cflags
    5.45 +    local arg
    5.46 +
    5.47 +    for arg in "$@"; do
    5.48 +        eval "${arg// /\\ }"
    5.49 +    done
    5.50  
    5.51      # Under Cygwin, we can't build a thread-safe library
    5.52      case "${CT_HOST}" in
    5.53 @@ -77,16 +102,15 @@
    5.54          *)          mpfr_opts+=( --enable-thread-safe  );;
    5.55      esac
    5.56  
    5.57 -
    5.58      CT_DoLog EXTRA "Configuring MPFR"
    5.59      CT_DoExecLog CFG                                    \
    5.60 -    CC="${CT_HOST}-gcc"                                 \
    5.61 +    CC="${host}-gcc"                                    \
    5.62      CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
    5.63      "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
    5.64          --build=${CT_BUILD}                             \
    5.65 -        --host=${CT_HOST}                               \
    5.66 -        --prefix="${CT_COMPLIBS_DIR}"                   \
    5.67 -        --with-gmp="${CT_COMPLIBS_DIR}"                 \
    5.68 +        --host=${host}                                  \
    5.69 +        --prefix="${prefix}"                            \
    5.70 +        --with-gmp="${prefix}"                          \
    5.71          --disable-shared                                \
    5.72          --enable-static
    5.73  
    5.74 @@ -100,8 +124,6 @@
    5.75  
    5.76      CT_DoLog EXTRA "Installing MPFR"
    5.77      CT_DoExecLog ALL make install
    5.78 -
    5.79 -    CT_EndStep
    5.80  }
    5.81  
    5.82  fi # CT_MPFR
     6.1 --- a/scripts/build/companion_libs/ppl.sh	Sun Jul 17 18:29:35 2011 +0200
     6.2 +++ b/scripts/build/companion_libs/ppl.sh	Sun Jul 17 18:56:30 2011 +0200
     6.3 @@ -4,7 +4,7 @@
     6.4  
     6.5  do_ppl_get() { :; }
     6.6  do_ppl_extract() { :; }
     6.7 -do_ppl() { :; }
     6.8 +do_ppl_for_host() { :; }
     6.9  
    6.10  # Overide functions depending on configuration
    6.11  if [ "${CT_PPL}" = "y" ]; then
    6.12 @@ -23,25 +23,49 @@
    6.13      CT_Patch "ppl" "${CT_PPL_VERSION}"
    6.14  }
    6.15  
    6.16 -do_ppl() {
    6.17 -    mkdir -p "${CT_BUILD_DIR}/build-ppl"
    6.18 -    cd "${CT_BUILD_DIR}/build-ppl"
    6.19 +# Build PPL for running on host
    6.20 +do_ppl_for_host() {
    6.21 +    local -a ppl_opts
    6.22  
    6.23 -    CT_DoStep INFO "Installing PPL"
    6.24 +    CT_DoStep INFO "Installing PPL for host"
    6.25 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
    6.26 +
    6.27 +    ppl_opts+=( "host=${CT_HOST}" )
    6.28 +    ppl_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    6.29 +    ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    6.30 +    do_ppl_backend "${ppl_opts[@]}"
    6.31 +
    6.32 +    CT_Popd
    6.33 +    CT_EndStep
    6.34 +}
    6.35 +
    6.36 +# Build PPL
    6.37 +#     Parameter     : description               : type      : default
    6.38 +#     host          : machine to run on         : tuple     : (none)
    6.39 +#     prefix        : prefix to install into    : dir       : (none)
    6.40 +#     cflags        : host cflags to use        : string    : (empty)
    6.41 +do_ppl_backend() {
    6.42 +    local host
    6.43 +    local prefix
    6.44 +    local cflags
    6.45 +    local arg
    6.46 +
    6.47 +    for arg in "$@"; do
    6.48 +        eval "${arg// /\\ }"
    6.49 +    done
    6.50  
    6.51      CT_DoLog EXTRA "Configuring PPL"
    6.52  
    6.53 -
    6.54      CT_DoExecLog CFG                                \
    6.55 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    6.56 -    CXXFLAGS="${CT_CFLAGS_FOR_HOST}"                \
    6.57 +    CFLAGS="${cflags}"                              \
    6.58 +    CXXFLAGS="${cflags}"                            \
    6.59      "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
    6.60          --build=${CT_BUILD}                         \
    6.61 -        --host=${CT_HOST}                           \
    6.62 -        --prefix="${CT_COMPLIBS_DIR}"               \
    6.63 -        --with-libgmp-prefix="${CT_COMPLIBS_DIR}"   \
    6.64 -        --with-libgmpxx-prefix="${CT_COMPLIBS_DIR}" \
    6.65 -        --with-gmp-prefix="${CT_COMPLIBS_DIR}"      \
    6.66 +        --host=${host}                              \
    6.67 +        --prefix="${prefix}"                        \
    6.68 +        --with-libgmp-prefix="${prefix}"            \
    6.69 +        --with-libgmpxx-prefix="${prefix}"          \
    6.70 +        --with-gmp-prefix="${prefix}"               \
    6.71          --enable-watchdog                           \
    6.72          --disable-debugging                         \
    6.73          --disable-assertions                        \
    6.74 @@ -66,9 +90,7 @@
    6.75      CT_DoExecLog ALL make install
    6.76  
    6.77      # Remove spuriously installed file
    6.78 -    CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/bin/ppl-config"
    6.79 -
    6.80 -    CT_EndStep
    6.81 +    CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
    6.82  }
    6.83  
    6.84  fi # CT_PPL
     7.1 --- a/steps.mk	Sun Jul 17 18:29:35 2011 +0200
     7.2 +++ b/steps.mk	Sun Jul 17 18:56:30 2011 +0200
     7.3 @@ -17,12 +17,12 @@
     7.4  # Please keep the last line with a '\' and keep the following empy line:
     7.5  # it helps when diffing and merging.
     7.6  CT_STEPS := libc_check_config   \
     7.7 -            gmp                 \
     7.8 -            mpfr                \
     7.9 -            ppl                 \
    7.10 -            cloog               \
    7.11 -            mpc                 \
    7.12 -            libelf              \
    7.13 +            gmp_for_host        \
    7.14 +            mpfr_for_host       \
    7.15 +            ppl_for_host        \
    7.16 +            cloog_for_host      \
    7.17 +            mpc_for_host        \
    7.18 +            libelf_for_host     \
    7.19              binutils_for_host   \
    7.20              elf2flt_for_host    \
    7.21              sstrip_for_host     \