scripts/build/companion_libs/cloog.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 24 23:53:14 2011 +0200 (2011-07-24)
changeset 2929 22e495b7bee8
parent 2927 ddaae597fd7c
child 2931 8a72662f0815
permissions -rw-r--r--
complibs: add frontends for building to run on the build machine

In canadian-cross, we need the companion libraries running on the
build machine, to be able to build the two core gcc.

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_build() { :; }
     8 do_cloog_for_host() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_CLOOG}" = "y" ]; then
    12 
    13 # Download CLooG
    14 do_cloog_get() {
    15     CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
    16         ftp://gcc.gnu.org/pub/gcc/infrastructure
    17 }
    18 
    19 # Extract CLooG
    20 do_cloog_extract() {
    21     local _t
    22 
    23     # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
    24     # while versions 0.15.4 onward do have the version in the dirname.
    25     # But, because the infrastructure properly creates the extracted
    26     # directories (with tar's --strip-components), we can live safely...
    27     CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
    28     CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
    29 
    30     if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
    31         CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    32         CT_DoExecLog CFG ./autogen.sh
    33         CT_Popd
    34     fi
    35 }
    36 
    37 # Build CLooG/PPL for running on build
    38 # - always build statically
    39 # - we do not have build-specific CFLAGS
    40 # - install in build-tools prefix
    41 do_cloog_for_build() {
    42     local -a cloog_opts
    43 
    44     case "${CT_TOOLCHAIN_TYPE}" in
    45         native|cross)   return 0;;
    46     esac
    47 
    48     CT_DoStep INFO "Installing CLooG/PPL for build"
    49     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-build-${CT_BUILD}"
    50 
    51     cloog_opts+=( "host=${CT_BUILD}" )
    52     cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    53     do_cloog_backend "${cloog_opts[@]}"
    54 
    55     CT_Popd
    56     CT_EndStep
    57 }
    58 
    59 # Build CLooG/PPL for running on host
    60 do_cloog_for_host() {
    61     local -a cloog_opts
    62 
    63     CT_DoStep INFO "Installing CLooG/PPL for host"
    64     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
    65 
    66     cloog_opts+=( "host=${CT_HOST}" )
    67     cloog_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    68     cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    69     do_cloog_backend "${cloog_opts[@]}"
    70 
    71     CT_Popd
    72     CT_EndStep
    73 }
    74 
    75 # Build ClooG/PPL
    76 #     Parameter     : description               : type      : default
    77 #     host          : machine to run on         : tuple     : (none)
    78 #     prefix        : prefix to install into    : dir       : (none)
    79 #     cflags        : host cflags to use        : string    : (empty)
    80 do_cloog_backend() {
    81     local host
    82     local prefix
    83     local cflags
    84     local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    85     local arg
    86 
    87     for arg in "$@"; do
    88         eval "${arg// /\\ }"
    89     done
    90 
    91     CT_DoLog EXTRA "Configuring CLooG/ppl"
    92 
    93     CT_DoExecLog CFG                            \
    94     CFLAGS="${cflags}"                          \
    95     LIBS="-lm"                                  \
    96     "${cloog_src_dir}/configure"                \
    97         --build=${CT_BUILD}                     \
    98         --host=${host}                          \
    99         --prefix="${prefix}"                    \
   100         --with-gmp="${prefix}"                  \
   101         --with-ppl="${prefix}"                  \
   102         --with-bits=gmp                         \
   103         --with-host-libstdcxx='-lstdc++'        \
   104         --disable-shared                        \
   105         --enable-static
   106 
   107     CT_DoLog EXTRA "Building CLooG/ppl"
   108     CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
   109 
   110     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   111         CT_DoLog EXTRA "Checking CLooG/ppl"
   112         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   113     fi
   114 
   115     CT_DoLog EXTRA "Installing CLooG/ppl"
   116     CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
   117 }
   118 
   119 fi # CT_CLOOG