scripts/build/companion_libs/120-ppl.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 3180 0c76cb00a9c6
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@1324
     1
# This file adds the functions to build the PPL library
yann@1324
     2
# Copyright 2009 Yann E. MORIN
yann@1324
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@1324
     4
yann@1324
     5
do_ppl_get() { :; }
yann@1324
     6
do_ppl_extract() { :; }
yann@2929
     7
do_ppl_for_build() { :; }
yann@2927
     8
do_ppl_for_host() { :; }
yann@1324
     9
yann@1324
    10
# Overide functions depending on configuration
yann@1808
    11
if [ "${CT_PPL}" = "y" ]; then
yann@1324
    12
yann@1324
    13
# Download PPL
yann@1324
    14
do_ppl_get() {
yann@3180
    15
    CT_GetFile "ppl-${CT_PPL_VERSION}"  \
yann@3180
    16
        http://bugseng.com/products/ppl/download/ftp/releases/${CT_PPL_VERSION}
yann@1324
    17
}
yann@1324
    18
yann@1324
    19
# Extract PPL
yann@1324
    20
do_ppl_extract() {
yann@1324
    21
    CT_Extract "ppl-${CT_PPL_VERSION}"
yann@1901
    22
    CT_Patch "ppl" "${CT_PPL_VERSION}"
yann@1324
    23
}
yann@1324
    24
yann@2929
    25
# Build PPL for running on build
yann@2929
    26
# - always build statically
yann@2929
    27
# - we do not have build-specific CFLAGS
yann@2929
    28
# - install in build-tools prefix
yann@2929
    29
do_ppl_for_build() {
yann@2929
    30
    local -a ppl_opts
yann@3135
    31
    local ppl_cflags
smartin@3206
    32
    local ppl_cxxflags
yann@2929
    33
yann@2929
    34
    case "${CT_TOOLCHAIN_TYPE}" in
yann@2929
    35
        native|cross)   return 0;;
yann@2929
    36
    esac
yann@2929
    37
yann@2929
    38
    CT_DoStep INFO "Installing PPL for build"
yann@2929
    39
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-build-${CT_BUILD}"
yann@2929
    40
yann@3135
    41
    ppl_cflags="${CT_CFLAGS_FOR_BUILD}"
smartin@3206
    42
    ppl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
yann@3135
    43
    if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
smartin@3206
    44
        ppl_cxxflags+=" -fpermissive"
yann@3135
    45
    fi
yann@3135
    46
yann@2929
    47
    ppl_opts+=( "host=${CT_BUILD}" )
yann@2929
    48
    ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
yann@3135
    49
    ppl_opts+=( "cflags=${ppl_cflags}" )
smartin@3206
    50
    ppl_opts+=( "cxxflags=${ppl_cxxflags}" )
diorcet@3119
    51
    ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
yann@2929
    52
    do_ppl_backend "${ppl_opts[@]}"
yann@2929
    53
yann@2929
    54
    CT_Popd
yann@2929
    55
    CT_EndStep
yann@2929
    56
}
yann@2929
    57
yann@2927
    58
# Build PPL for running on host
yann@2927
    59
do_ppl_for_host() {
yann@2927
    60
    local -a ppl_opts
yann@3135
    61
    local ppl_cflags
smartin@3206
    62
    local ppl_cxxflags
yann@1324
    63
yann@2927
    64
    CT_DoStep INFO "Installing PPL for host"
yann@2927
    65
    CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
yann@2927
    66
yann@3135
    67
    ppl_cflags="${CT_CFLAGS_FOR_HOST}"
smartin@3206
    68
    ppl_cxxflags="${CT_CFLAGS_FOR_HOST}"
yann@3135
    69
    if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
smartin@3206
    70
        ppl_cxxflags+=" -fpermissive"
yann@3135
    71
    fi
yann@3135
    72
yann@2927
    73
    ppl_opts+=( "host=${CT_HOST}" )
yann@2931
    74
    ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
yann@3135
    75
    ppl_opts+=( "cflags=${ppl_cflags}" )
smartin@3206
    76
    ppl_opts+=( "cxxflags=${ppl_cxxflags}" )
diorcet@3119
    77
    ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
yann@2927
    78
    do_ppl_backend "${ppl_opts[@]}"
yann@2927
    79
yann@2927
    80
    CT_Popd
yann@2927
    81
    CT_EndStep
yann@2927
    82
}
yann@2927
    83
yann@2927
    84
# Build PPL
yann@2927
    85
#     Parameter     : description               : type      : default
yann@2927
    86
#     host          : machine to run on         : tuple     : (none)
yann@2927
    87
#     prefix        : prefix to install into    : dir       : (none)
diorcet@3119
    88
#     cflags        : cflags to use             : string    : (empty)
diorcet@3119
    89
#     ldflags       : ldflags to use            : string    : (empty)
yann@2927
    90
do_ppl_backend() {
yann@2927
    91
    local host
yann@2927
    92
    local prefix
yann@2927
    93
    local cflags
smartin@3206
    94
    local cxxflags
diorcet@3119
    95
    local ldflags
yann@2927
    96
    local arg
yann@2927
    97
yann@2927
    98
    for arg in "$@"; do
yann@2927
    99
        eval "${arg// /\\ }"
yann@2927
   100
    done
yann@1324
   101
yann@1324
   102
    CT_DoLog EXTRA "Configuring PPL"
yann@1892
   103
yann@2348
   104
    CT_DoExecLog CFG                                \
yann@2927
   105
    CFLAGS="${cflags}"                              \
smartin@3206
   106
    CXXFLAGS="${cxxflags}"                          \
diorcet@3119
   107
    LDFLAGS="${ldflags}"                            \
yann@1324
   108
    "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
yann@1324
   109
        --build=${CT_BUILD}                         \
yann@2927
   110
        --host=${host}                              \
yann@2927
   111
        --prefix="${prefix}"                        \
yann@2927
   112
        --with-libgmp-prefix="${prefix}"            \
yann@2927
   113
        --with-libgmpxx-prefix="${prefix}"          \
yann@2927
   114
        --with-gmp-prefix="${prefix}"               \
yann@2364
   115
        --enable-watchdog                           \
yann@1324
   116
        --disable-debugging                         \
yann@1324
   117
        --disable-assertions                        \
yann@1324
   118
        --disable-ppl_lcdd                          \
yann@1892
   119
        --disable-ppl_lpsol                         \
yann@2381
   120
        --disable-shared                            \
anthony@2461
   121
        --enable-interfaces='c c++'                 \
yann@2381
   122
        --enable-static
yann@1324
   123
yann@1324
   124
    # Maybe-options:
yann@1324
   125
    # --enable-optimization=speed  or sspeed (yes, with 2 's')
yann@1324
   126
yann@1324
   127
    CT_DoLog EXTRA "Building PPL"
yann@2275
   128
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@1324
   129
yann@1890
   130
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@1324
   131
        CT_DoLog EXTRA "Checking PPL"
yann@2275
   132
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@1324
   133
    fi
yann@1324
   134
yann@1324
   135
    CT_DoLog EXTRA "Installing PPL"
yann@1324
   136
    CT_DoExecLog ALL make install
yann@1324
   137
yann@1397
   138
    # Remove spuriously installed file
yann@2927
   139
    CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
yann@1324
   140
}
yann@1324
   141
yann@1808
   142
fi # CT_PPL