scripts/build/companion_libs/gmp.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jan 28 22:06:49 2011 +0100 (2011-01-28)
changeset 2284 7ede374110e5
parent 2154 250cdcc86441
child 2346 ab441b3f8ea1
permissions -rw-r--r--
config: add an option not to remove the destination directory

In certain circumstances, removing the destination/installation directory
is a bad idea. For example, when the build environment is already taking
care of sanitising the build tree, and pre-installs stuff in there, it is
a very bad idea to remove the destination directory.

This happens now in buildroot, as the crostool-NG backend now installs the
toolchain in the common host-tools directory, and pre-install there a few
host-utilities (eg. host-automake and host-gawk).

Provide a config knob to turn on/off the removal of the destination
directory, defaulting to 'y' (previous behavior), and forced to 'n' when
used as a backend.

Reported-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@466
     1
# This file adds the functions to build the GMP library
yann@466
     2
# Copyright 2008 Yann E. MORIN
yann@466
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@466
     4
yann@602
     5
do_gmp_get() { :; }
yann@602
     6
do_gmp_extract() { :; }
yann@602
     7
do_gmp() { :; }
yann@602
     8
yann@602
     9
# Overide functions depending on configuration
yann@2099
    10
if [ "${CT_GMP}" = "y" ]; then
yann@468
    11
yann@466
    12
# Download GMP
yann@466
    13
do_gmp_get() {
yann@1119
    14
    CT_GetFile "gmp-${CT_GMP_VERSION}" {ftp,http}://{ftp.sunet.se/pub,ftp.gnu.org}/gnu/gmp
yann@466
    15
}
yann@466
    16
yann@466
    17
# Extract GMP
yann@466
    18
do_gmp_extract() {
yann@1126
    19
    CT_Extract "gmp-${CT_GMP_VERSION}"
yann@1901
    20
    CT_Patch "gmp" "${CT_GMP_VERSION}"
yann@466
    21
}
yann@466
    22
yann@466
    23
do_gmp() {
yann@1892
    24
    local -a gmp_opts
yann@1324
    25
yann@466
    26
    mkdir -p "${CT_BUILD_DIR}/build-gmp"
yann@466
    27
    cd "${CT_BUILD_DIR}/build-gmp"
yann@466
    28
yann@466
    29
    CT_DoStep INFO "Installing GMP"
yann@466
    30
yann@466
    31
    CT_DoLog EXTRA "Configuring GMP"
yann@1324
    32
yann@1892
    33
    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
yann@1892
    34
        gmp_opts+=( --enable-shared --disable-static )
yann@1892
    35
    else
yann@1892
    36
        gmp_opts+=( --disable-shared --enable-static )
yann@1892
    37
    fi
yann@1892
    38
yann@1383
    39
    CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions"     \
anthony@2154
    40
    CT_DoExecLog CFG                                \
yann@1119
    41
    "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
yann@1119
    42
        --build=${CT_BUILD}                         \
yann@1119
    43
        --host=${CT_HOST}                           \
yann@1893
    44
        --prefix="${CT_COMPLIBS_DIR}"               \
yann@1324
    45
        --enable-fft                                \
yann@1324
    46
        --enable-mpbsd                              \
yann@1892
    47
        --enable-cxx                                \
yann@1892
    48
        "${gmp_opts[@]}"
yann@466
    49
yann@466
    50
    CT_DoLog EXTRA "Building GMP"
yann@2275
    51
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@466
    52
yann@1890
    53
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@466
    54
        CT_DoLog EXTRA "Checking GMP"
yann@2275
    55
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@466
    56
    fi
yann@466
    57
yann@466
    58
    CT_DoLog EXTRA "Installing GMP"
yann@655
    59
    CT_DoExecLog ALL make install
yann@466
    60
yann@466
    61
    CT_EndStep
yann@466
    62
}
yann@468
    63
yann@1810
    64
fi # CT_GMP