scripts/build/companion_libs/120-ppl.sh
author Martin Guy <martinwguy@gmail.com>
Sun Mar 31 04:07:38 2013 +0000 (2013-03-31)
changeset 3203 74fd467be5aa
parent 3135 3829050af02a
child 3206 7fe58a4f79f8
permissions -rw-r--r--
arch/avr32: Fix download of header files

This patch fixes the download of the avr32 headers in crosstool-ng by
fetching them directly from Atmel's web site instead of the now-broken URL
given by the original author of the avr32-header-fetching modification,
who fetched them from a copy on his own, now-defunct server.

It also adds the necessary logic to extract from a zip file, as that is
how the headers are packaged.

To configure it for avr32 after launching ct-ng menuconfig in an empty
directory:

Paths and misc options ->
Shell to use as CONFIG_SHELL = sh
Target options ->
Target Architecture = avr32
Toolchain options ->
Tuple's alias = avr32
Binary utilities ->
binutils version = 2.18a
C compiler
gcc version = 4.2.2
C-library
newlib version = 1.17.0
Enable IOs on long long = yes
Enable IOs on floats and doubles = yes
Disable the syscalls supplied with newlib = yes

CONFIG_SHELL is necessary to get round the "fragment: command not
found" bug when binutils-2.18 is configured using bash.

Prepared against crosstool-ng mercurial trunk on 31 March 2012.

Signed-off-by: Martin Guy <martinwguy@gmail.com>
[yann.morin.1998@free.fr: update bundles sample accordingly]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <CAL4-wQrg_NQ7jm-NCADqeyQr9twyhtx42OUGNThP6gWeqZc=kw@mail.gmail.com>
Patchwork-Id: 232612
     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