scripts/build/companion_libs/cloog.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 24 23:52:28 2011 +0200 (2011-07-24)
changeset 2928 3f70dd642d34
parent 2854 a70abdbfa342
child 2929 22e495b7bee8
permissions -rw-r--r--
binutils: add frontends for building to run on the build machine

In canadian-cross, we need binutils running on the build machine to be
able to build the target C library.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@1380
     1
# This file adds the functions to build the CLooG library
yann@1380
     2
# Copyright 2009 Yann E. MORIN
yann@1380
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@1380
     4
yann@1380
     5
do_cloog_get() { :; }
yann@1380
     6
do_cloog_extract() { :; }
yann@2927
     7
do_cloog_for_host() { :; }
yann@1380
     8
yann@1380
     9
# Overide functions depending on configuration
yann@1808
    10
if [ "${CT_CLOOG}" = "y" ]; then
yann@1380
    11
yann@1380
    12
# Download CLooG
yann@1380
    13
do_cloog_get() {
yann@1380
    14
    CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
yann@1380
    15
        ftp://gcc.gnu.org/pub/gcc/infrastructure
yann@1380
    16
}
yann@1380
    17
yann@1380
    18
# Extract CLooG
yann@1380
    19
do_cloog_extract() {
yann@1530
    20
    local _t
yann@1530
    21
yann@1530
    22
    # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
yann@1530
    23
    # while versions 0.15.4 onward do have the version in the dirname.
yann@2757
    24
    # But, because the infrastructure properly creates the extracted
yann@2757
    25
    # directories (with tar's --strip-components), we can live safely...
yann@2757
    26
    CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
yann@2757
    27
    CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
yann@2757
    28
yann@2758
    29
    if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
yann@2757
    30
        CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
yann@2704
    31
        CT_DoExecLog CFG ./autogen.sh
yann@2757
    32
        CT_Popd
yann@2262
    33
    fi
yann@1380
    34
}
yann@1380
    35
yann@2927
    36
# Build CLooG/PPL for running on host
yann@2927
    37
do_cloog_for_host() {
yann@2927
    38
    local -a cloog_opts
yann@2927
    39
yann@2927
    40
    CT_DoStep INFO "Installing CLooG/PPL for host"
yann@2927
    41
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
yann@2927
    42
yann@2927
    43
    cloog_opts+=( "host=${CT_HOST}" )
yann@2927
    44
    cloog_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
yann@2927
    45
    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
yann@2927
    46
    do_cloog_backend "${cloog_opts[@]}"
yann@2927
    47
yann@2927
    48
    CT_Popd
yann@2927
    49
    CT_EndStep
yann@2927
    50
}
yann@2927
    51
yann@2927
    52
# Build ClooG/PPL
yann@2927
    53
#     Parameter     : description               : type      : default
yann@2927
    54
#     host          : machine to run on         : tuple     : (none)
yann@2927
    55
#     prefix        : prefix to install into    : dir       : (none)
yann@2927
    56
#     cflags        : host cflags to use        : string    : (empty)
yann@2927
    57
do_cloog_backend() {
yann@2927
    58
    local host
yann@2927
    59
    local prefix
yann@2927
    60
    local cflags
yann@2757
    61
    local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
yann@2927
    62
    local arg
yann@1537
    63
yann@2927
    64
    for arg in "$@"; do
yann@2927
    65
        eval "${arg// /\\ }"
yann@2927
    66
    done
yann@1380
    67
yann@1380
    68
    CT_DoLog EXTRA "Configuring CLooG/ppl"
yann@1892
    69
yann@2349
    70
    CT_DoExecLog CFG                            \
yann@2927
    71
    CFLAGS="${cflags}"                          \
benoit@2854
    72
    LIBS="-lm"                                  \
yann@2757
    73
    "${cloog_src_dir}/configure"                \
yann@1537
    74
        --build=${CT_BUILD}                     \
yann@2927
    75
        --host=${host}                          \
yann@2927
    76
        --prefix="${prefix}"                    \
yann@2927
    77
        --with-gmp="${prefix}"                  \
yann@2927
    78
        --with-ppl="${prefix}"                  \
yann@1892
    79
        --with-bits=gmp                         \
yann@2381
    80
        --with-host-libstdcxx='-lstdc++'        \
yann@2381
    81
        --disable-shared                        \
yann@2381
    82
        --enable-static
yann@1380
    83
yann@1380
    84
    CT_DoLog EXTRA "Building CLooG/ppl"
yann@2275
    85
    CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
yann@1380
    86
yann@1890
    87
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@1380
    88
        CT_DoLog EXTRA "Checking CLooG/ppl"
yann@2275
    89
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@1380
    90
    fi
yann@1380
    91
yann@1380
    92
    CT_DoLog EXTRA "Installing CLooG/ppl"
yann@2199
    93
    CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
yann@1380
    94
}
yann@1380
    95
yann@1808
    96
fi # CT_CLOOG