scripts/build/companion_libs/120-ppl.sh
author Samuel Martin <smartin@aldebaran-robotics.com>
Sat Apr 13 19:41:36 2013 +0200 (2013-04-13)
changeset 3206 7fe58a4f79f8
parent 3180 0c76cb00a9c6
permissions -rw-r--r--
complibs/ppl: only add -fpermissive flag to CXXFLAGS

-fpermissive is not a valid option to gcc.

Adding it to the CFLAGS make the ppl checks fail with the following
error:

[ALL ] Making check in tests
[ALL ] cc1: warnings being treated as errors
[ERROR] cc1: error: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
[ALL ] cc1: warnings being treated as errors
[ERROR] cc1: error: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
[ERROR] make[7]: *** [formatted_output.o] Error 1

Signed-off-by: "Samuel Martin" <smartin@aldebaran-robotics.com>
Message-Id: <bba2482a06a11415207e.1365876457@smartin-de-2.aldebaran.lan>
Patchwork-Id: 236383
     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     local ppl_cxxflags
    33 
    34     case "${CT_TOOLCHAIN_TYPE}" in
    35         native|cross)   return 0;;
    36     esac
    37 
    38     CT_DoStep INFO "Installing PPL for build"
    39     CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-build-${CT_BUILD}"
    40 
    41     ppl_cflags="${CT_CFLAGS_FOR_BUILD}"
    42     ppl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
    43     if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
    44         ppl_cxxflags+=" -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+=( "cxxflags=${ppl_cxxflags}" )
    51     ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    52     do_ppl_backend "${ppl_opts[@]}"
    53 
    54     CT_Popd
    55     CT_EndStep
    56 }
    57 
    58 # Build PPL for running on host
    59 do_ppl_for_host() {
    60     local -a ppl_opts
    61     local ppl_cflags
    62     local ppl_cxxflags
    63 
    64     CT_DoStep INFO "Installing PPL for host"
    65     CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
    66 
    67     ppl_cflags="${CT_CFLAGS_FOR_HOST}"
    68     ppl_cxxflags="${CT_CFLAGS_FOR_HOST}"
    69     if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
    70         ppl_cxxflags+=" -fpermissive"
    71     fi
    72 
    73     ppl_opts+=( "host=${CT_HOST}" )
    74     ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    75     ppl_opts+=( "cflags=${ppl_cflags}" )
    76     ppl_opts+=( "cxxflags=${ppl_cxxflags}" )
    77     ppl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    78     do_ppl_backend "${ppl_opts[@]}"
    79 
    80     CT_Popd
    81     CT_EndStep
    82 }
    83 
    84 # Build PPL
    85 #     Parameter     : description               : type      : default
    86 #     host          : machine to run on         : tuple     : (none)
    87 #     prefix        : prefix to install into    : dir       : (none)
    88 #     cflags        : cflags to use             : string    : (empty)
    89 #     ldflags       : ldflags to use            : string    : (empty)
    90 do_ppl_backend() {
    91     local host
    92     local prefix
    93     local cflags
    94     local cxxflags
    95     local ldflags
    96     local arg
    97 
    98     for arg in "$@"; do
    99         eval "${arg// /\\ }"
   100     done
   101 
   102     CT_DoLog EXTRA "Configuring PPL"
   103 
   104     CT_DoExecLog CFG                                \
   105     CFLAGS="${cflags}"                              \
   106     CXXFLAGS="${cxxflags}"                          \
   107     LDFLAGS="${ldflags}"                            \
   108     "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
   109         --build=${CT_BUILD}                         \
   110         --host=${host}                              \
   111         --prefix="${prefix}"                        \
   112         --with-libgmp-prefix="${prefix}"            \
   113         --with-libgmpxx-prefix="${prefix}"          \
   114         --with-gmp-prefix="${prefix}"               \
   115         --enable-watchdog                           \
   116         --disable-debugging                         \
   117         --disable-assertions                        \
   118         --disable-ppl_lcdd                          \
   119         --disable-ppl_lpsol                         \
   120         --disable-shared                            \
   121         --enable-interfaces='c c++'                 \
   122         --enable-static
   123 
   124     # Maybe-options:
   125     # --enable-optimization=speed  or sspeed (yes, with 2 's')
   126 
   127     CT_DoLog EXTRA "Building PPL"
   128     CT_DoExecLog ALL make ${JOBSFLAGS}
   129 
   130     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   131         CT_DoLog EXTRA "Checking PPL"
   132         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   133     fi
   134 
   135     CT_DoLog EXTRA "Installing PPL"
   136     CT_DoExecLog ALL make install
   137 
   138     # Remove spuriously installed file
   139     CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
   140 }
   141 
   142 fi # CT_PPL