scripts/build/companion_libs/mpfr.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Apr 13 00:43:09 2010 +0200 (2010-04-13)
changeset 1904 ec847e60981d
parent 1895 3ea4e6f7b85f
child 1905 f819ad7335e2
permissions -rw-r--r--
Revert 3ea4e6f7b85f: Force autoreconf for mpfr

It breaks on my machine. Revert until we find the exact cause leading to
the initial patch, and we come up with a patch that properly fixes it.
yann@466
     1
# This file adds the functions to build the MPFR 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_mpfr_get() { :; }
yann@602
     6
do_mpfr_extract() { :; }
yann@602
     7
do_mpfr() { :; }
yann@602
     8
do_mpfr_target() { :; }
yann@602
     9
yann@602
    10
# Overide function depending on configuration
yann@1810
    11
if [ "${CT_MPFR}" = "y" -o "${CT_MPFR_TARGET}" = "y" ]; then
yann@468
    12
yann@466
    13
# Download MPFR
yann@466
    14
do_mpfr_get() {
yann@1119
    15
    CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/  \
yann@522
    16
                                 http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
yann@466
    17
}
yann@466
    18
yann@466
    19
# Extract MPFR
yann@466
    20
do_mpfr_extract() {
yann@1126
    21
    CT_Extract "mpfr-${CT_MPFR_VERSION}"
yann@1126
    22
    CT_Patch "mpfr-${CT_MPFR_VERSION}"
yann@466
    23
yann@584
    24
    # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
yann@584
    25
    # same version number. Unfortunately, some tarballs of MPFR are not
yann@584
    26
    # built sanely, and thus ./configure fails on Gentoo.
yann@584
    27
    # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
yann@584
    28
    # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
yann@598
    29
    # This hack is not bad per se, but the MPFR guys would be better not to
yann@584
    30
    # do that in the future...
yann@1251
    31
    # It seems that MPFR >= 2.4.0 do not need this...
yann@1251
    32
    case "${CT_MPFR_VERSION}" in
yann@1889
    33
        2.4.*)
oron@1449
    34
            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
oron@1449
    35
            if [ ! -f .autoreconf.ct-ng ]; then
oron@1449
    36
                CT_DoLog DEBUG "Running autoreconf"
yann@1904
    37
                CT_DoExecLog ALL autoreconf
oron@1449
    38
                touch .autoreconf.ct-ng
oron@1449
    39
            fi
oron@1449
    40
            CT_Popd
oron@1449
    41
            ;;
yann@1251
    42
        1.*|2.0.*|2.1.*|2.2.*|2.3.*)
yann@1251
    43
            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
yann@1251
    44
            if [ ! -f .autotools.ct-ng ]; then
yann@1251
    45
                CT_DoLog DEBUG "Re-building autotools files"
yann@1251
    46
                CT_DoExecLog ALL autoreconf -fi
yann@1251
    47
                # Starting with libtool-1.9f, config.{guess,sub} are no longer
yann@1251
    48
                # installed without -i, but starting with libtool-2.2.6, they
yann@1251
    49
                # are no longer removed without -i. Sight... Just use -i with
yann@1251
    50
                # libtool >=2
yann@1251
    51
                # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
yann@1251
    52
                # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
yann@1251
    53
                libtoolize_opt=
yann@1299
    54
                case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
yann@1251
    55
                    0.*)    ;;
yann@1251
    56
                    1.*)    ;;
yann@1251
    57
                    *)      libtoolize_opt=-i;;
yann@1251
    58
                esac
yann@1251
    59
                CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
yann@1251
    60
                touch .autotools.ct-ng
yann@1251
    61
            fi
yann@1251
    62
            CT_Popd
yann@1251
    63
            ;;
yann@1251
    64
    esac
yann@595
    65
}
yann@595
    66
yann@1810
    67
if [ "${CT_MPFR}" = "y" ]; then
yann@1810
    68
yann@595
    69
do_mpfr() {
yann@1892
    70
    local -a mpfr_opts
yann@1892
    71
yann@595
    72
    mkdir -p "${CT_BUILD_DIR}/build-mpfr"
yann@595
    73
    cd "${CT_BUILD_DIR}/build-mpfr"
yann@595
    74
yann@595
    75
    CT_DoStep INFO "Installing MPFR"
yann@584
    76
yann@1251
    77
    # Under Cygwin, we can't build a thread-safe library
yann@1205
    78
    case "${CT_HOST}" in
yann@1892
    79
        *cygwin*)   mpfr_opts+=( --disable-thread-safe );;
