scripts/build/companion_libs/mpc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 18:56:30 2011 +0200 (2011-07-17)
changeset 2927 ddaae597fd7c
parent 2381 0ca0f85a4b2a
child 2929 22e495b7bee8
permissions -rw-r--r--
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>
yann@1384
     1
# This file adds the functions to build the MPC library
yann@1384
     2
# Copyright 2009 Yann E. MORIN
yann@1384
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@1384
     4
yann@1384
     5
do_mpc_get() { :; }
yann@1384
     6
do_mpc_extract() { :; }
yann@2927
     7
do_mpc_for_host() { :; }
yann@1384
     8
yann@1384
     9
# Overide functions depending on configuration
yann@1808
    10
if [ "${CT_MPC}" = "y" ]; then
yann@1384
    11
yann@1384
    12
# Download MPC
yann@1384
    13
do_mpc_get() {
yann@1384
    14
    CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
yann@1384
    15
        http://www.multiprecision.org/mpc/download
yann@1384
    16
}
yann@1384
    17
yann@1384
    18
# Extract MPC
yann@1384
    19
do_mpc_extract() {
yann@1384
    20
    CT_Extract "mpc-${CT_MPC_VERSION}"
yann@1901
    21
    CT_Patch "mpc" "${CT_MPC_VERSION}"
yann@1384
    22
}
yann@1384
    23
yann@2927
    24
# Build MPC for running on host
yann@2927
    25
do_mpc_for_host() {
yann@2927
    26
    local -a mpc_opts
yann@1384
    27
yann@2927
    28
    CT_DoStep INFO "Installing MPC for host"
yann@2927
    29
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
yann@2927
    30
yann@2927
    31
    mpc_opts+=( "host=${CT_HOST}" )
yann@2927
    32
    mpc_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
yann@2927
    33
    mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
yann@2927
    34
    do_mpc_backend "${mpc_opts[@]}"
yann@2927
    35
yann@2927
    36
    CT_Popd
yann@2927
    37
    CT_EndStep
yann@2927
    38
}
yann@2927
    39
yann@2927
    40
# Build MPC
yann@2927
    41
#     Parameter     : description               : type      : default
yann@2927
    42
#     host          : machine to run on         : tuple     : (none)
yann@2927
    43
#     prefix        : prefix to install into    : dir       : (none)
yann@2927
    44
#     cflags        : host cflags to use        : string    : (empty)
yann@2927
    45
do_mpc_backend() {
yann@2927
    46
    local host
yann@2927
    47
    local prefix
yann@2927
    48
    local cflags
yann@2927
    49
    local arg
yann@2927
    50
yann@2927
    51
    for arg in "$@"; do
yann@2927
    52
        eval "${arg// /\\ }"
yann@2927
    53
    done
yann@1384
    54
yann@1384
    55
    CT_DoLog EXTRA "Configuring MPC"
yann@1892
    56
yann@2350
    57
    CT_DoExecLog CFG                                \
yann@2927
    58
    CFLAGS="${cflags}"                              \
yann@1384
    59
    "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
yann@1384
    60
        --build=${CT_BUILD}                         \
yann@2927
    61
        --host=${host}                              \
yann@2927
    62
        --prefix="${prefix}"                        \
yann@2927
    63
        --with-gmp="${prefix}"                      \
yann@2927
    64
        --with-mpfr="${prefix}"                     \
yann@2381
    65
        --disable-shared                            \
yann@2381
    66
        --enable-static
yann@1384
    67
yann@1384
    68
    CT_DoLog EXTRA "Building MPC"
yann@2275
    69
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@1384
    70
yann@1890
    71
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@1384
    72
        CT_DoLog EXTRA "Checking MPC"
yann@2275
    73
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@1384
    74
    fi
yann@1384
    75
yann@1384
    76
    CT_DoLog EXTRA "Installing MPC"
yann@1384
    77
    CT_DoExecLog ALL make install
yann@1384
    78
}
yann@1384
    79
yann@1808
    80
fi # CT_MPC