scripts/build/companion_libs/ppl.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 2461 ec30b191f0e3
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@1324
     1
# This file adds the functions to build the PPL library
yann@1324
     2
# Copyright 2009 Yann E. MORIN
yann@1324
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@1324
     4
yann@1324
     5
do_ppl_get() { :; }
yann@1324
     6
do_ppl_extract() { :; }
yann@2927
     7
do_ppl_for_host() { :; }
yann@1324
     8
yann@1324
     9
# Overide functions depending on configuration
yann@1808
    10
if [ "${CT_PPL}" = "y" ]; then
yann@1324
    11
yann@1324
    12
# Download PPL
yann@1324
    13
do_ppl_get() {
yann@1324
    14
    CT_GetFile "ppl-${CT_PPL_VERSION}"                                      \
yann@1324
    15
        http://www.cs.unipr.it/ppl/Download/ftp/releases/${CT_PPL_VERSION}  \
yann@1369
    16
        ftp://ftp.cs.unipr.it/pub/ppl/releases/${CT_PPL_VERSION}            \
yann@1369
    17
        ftp://gcc.gnu.org/pub/gcc/infrastructure
yann@1324
    18
}
yann@1324
    19
yann@1324
    20
# Extract PPL
yann@1324
    21
do_ppl_extract() {
yann@1324
    22
    CT_Extract "ppl-${CT_PPL_VERSION}"
yann@1901
    23
    CT_Patch "ppl" "${CT_PPL_VERSION}"
yann@1324
    24
}
yann@1324
    25
yann@2927
    26
# Build PPL for running on host
yann@2927
    27
do_ppl_for_host() {
yann@2927
    28
    local -a ppl_opts
yann@1324
    29
yann@2927
    30
    CT_DoStep INFO "Installing PPL for host"
yann@2927
    31
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
yann@2927
    32
yann@2927
    33
    ppl_opts+=( "host=${CT_HOST}" )
yann@2927
    34
    ppl_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
yann@2927
    35
    ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
yann@2927
    36
    do_ppl_backend "${ppl_opts[@]}"
yann@2927
    37
yann@2927
    38
    CT_Popd
yann@2927
    39
    CT_EndStep
yann@2927
    40
}
yann@2927
    41
yann@2927
    42
# Build PPL
yann@2927
    43
#     Parameter     : description               : type      : default
yann@2927
    44
#     host          : machine to run on         : tuple     : (none)
yann@2927
    45
#     prefix        : prefix to install into    : dir       : (none)
yann@2927
    46
#     cflags        : host cflags to use        : string    : (empty)
yann@2927
    47
do_ppl_backend() {
yann@2927
    48
    local host
yann@2927
    49
    local prefix
yann@2927
    50
    local cflags
yann@2927
    51
    local arg
yann@2927
    52
yann@2927
    53
    for arg in "$@"; do
yann@2927
    54
        eval "${arg// /\\ }"
yann@2927
    55
    done
yann@1324
    56
yann@1324
    57
    CT_DoLog EXTRA "Configuring PPL"
yann@1892
    58
yann@2348
    59
    CT_DoExecLog CFG                                \
yann@2927
    60
    CFLAGS="${cflags}"                              \
yann@2927
    61
    CXXFLAGS="${cflags}"                            \
yann@1324
    62
    "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
yann@1324
    63
        --build=${CT_BUILD}                         \
yann@2927
    64
        --host=${host}                              \
yann@2927
    65
        --prefix="${prefix}"                        \
yann@2927
    66
        --with-libgmp-prefix="${prefix}"            \
yann@2927
    67
        --with-libgmpxx-prefix="${prefix}"          \
yann@2927
    68
        --with-gmp-prefix="${prefix}"               \
yann@2364
    69
        --enable-watchdog                           \
yann@1324
    70
        --disable-debugging                         \
yann@1324
    71
        --disable-assertions                        \
yann@1324
    72
        --disable-ppl_lcdd                          \
yann@1892
    73
        --disable-ppl_lpsol                         \
yann@2381
    74
        --disable-shared                            \
anthony@2461
    75
        --enable-interfaces='c c++'                 \
yann@2381
    76
        --enable-static
yann@1324
    77
yann@1324
    78
    # Maybe-options:
yann@1324
    79
    # --enable-optimization=speed  or sspeed (yes, with 2 's')
yann@1324
    80
yann@1324
    81
    CT_DoLog EXTRA "Building PPL"
yann@2275
    82
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@1324
    83
yann@1890
    84
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@1324
    85
        CT_DoLog EXTRA "Checking PPL"
yann@2275
    86
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@1324
    87
    fi
yann@1324
    88
yann@1324
    89
    CT_DoLog EXTRA "Installing PPL"
yann@1324
    90
    CT_DoExecLog ALL make install
yann@1324
    91
yann@1397
    92
    # Remove spuriously installed file
yann@2927
    93
    CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
yann@1324
    94
}
yann@1324
    95
yann@1808
    96
fi # CT_PPL