yann@1892
    80
        *mingw*)    mpfr_opts+=( --disable-thread-safe );;
yann@1892
    81
        *darwin*)   mpfr_opts+=( --disable-thread-safe );;
yann@1892
    82
        *)          mpfr_opts+=( --enable-thread-safe  );;
yann@1205
    83
    esac
yann@1205
    84
yann@1892
    85
    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
yann@1892
    86
        mpfr_opts+=( --enable-shared --disable-static )
yann@1892
    87
    else
yann@1892
    88
        mpfr_opts+=( --disable-shared --enable-static )
yann@1892
    89
    fi
yann@1892
    90
yann@466
    91
    CT_DoLog EXTRA "Configuring MPFR"
yann@1251
    92
    CC="${CT_HOST}-gcc"                                 \
yann@1119
    93
    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
yann@1119
    94
    CT_DoExecLog ALL                                    \
yann@1119
    95
    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
yann@1119
    96
        --build=${CT_BUILD}                             \
yann@1119
    97
        --host=${CT_HOST}                               \
yann@1893
    98
        --prefix="${CT_COMPLIBS_DIR}"                   \
yann@1893
    99
        --with-gmp="${CT_COMPLIBS_DIR}"                 \
yann@1892
   100
        "${mpfr_opts[@]}"
yann@466
   101
yann@466
   102
    CT_DoLog EXTRA "Building MPFR"
yann@656
   103
    CT_DoExecLog ALL make ${PARALLELMFLAGS}
yann@466
   104
yann@1890
   105
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@466
   106
        CT_DoLog EXTRA "Checking MPFR"
yann@656
   107
        CT_DoExecLog ALL make ${PARALLELMFLAGS} -s check
yann@466
   108
    fi
yann@466
   109
yann@466
   110
    CT_DoLog EXTRA "Installing MPFR"
yann@656
   111
    CT_DoExecLog ALL make install
yann@466
   112
yann@466
   113
    CT_EndStep
yann@466
   114
}
yann@468
   115
yann@1810
   116
fi # CT_MPFR
yann@1810
   117
yann@1810
   118
if [ "${CT_MPFR_TARGET}" = "y" ]; then
yann@468
   119
yann@602
   120
do_mpfr_target() {
yann@602
   121
    mkdir -p "${CT_BUILD_DIR}/build-mpfr-target"
yann@602
   122
    cd "${CT_BUILD_DIR}/build-mpfr-target"
yann@468
   123
yann@602
   124
    CT_DoStep INFO "Installing MPFR for the target"
yann@602
   125
yann@1205
   126
    mpfr_opt=
yann@1251
   127
    # Under Cygwin, we can't build a thread-safe library
yann@1205
   128
    case "${CT_TARGET}" in
yann@1205
   129
        *-cygwin)   mpfr_opt="--disable-thread-safe";;
yann@1205
   130
        *)          mpfr_opt="--enable-thread-safe";;
yann@1205
   131
    esac
yann@1205
   132
yann@602
   133
    CT_DoLog EXTRA "Configuring MPFR"
yann@1251
   134
    CC="${CT_TARGET}-gcc"                               \
yann@1119
   135
    CFLAGS="${CT_CFLAGS_FOR_TARGET}"                    \
yann@1119
   136
    CT_DoExecLog ALL                                    \
yann@1119
   137
    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
yann@1119
   138
        --build=${CT_BUILD}                             \
yann@1119
   139
        --host=${CT_TARGET}                             \
yann@1119
   140
        --prefix=/usr                                   \
yann@1205
   141
        ${mpfr_opt}                                     \
yann@1205
   142
        --disable-shared                                \
yann@1205
   143
        --enable-static                                 \
yann@656
   144
        --with-gmp="${CT_SYSROOT_DIR}/usr"
yann@602
   145
yann@602
   146
    CT_DoLog EXTRA "Building MPFR"
yann@656
   147
    CT_DoExecLog ALL make ${PARALLELMFLAGS}
yann@602
   148
yann@602
   149
    # Not possible to check MPFR while X-compiling
yann@602
   150
yann@602
   151
    CT_DoLog EXTRA "Installing MPFR"
yann@656
   152
    CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
yann@602
   153
yann@602
   154
    CT_EndStep
yann@602
   155
}
yann@602
   156
yann@1810
   157
fi # CT_MPFR_TARGET
yann@602
   158
yann@1810
   159
fi # CT_MPFR || CT_MPFR_TARGET