scripts/build/companion_libs/ppl.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Jul 25 19:04:17 2011 +0200 (2011-07-25)
changeset 2931 8a72662f0815
parent 2929 22e495b7bee8
permissions -rw-r--r--
complibs: fixup the host complibs install dir

It's easier to have as much as possible stuff in the same place to
ease backup/restore, and make things easier to follow.

Move the host companion libraries install dir as a sub-dir of the
build-tools install dir (but not directly in it, it would break
for canadian or cross-native).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.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 
    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_opts+=( "host=${CT_BUILD}" )
    42     ppl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    43     do_ppl_backend "${ppl_opts[@]}"
    44 
    45     CT_Popd
    46     CT_EndStep
    47 }
    48 
    49 # Build PPL for running on host
    50 do_ppl_for_host() {
    51     local -a ppl_opts
    52 
    53     CT_DoStep INFO "Installing PPL for host"
    54     CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
    55 
    56     ppl_opts+=( "host=${CT_HOST}" )
    57     ppl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    58     ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    59     do_ppl_backend "${ppl_opts[@]}"
    60 
    61     CT_Popd
    62     CT_EndStep
    63 }
    64 
    65 # Build PPL
    66 #     Parameter     : description               : type      : default
    67 #     host          : machine to run on         : tuple     : (none)
    68 #     prefix        : prefix to install into    : dir       : (none)
    69 #     cflags        : host cflags to use        : string    : (empty)
    70 do_ppl_backend() {
    71     local host
    72     local prefix
    73     local cflags
    74     local arg
    75 
    76     for arg in "$@"; do
    77         eval "${arg// /\\ }"
    78     done
    79 
    80     CT_DoLog EXTRA "Configuring PPL"
    81 
    82     CT_DoExecLog CFG                                \
    83     CFLAGS="${cflags}"                              \
    84     CXXFLAGS="${cflags}"                            \
    85     "${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
    86         --build=${CT_BUILD}                         \
    87         --host=${host}                              \
    88         --prefix="${prefix}"                        \
    89         --with-libgmp-prefix="${prefix}"            \
    90         --with-libgmpxx-prefix="${prefix}"          \
    91         --with-gmp-prefix="${prefix}"               \
    92         --enable-watchdog                           \
    93         --disable-debugging                         \
    94         --disable-assertions                        \
    95         --disable-ppl_lcdd                          \
    96         --disable-ppl_lpsol                         \
    97         --disable-shared                            \
    98         --enable-interfaces='c c++'                 \
    99         --enable-static
   100 
   101     # Maybe-options:
   102     # --enable-optimization=speed  or sspeed (yes, with 2 's')
   103 
   104     CT_DoLog EXTRA "Building PPL"
   105     CT_DoExecLog ALL make ${JOBSFLAGS}
   106 
   107     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   108         CT_DoLog EXTRA "Checking PPL"
   109         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   110     fi
   111 
   112     CT_DoLog EXTRA "Installing PPL"
   113     CT_DoExecLog ALL make install
   114 
   115     # Remove spuriously installed file
   116     CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
   117 }
   118 
   119 fi # CT_PPL