scripts/build/companion_libs/gmp.sh
author Remy Bohmer <linux@bohmer.net>
Thu May 27 23:18:19 2010 +0200 (2010-05-27)
changeset 2060 51e4597b07fc
parent 1893 f5dab3c43abf
child 2099 1bb063c8a0ca
permissions -rw-r--r--
scripts: add option to strip all toolchain executables

To reduce filesizes of the toolchain and even improve build times
of projects to be build with this toolchain it is usefull to strip
the delivered toolchain executables. Since it is not likely that we
will debug the toolchain executables itself we do not need the
debug information inside the executables itself.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
     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() { :; }
     8 do_gmp_target() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_GMP}" = "y" -o "${CT_GMP_TARGET}" = "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 if [ "${CT_GMP}" = "y" ]; then
    25 
    26 do_gmp() {
    27     local -a gmp_opts
    28 
    29     mkdir -p "${CT_BUILD_DIR}/build-gmp"
    30     cd "${CT_BUILD_DIR}/build-gmp"
    31 
    32     CT_DoStep INFO "Installing GMP"
    33 
    34     CT_DoLog EXTRA "Configuring GMP"
    35 
    36     if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    37         gmp_opts+=( --enable-shared --disable-static )
    38     else
    39         gmp_opts+=( --disable-shared --enable-static )
    40     fi
    41 
    42     CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions"     \
    43     CT_DoExecLog ALL                                \
    44     "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    45         --build=${CT_BUILD}                         \
    46         --host=${CT_HOST}                           \
    47         --prefix="${CT_COMPLIBS_DIR}"               \
    48         --enable-fft                                \
    49         --enable-mpbsd                              \
    50         --enable-cxx                                \
    51         "${gmp_opts[@]}"
    52 
    53     CT_DoLog EXTRA "Building GMP"
    54     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    55 
    56     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
    57         CT_DoLog EXTRA "Checking GMP"
    58         CT_DoExecLog ALL make ${PARALLELMFLAGS} -s check
    59     fi
    60 
    61     CT_DoLog EXTRA "Installing GMP"
    62     CT_DoExecLog ALL make install
    63 
    64     CT_EndStep
    65 }
    66 
    67 fi # CT_GMP
    68 
    69 if [ "${CT_GMP_TARGET}" = "y" ]; then
    70 
    71 do_gmp_target() {
    72     mkdir -p "${CT_BUILD_DIR}/build-gmp-target"
    73     cd "${CT_BUILD_DIR}/build-gmp-target"
    74 
    75     CT_DoStep INFO "Installing GMP for the target"
    76 
    77     CT_DoLog EXTRA "Configuring GMP"
    78     CFLAGS="${CT_CFLAGS_FOR_TARGET}"                \
    79     CT_DoExecLog ALL                                \
    80     "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    81         --build=${CT_BUILD}                         \
    82         --host=${CT_TARGET}                         \
    83         --prefix=/usr                               \
    84         --disable-shared                            \
    85         --enable-static                             \
    86         --enable-fft                                \
    87         --enable-mpbsd                              \
    88 
    89     CT_DoLog EXTRA "Building GMP"
    90     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    91 
    92     # Not possible to check MPFR while X-compiling
    93 
    94     CT_DoLog EXTRA "Installing GMP"
    95     CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
    96 
    97     CT_EndStep
    98 }
    99 
   100 fi # CT_GMP_TARGET
   101 
   102 fi # CT_GMP || CT_GMP_TARGET