scripts/build/companion_libs/gmp.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 18:56:30 2011 +0200 (2011-07-17)
changeset 2927 ddaae597fd7c
parent 2381 0ca0f85a4b2a
child 2929 22e495b7bee8
permissions -rw-r--r--
complibs: split companion libraries to backend/frontend, a-la cc_core

Move the actual complibs codes to backend functions that builds the
required combo of build/host/target as requested by a frontend.

This split is currently a no-op, but is required for the upcoming
canadian-cross rework, where we'll be needing to build the complibs
twice, one for build/build, and one for build/host.

This applies to the six companion libraries:
- GMP
- MPFR
- PPL
- Cloog/PPL
- MPC
- libelf

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     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_host() { :; }
     8 
     9 # Overide functions depending on configuration
    10 if [ "${CT_GMP}" = "y" ]; then
    11 
    12 # Download GMP
    13 do_gmp_get() {
    14     CT_GetFile "gmp-${CT_GMP_VERSION}" {ftp,http}://{ftp.sunet.se/pub,ftp.gnu.org}/gnu/gmp
    15 }
    16 
    17 # Extract GMP
    18 do_gmp_extract() {
    19     CT_Extract "gmp-${CT_GMP_VERSION}"
    20     CT_Patch "gmp" "${CT_GMP_VERSION}"
    21 }
    22 
    23 # Build GMP for running on host
    24 do_gmp_for_host() {
    25     local -a gmp_opts
    26 
    27     CT_DoStep INFO "Installing GMP for host"
    28     CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
    29 
    30     gmp_opts+=( "host=${CT_HOST}" )
    31     gmp_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
    32     gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    33     do_gmp_backend "${gmp_opts[@]}"
    34 
    35     CT_Popd
    36     CT_EndStep
    37 }
    38 
    39 # Build GMP
    40 #     Parameter     : description               : type      : default
    41 #     host          : machine to run on         : tuple     : (none)
    42 #     prefix        : prefix to install into    : dir       : (none)
    43 #     cflags        : host cflags to use        : string    : (empty)
    44 do_gmp_backend() {
    45     local host
    46     local prefix
    47     local cflags
    48     local arg
    49 
    50     for arg in "$@"; do
    51         eval "${arg// /\\ }"
    52     done
    53 
    54     CT_DoLog EXTRA "Configuring GMP"
    55 
    56     CT_DoExecLog CFG                                \
    57     CFLAGS="${cflags} -fexceptions"                 \
    58     "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    59         --build=${CT_BUILD}                         \
    60         --host=${host}                              \
    61         --prefix="${prefix}"                        \
    62         --enable-fft                                \
    63         --enable-mpbsd                              \
    64         --enable-cxx                                \
    65         --disable-shared                            \
    66         --enable-static
    67 
    68     CT_DoLog EXTRA "Building GMP"
    69     CT_DoExecLog ALL make ${JOBSFLAGS}
    70 
    71     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
    72         CT_DoLog EXTRA "Checking GMP"
    73         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
    74     fi
    75 
    76     CT_DoLog EXTRA "Installing GMP"
    77     CT_DoExecLog ALL make install
    78 }
    79 
    80 fi # CT_GMP