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