scripts/build/companion_libs/120-ppl.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Fri Feb 15 18:54:27 2013 +0100 (2013-02-15)
changeset 3180 0c76cb00a9c6
parent 3135 3829050af02a
child 3206 7fe58a4f79f8
permissions -rw-r--r--
complibs/ppl: update upstream location

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