scripts/build/companion_libs/gmp.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Mon Apr 16 15:25:36 2012 +0200 (2012-04-16)
changeset 2941 13e40098fffc
parent 2929 22e495b7bee8
permissions -rw-r--r--
cc/gcc: update Linaro GCC revisions to 2012.04

Update Linaro GCC with the latest available revisions.

The 4.7 revision is also released, but the infrastructure is not yet ready for
it in CT-NG.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
     1 # This file adds the functions to build the GMP library
     2 # Copyright 2008 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_gmp_get() { :; }
     6 do_gmp_extract() { :; }
     7 do_gmp_for_build() { :; }
     8 do_gmp_for_host() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_GMP}" = "y" ]; then
    12 
    13 # Download GMP
    14 do_gmp_get() {
    15     CT_GetFile "gmp-${CT_GMP_VERSION}" {ftp,http}://{ftp.sunet.se/pub,ftp.gnu.org}/gnu/gmp
    16 }
    17 
    18 # Extract GMP
    19 do_gmp_extract() {
    20     CT_Extract "gmp-${CT_GMP_VERSION}"
    21     CT_Patch "gmp" "${CT_GMP_VERSION}"
    22 }
    23 
    24 # Build GMP for running on build
    25 # - always build statically
    26 # - we do not have build-specific CFLAGS
    27 # - install in build-tools prefix
    28 do_gmp_for_build() {
    29     local -a gmp_opts
    30 
    31     case "${CT_TOOLCHAIN_TYPE}" in
    32         native|cross)   return 0;;
    33     esac
    34 
    35     CT_DoStep INFO "Installing GMP for build"
    36     CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-build-${CT_BUILD}"
    37 
    38     gmp_opts+=( "host=${CT_BUILD}" )
    39     gmp_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    40     do_gmp_backend "${gmp_opts[@]}"
    41 
    42     CT_Popd
    43     CT_EndStep
    44 }
    45 
    46 # Build GMP for running on host
    47 do_gmp_for_host() {
    48     local -a gmp_opts
    49 
    50     CT_DoStep INFO "Installing GMP for host"
    51     CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
    52 
    53     gmp_opts+=( "host=${CT_HOST}" )
    54     gmp_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    55     gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    56     do_gmp_backend "${gmp_opts[@]}"
    57 
    58     CT_Popd
    59     CT_EndStep
    60 }
    61 
    62 # Build GMP
    63 #     Parameter     : description               : type      : default
    64 #     host          : machine to run on         : tuple     : (none)
    65 #     prefix        : prefix to install into    : dir       : (none)
    66 #     cflags        : host cflags to use        : string    : (empty)
    67 do_gmp_backend() {
    68     local host
    69     local prefix
    70     local cflags
    71     local arg
    72 
    73     for arg in "$@"; do
    74         eval "${arg// /\\ }"
    75     done
    76 
    77     CT_DoLog EXTRA "Configuring GMP"
    78 
    79     CT_DoExecLog CFG                                \
    80     CFLAGS="${cflags} -fexceptions"                 \
    81     "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    82         --build=${CT_BUILD}                         \
    83         --host=${host}                              \
    84         --prefix="${prefix}"                        \
    85         --enable-fft                                \
    86         --enable-mpbsd                              \
    87         --enable-cxx                                \
    88         --disable-shared                            \
    89         --enable-static
    90 
    91     CT_DoLog EXTRA "Building GMP"
    92     CT_DoExecLog ALL make ${JOBSFLAGS}
    93 
    94     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
    95         CT_DoLog EXTRA "Checking GMP"
    96         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
    97     fi
    98 
    99     CT_DoLog EXTRA "Installing GMP"
   100     CT_DoExecLog ALL make install
   101 }
   102 
   103 fi # CT_GMP