scripts/build/companion_libs/121-isl.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Wed Jul 24 19:11:18 2013 +0200 (2013-07-24)
changeset 3226 20b02b5019cd
child 3230 86a8d1d467c8
permissions -rw-r--r--
complibs/ppl: fix build when local system has libgmp already installed

Basically, the ppl configure script wasn't properly setting
CFLAGS/CXXFLAGS/LDFLAGS to point at the ctng-built gmp, so ppl tried to
use the system gmp headers instead.

This patch fixes that for all PPL versions supported by crosstools-ng.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
[yann.morin.1998@free.fr: slightly touch the commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <20130715230656.GB23382@shaftnet.org>
Patchwork-Id: 259300
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}"  \
yann@3216
    16
        ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/
yann@3216
    17
}
yann@3216
    18
yann@3216
    19
# Extract ISL
yann@3216
    20
do_isl_extract() {
yann@3216
    21
    CT_Extract "isl-${CT_ISL_VERSION}"
yann@3216
    22
    CT_Patch "isl" "${CT_ISL_VERSION}"
yann@3216
    23
}
yann@3216
    24
yann@3216
    25
# Build ISL for running on build
yann@3216
    26
# - always build statically
yann@3216
    27
# - we do not have build-specific CFLAGS
yann@3216
    28
# - install in build-tools prefix
yann@3216
    29
do_isl_for_build() {
yann@3216
    30
    local -a isl_opts
yann@3216
    31
    local isl_cflags
yann@3216
    32
    local isl_cxxflags
yann@3216
    33
yann@3216
    34
    case "${CT_TOOLCHAIN_TYPE}" in
yann@3216
    35
        native|cross)   return 0;;
yann@3216
    36
    esac
yann@3216
    37
yann@3216
    38
    CT_DoStep INFO "Installing ISL for build"
yann@3216
    39
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}"
yann@3216
    40
yann@3216
    41
    isl_cflags="${CT_CFLAGS_FOR_BUILD}"
yann@3216
    42
    isl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
yann@3216
    43
yann@3216
    44
    isl_opts+=( "host=${CT_BUILD}" )
yann@3216
    45
    isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
yann@3216
    46
    isl_opts+=( "cflags=${isl_cflags}" )
yann@3216
    47
    isl_opts+=( "cxxflags=${isl_cxxflags}" )
yann@3216
    48
    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
yann@3216
    49
    do_isl_backend "${isl_opts[@]}"
yann@3216
    50
yann@3216
    51
    CT_Popd
yann@3216
    52
    CT_EndStep
yann@3216
    53
}
yann@3216
    54
yann@3216
    55
# Build ISL for running on host
yann@3216
    56
do_isl_for_host() {
yann@3216
    57
    local -a isl_opts
yann@3216
    58
    local isl_cflags
yann@3216
    59
    local isl_cxxflags
yann@3216
    60
yann@3216
    61
    CT_DoStep INFO "Installing ISL for host"
yann@3216
    62
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}"
yann@3216
    63
yann@3216
    64
    isl_cflags="${CT_CFLAGS_FOR_HOST}"
yann@3216
    65
    isl_cxxflags="${CT_CFLAGS_FOR_HOST}"
yann@3216
    66
yann@3216
    67
    isl_opts+=( "host=${CT_HOST}" )
yann@3216
    68
    isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
yann@3216
    69
    isl_opts+=( "cflags=${isl_cflags}" )
yann@3216
    70
    isl_opts+=( "cxxflags=${isl_cxxflags}" )
yann@3216
    71
    isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
yann@3216
    72
    do_isl_backend "${isl_opts[@]}"
yann@3216
    73
yann@3216
    74
    CT_Popd
yann@3216
    75
    CT_EndStep
yann@3216
    76
}
yann@3216
    77
yann@3216
    78
# Build ISL
yann@3216
    79
#     Parameter     : description               : type      : default
yann@3216
    80
#     host          : machine to run on         : tuple     : (none)
yann@3216
    81
#     prefix        : prefix to install into    : dir       : (none)
yann@3216
    82
#     cflags        : cflags to use             : string    : (empty)
yann@3216
    83
#     ldflags       : ldflags to use            : string    : (empty)
yann@3216
    84
do_isl_backend() {
yann@3216
    85
    local host
yann@3216
    86
    local prefix
yann@3216
    87
    local cflags
yann@3216
    88
    local cxxflags
yann@3216
    89
    local ldflags
yann@3216
    90
    local arg
yann@3216
    91
yann@3216
    92
    for arg in "$@"; do
yann@3216
    93
        eval "${arg// /\\ }"
yann@3216
    94
    done
yann@3216
    95
yann@3216
    96
    CT_DoLog EXTRA "Configuring ISL"
yann@3216
    97
yann@3216
    98
    CT_DoExecLog CFG                                \
yann@3216
    99
    CFLAGS="${cflags}"                              \
yann@3216
   100
    CXXFLAGS="${cxxflags}"                          \
yann@3216
   101
    LDFLAGS="${ldflags}"                            \
yann@3216
   102
    "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \
yann@3216
   103
        --build=${CT_BUILD}                         \
yann@3216
   104
        --host=${host}                              \
yann@3216
   105
        --prefix="${prefix}"                        \
yann@3216
   106
        --with-libgmp-prefix="${prefix}"            \
yann@3216
   107
        --with-libgmpxx-prefix="${prefix}"          \
yann@3216
   108
        --with-gmp-prefix="${prefix}"               \
yann@3216
   109
        --disable-shared                            \
yann@3216
   110
        --enable-static                             \
yann@3216
   111
        --with-gmp=system                           \
yann@3216
   112
        --with-gmp-prefix="${prefix}"               \
yann@3216
   113
        --with-piplib=no                            \
yann@3216
   114
        --with-clang=no
yann@3216
   115
yann@3216
   116
    CT_DoLog EXTRA "Building ISL"
yann@3216
   117
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@3216
   118
yann@3216
   119
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@3216
   120
        CT_DoLog EXTRA "Checking ISL"
yann@3216
   121
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@3216
   122
    fi
yann@3216
   123
yann@3216
   124
    CT_DoLog EXTRA "Installing ISL"
yann@3216
   125
    CT_DoExecLog ALL make install
yann@3216
   126
}
yann@3216
   127
yann@3216
   128
fi # CT_ISL