scripts/build/companion_libs/mpfr.sh
changeset 2927 ddaae597fd7c
parent 2381 0ca0f85a4b2a
child 2929 22e495b7bee8
     1.1 --- a/scripts/build/companion_libs/mpfr.sh	Wed Apr 06 22:30:57 2011 +0200
     1.2 +++ b/scripts/build/companion_libs/mpfr.sh	Sun Jul 17 18:56:30 2011 +0200
     1.3 @@ -4,7 +4,7 @@
     1.4  
     1.5  do_mpfr_get() { :; }
     1.6  do_mpfr_extract() { :; }
     1.7 -do_mpfr() { :; }
     1.8 +do_mpfr_for_host() { :; }
     1.9  
    1.10  # Overide function depending on configuration
    1.11  if [ "${CT_MPFR}" = "y" ]; then
    1.12 @@ -63,11 +63,36 @@
    1.13      esac
    1.14  }
    1.15  
    1.16 -do_mpfr() {
    1.17 -    mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    1.18 -    cd "${CT_BUILD_DIR}/build-mpfr"
    1.19 +# Build MPFR for running on host
    1.20 +do_mpfr_for_host() {
    1.21 +    local -a mpfr_opts
    1.22  
    1.23 -    CT_DoStep INFO "Installing MPFR"
    1.24 +    CT_DoStep INFO "Installing MPFR for host"
    1.25 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
    1.26 +
    1.27 +    mpfr_opts+=( "host=${CT_HOST}" )
    1.28 +    mpfr_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    1.29 +    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.30 +    do_mpfr_backend "${mpfr_opts[@]}"
    1.31 +
    1.32 +    CT_Popd
    1.33 +    CT_EndStep
    1.34 +}
    1.35 +
    1.36 +# Build MPFR
    1.37 +#     Parameter     : description               : type      : default
    1.38 +#     host          : machine to run on         : tuple     : (none)
    1.39 +#     prefix        : prefix to install into    : dir       : (none)
    1.40 +#     cflags        : host cflags to use        : string    : (empty)
    1.41 +do_mpfr_backend() {
    1.42 +    local host
    1.43 +    local prefix
    1.44 +    local cflags
    1.45 +    local arg
    1.46 +
    1.47 +    for arg in "$@"; do
    1.48 +        eval "${arg// /\\ }"
    1.49 +    done
    1.50  
    1.51      # Under Cygwin, we can't build a thread-safe library
    1.52      case "${CT_HOST}" in
    1.53 @@ -77,16 +102,15 @@
    1.54          *)          mpfr_opts+=( --enable-thread-safe  );;
    1.55      esac
    1.56  
    1.57 -
    1.58      CT_DoLog EXTRA "Configuring MPFR"
    1.59      CT_DoExecLog CFG                                    \
    1.60 -    CC="${CT_HOST}-gcc"                                 \
    1.61 +    CC="${host}-gcc"                                    \
    1.62      CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
    1.63      "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
    1.64          --build=${CT_BUILD}                             \
    1.65 -        --host=${CT_HOST}                               \
    1.66 -        --prefix="${CT_COMPLIBS_DIR}"                   \
    1.67 -        --with-gmp="${CT_COMPLIBS_DIR}"                 \
    1.68 +        --host=${host}                                  \
    1.69 +        --prefix="${prefix}"                            \
    1.70 +        --with-gmp="${prefix}"                          \
    1.71          --disable-shared                                \
    1.72          --enable-static
    1.73  
    1.74 @@ -100,8 +124,6 @@
    1.75  
    1.76      CT_DoLog EXTRA "Installing MPFR"
    1.77      CT_DoExecLog ALL make install
    1.78 -
    1.79 -    CT_EndStep
    1.80  }
    1.81  
    1.82  fi # CT_MPFR