scripts/build/companion_libs/140-mpc.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Thu Dec 27 12:53:32 2012 +0100 (2012-12-27)
changeset 3153 f6740f9e42de
parent 3115 1c68438f44f7
permissions -rw-r--r--
scripts/addToolsVersion: handle elf2flt

The one was missing from the list.

It is very improbable that we ever need it, as elf2flt does no release,
and we always get it from CVS head. But for the sake of consistency, we
just add it.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     1 # This file adds the functions to build the MPC library
     2 # Copyright 2009 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_mpc_get() { :; }
     6 do_mpc_extract() { :; }
     7 do_mpc_for_build() { :; }
     8 do_mpc_for_host() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_MPC}" = "y" ]; then
    12 
    13 # Download MPC
    14 do_mpc_get() {
    15     CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
    16         http://www.multiprecision.org/mpc/download
    17 }
    18 
    19 # Extract MPC
    20 do_mpc_extract() {
    21     CT_Extract "mpc-${CT_MPC_VERSION}"
    22     CT_Patch "mpc" "${CT_MPC_VERSION}"
    23 }
    24 
    25 # Build MPC for running on build
    26 # - always build statically
    27 # - we do not have build-specific CFLAGS
    28 # - install in build-tools prefix
    29 do_mpc_for_build() {
    30     local -a mpc_opts
    31 
    32     case "${CT_TOOLCHAIN_TYPE}" in
    33         native|cross)   return 0;;
    34     esac
    35 
    36     CT_DoStep INFO "Installing MPC for build"
    37     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-build-${CT_BUILD}"
    38 
    39     mpc_opts+=( "host=${CT_BUILD}" )
    40     mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    41     mpc_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
    42     mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    43     do_mpc_backend "${mpc_opts[@]}"
    44 
    45     CT_Popd
    46     CT_EndStep
    47 }
    48 
    49 # Build MPC for running on host
    50 do_mpc_for_host() {
    51     local -a mpc_opts
    52 
    53     CT_DoStep INFO "Installing MPC for host"
    54     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
    55 
    56     mpc_opts+=( "host=${CT_HOST}" )
    57     mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    58     mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    59     mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    60     do_mpc_backend "${mpc_opts[@]}"
    61 
    62     CT_Popd
    63     CT_EndStep
    64 }
    65 
    66 # Build MPC
    67 #     Parameter     : description               : type      : default
    68 #     host          : machine to run on         : tuple     : (none)
    69 #     prefix        : prefix to install into    : dir       : (none)
    70 #     cflags        : cflags to use             : string    : (empty)
    71 #     ldflags       : ldflags to use            : string    : (empty)
    72 do_mpc_backend() {
    73     local host
    74     local prefix
    75     local cflags
    76     local ldflags
    77     local arg
    78 
    79     for arg in "$@"; do
    80         eval "${arg// /\\ }"
    81     done
    82 
    83     CT_DoLog EXTRA "Configuring MPC"
    84 
    85     CT_DoExecLog CFG                                \
    86     CFLAGS="${cflags}"                              \
    87     LDFLAGS="${ldflags}"                            \
    88     "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
    89         --build=${CT_BUILD}                         \
    90         --host=${host}                              \
    91         --prefix="${prefix}"                        \
    92         --with-gmp="${prefix}"                      \
    93         --with-mpfr="${prefix}"                     \
    94         --disable-shared                            \
    95         --enable-static
    96 
    97     CT_DoLog EXTRA "Building MPC"
    98     CT_DoExecLog ALL make ${JOBSFLAGS}
    99 
   100     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   101         CT_DoLog EXTRA "Checking MPC"
   102         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   103     fi
   104 
   105     CT_DoLog EXTRA "Installing MPC"
   106     CT_DoExecLog ALL make install
   107 }
   108 
   109 fi # CT_MPC