scripts/build/companion_libs/130-cloog.sh
changeset 3115 1c68438f44f7
parent 3018 7776e8369284
child 3119 1c56c03b7ed5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/build/companion_libs/130-cloog.sh	Fri Nov 16 14:59:27 2012 +0100
     1.3 @@ -0,0 +1,122 @@
     1.4 +# This file adds the functions to build the CLooG library
     1.5 +# Copyright 2009 Yann E. MORIN
     1.6 +# Licensed under the GPL v2. See COPYING in the root of this package
     1.7 +
     1.8 +do_cloog_get() { :; }
     1.9 +do_cloog_extract() { :; }
    1.10 +do_cloog_for_build() { :; }
    1.11 +do_cloog_for_host() { :; }
    1.12 +
    1.13 +# Overide functions depending on configuration
    1.14 +if [ "${CT_CLOOG}" = "y" ]; then
    1.15 +
    1.16 +# Download CLooG
    1.17 +do_cloog_get() {
    1.18 +    CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
    1.19 +        ftp://gcc.gnu.org/pub/gcc/infrastructure
    1.20 +}
    1.21 +
    1.22 +# Extract CLooG
    1.23 +do_cloog_extract() {
    1.24 +    local _t
    1.25 +
    1.26 +    # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
    1.27 +    # while versions 0.15.4 onward do have the version in the dirname.
    1.28 +    # But, because the infrastructure properly creates the extracted
    1.29 +    # directories (with tar's --strip-components), we can live safely...
    1.30 +    CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
    1.31 +    CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
    1.32 +
    1.33 +    # Help the autostuff in case it thinks there are things to regenerate...
    1.34 +    CT_DoExecLog DEBUG mkdir -p "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}/m4"
    1.35 +
    1.36 +    if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
    1.37 +        CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    1.38 +        CT_DoExecLog CFG ./autogen.sh
    1.39 +        CT_Popd
    1.40 +    fi
    1.41 +}
    1.42 +
    1.43 +# Build CLooG/PPL for running on build
    1.44 +# - always build statically
    1.45 +# - we do not have build-specific CFLAGS
    1.46 +# - install in build-tools prefix
    1.47 +do_cloog_for_build() {
    1.48 +    local -a cloog_opts
    1.49 +
    1.50 +    case "${CT_TOOLCHAIN_TYPE}" in
    1.51 +        native|cross)   return 0;;
    1.52 +    esac
    1.53 +
    1.54 +    CT_DoStep INFO "Installing CLooG/PPL for build"
    1.55 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-build-${CT_BUILD}"
    1.56 +
    1.57 +    cloog_opts+=( "host=${CT_BUILD}" )
    1.58 +    cloog_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.59 +    do_cloog_backend "${cloog_opts[@]}"
    1.60 +
    1.61 +    CT_Popd
    1.62 +    CT_EndStep
    1.63 +}
    1.64 +
    1.65 +# Build CLooG/PPL for running on host
    1.66 +do_cloog_for_host() {
    1.67 +    local -a cloog_opts
    1.68 +
    1.69 +    CT_DoStep INFO "Installing CLooG/PPL for host"
    1.70 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
    1.71 +
    1.72 +    cloog_opts+=( "host=${CT_HOST}" )
    1.73 +    cloog_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    1.74 +    cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.75 +    do_cloog_backend "${cloog_opts[@]}"
    1.76 +
    1.77 +    CT_Popd
    1.78 +    CT_EndStep
    1.79 +}
    1.80 +
    1.81 +# Build ClooG/PPL
    1.82 +#     Parameter     : description               : type      : default
    1.83 +#     host          : machine to run on         : tuple     : (none)
    1.84 +#     prefix        : prefix to install into    : dir       : (none)
    1.85 +#     cflags        : host cflags to use        : string    : (empty)
    1.86 +do_cloog_backend() {
    1.87 +    local host
    1.88 +    local prefix
    1.89 +    local cflags
    1.90 +    local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
    1.91 +    local arg
    1.92 +
    1.93 +    for arg in "$@"; do
    1.94 +        eval "${arg// /\\ }"
    1.95 +    done
    1.96 +
    1.97 +    CT_DoLog EXTRA "Configuring CLooG/ppl"
    1.98 +
    1.99 +    CT_DoExecLog CFG                            \
   1.100 +    CFLAGS="${cflags}"                          \
   1.101 +    LIBS="-lm"                                  \
   1.102 +    "${cloog_src_dir}/configure"                \
   1.103 +        --build=${CT_BUILD}                     \
   1.104 +        --host=${host}                          \
   1.105 +        --prefix="${prefix}"                    \
   1.106 +        --with-gmp="${prefix}"                  \
   1.107 +        --with-ppl="${prefix}"                  \
   1.108 +        --with-bits=gmp                         \
   1.109 +        --with-host-libstdcxx='-lstdc++'        \
   1.110 +        --disable-shared                        \
   1.111 +        --enable-static
   1.112 +
   1.113 +    CT_DoLog EXTRA "Building CLooG/ppl"
   1.114 +    CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
   1.115 +
   1.116 +    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   1.117 +        CT_DoLog EXTRA "Checking CLooG/ppl"
   1.118 +        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   1.119 +    fi
   1.120 +
   1.121 +    CT_DoLog EXTRA "Installing CLooG/ppl"
   1.122 +    CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
   1.123 +}
   1.124 +
   1.125 +fi # CT_CLOOG