scripts/build/companion_libs/120-ppl.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Thu Dec 27 12:53:32 2012 +0100 (2012-12-27)
changeset 3153 f6740f9e42de
parent 3119 1c56c03b7ed5
child 3180 0c76cb00a9c6
permissions -rw-r--r--
scripts/addToolsVersion: handle elf2flt

The one was missing from the list.

It is very improbable that we ever need it, as elf2flt does no release,
and we always get it from CVS head. But for the sake of consistency, we
just add it.

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