scripts/build/companion_libs/121-isl.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Sun May 11 23:43:52 2014 +0200 (2014-05-11)
changeset 3320 78af1c99bc6d
parent 3216 bfad02f03c75
permissions -rw-r--r--
scripts/functions: add target_endian_le and target_endian_be

We currently define target_endian_el and target_endian_eb to be the
tuple extension depending on endianness, defined to be respectively
'el' or 'eb' according to the endianness.

Some architecture do not use 'el' or 'eb', but use 'le' or 'be'.

Provide that as well, as two new variables: target_endian_le and
target_endian_be.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Cody P Schafer <dev@codyps.com>
yann@3216
     1
# This file adds the functions to build the ISL library
yann@3216
     2
# Copyright 2009 Yann E. MORIN
yann@3216
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@3216
     4
yann@3216
     5
do_isl_get() { :; }
yann@3216
     6
do_isl_extract() { :; }
yann@3216
     7
do_isl_for_build() { :; }
yann@3216
     8
do_isl_for_host() { :; }
yann@3216
     9
yann@3216
    10
# Overide functions depending on configuration
yann@3216
    11
if [ "${CT_ISL}" = "y" ]; then
yann@3216
    12
yann@3216
    13
# Download ISL
yann@3216
    14
do_isl_get() {
yann@3216
    15
    CT_GetFile "isl-${CT_ISL_VERSION}"  \
michaelh@3230
    16
        ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/ \
michaelh@3230
    17
        http://mirrors.kernel.org/sources.redhat.com/gcc/infrastructure
yann@3216
    18
}
yann@3216
    19
yann@3216
    20
# Extract ISL
yann@3216
    21
do_isl_extract() {
yann@3216
    22
    CT_Extract "isl-${CT_ISL_VERSION}"
yann@3216
    23
    CT_Patch "isl" "${CT_ISL_VERSION}"
yann@3216
    24
}
yann@3216
    25
yann@3216
    26
# Build ISL for running on build
yann@3216
    27
# - always build statically
yann@3216
    28
# - we do not have build-specific CFLAGS
yann@3216
    29
# - install in build-tools prefix
yann@3216
    30
do_isl_for_build() {
yann@3216
    31
    local -a isl_opts
yann@3216
    32
    local isl_cflags
yann@3216
    33
    local isl_cxxflags
yann@3216
    34
yann@3216
    35
    case "${CT_TOOLCHAIN_TYPE}" in
yann@3216
    36
        native|cross)   return 0;;
yann@3216
    37
    esac
yann@3216
    38
yann@3216
    39
    CT_DoStep INFO "Installing ISL for build"
yann@3216
    40
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}"
yann@3216
    41
yann@3216
    42
    isl_cflags="${CT_CFLAGS_FOR_BUILD}"
yann@3216
    43
    isl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
yann@3216
    44
yann@3216
    45
    isl_opts+=( "host=${CT_BUILD}" )
yann@3216
    46
    isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
yann@3216
    47
    isl_opts+=( "cflags=${isl_cflags}" )
yann@3216
    48
    isl_opts+=( "cxxflags=${isl_cxxflags}" )
yann@3216
    49
    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
yann@3216
    50
    do_isl_backend "${isl_opts[@]}"
yann@3216
    51
yann@3216
    52
    CT_Popd
yann@3216
    53
    CT_EndStep
yann@3216
    54
}
yann@3216
    55
yann@3216
    56
# Build ISL for running on host
yann@3216
    57
do_isl_for_host() {
yann@3216
    58
    local -a isl_opts
yann@3216
    59
    local isl_cflags
yann@3216
    60
    local isl_cxxflags
yann@3216
    61
yann@3216
    62
    CT_DoStep INFO "Installing ISL for host"
yann@3216
    63
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}"
yann@3216
    64
yann@3216
    65
    isl_cflags="${CT_CFLAGS_FOR_HOST}"
yann@3216
    66
    isl_cxxflags="${CT_CFLAGS_FOR_HOST}"
yann@3216
    67
yann@3216
    68
    isl_opts+=( "host=${CT_HOST}" )
yann@3216
    69
    isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
yann@3216
    70
    isl_opts+=( "cflags=${isl_cflags}" )
yann@3216
    71
    isl_opts+=( "cxxflags=${isl_cxxflags}" )
yann@3216
    72
    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
yann@3216
    73
    do_isl_backend "${isl_opts[@]}"
yann@3216
    74
yann@3216
    75
    CT_Popd
yann@3216
    76
    CT_EndStep
yann@3216
    77
}
yann@3216
    78
yann@3216
    79
# Build ISL
yann@3216
    80
#     Parameter     : description               : type      : default
yann@3216
    81
#     host          : machine to run on         : tuple     : (none)
yann@3216
    82
#     prefix        : prefix to install into    : dir       : (none)
yann@3216
    83
#     cflags        : cflags to use             : string    : (empty)
yann@3216
    84
#     ldflags       : ldflags to use            : string    : (empty)
yann@3216
    85
do_isl_backend() {
yann@3216
    86
    local host
yann@3216
    87
    local prefix
yann@3216
    88
    local cflags
yann@3216
    89
    local cxxflags
yann@3216
    90
    local ldflags
yann@3216
    91
    local arg
yann@3216
    92
yann@3216
    93
    for arg in "$@"; do
yann@3216
    94
        eval "${arg// /\\ }"
yann@3216
    95
    done
yann@3216
    96
yann@3216
    97
    CT_DoLog EXTRA "Configuring ISL"
yann@3216
    98
yann@3216
    99
    CT_DoExecLog CFG                                \
yann@3216
   100
    CFLAGS="${cflags}"                              \
yann@3216
   101
    CXXFLAGS="${cxxflags}"                          \
yann@3216
   102
    LDFLAGS="${ldflags}"                            \
yann@3216
   103
    "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \
yann@3216
   104
        --build=${CT_BUILD}                         \
yann@3216
   105
        --host=${host}                              \
yann@3216
   106
        --prefix="${prefix}"                        \
yann@3216
   107
        --with-libgmp-prefix="${prefix}"            \
yann@3216
   108
        --with-libgmpxx-prefix="${prefix}"          \
yann@3216
   109
        --with-gmp-prefix="${prefix}"               \
yann@3216
   110
        --disable-shared                            \
yann@3216
   111
        --enable-static                             \
yann@3216
   112
        --with-gmp=system                           \
yann@3216
   113
        --with-gmp-prefix="${prefix}"               \
yann@3216
   114
        --with-piplib=no                            \
yann@3216
   115
        --with-clang=no
yann@3216
   116
yann@3216
   117
    CT_DoLog EXTRA "Building ISL"
yann@3216
   118
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@3216
   119
yann@3216
   120
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@3216
   121
        CT_DoLog EXTRA "Checking ISL"
yann@3216
   122
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@3216
   123
    fi
yann@3216
   124
yann@3216
   125
    CT_DoLog EXTRA "Installing ISL"
yann@3216
   126
    CT_DoExecLog ALL make install
yann@3216
   127
}
yann@3216
   128
yann@3216
   129
fi # CT_ISL