scripts/build/companion_libs/mpfr.sh
changeset 1318 5416f4ba36bf
parent 1299 3448ac3f1a5d
child 1376 c4be9b880304
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/build/companion_libs/mpfr.sh	Sun May 03 21:10:15 2009 +0000
     1.3 @@ -0,0 +1,139 @@
     1.4 +# This file adds the functions to build the MPFR library
     1.5 +# Copyright 2008 Yann E. MORIN
     1.6 +# Licensed under the GPL v2. See COPYING in the root of this package
     1.7 +
     1.8 +do_mpfr_get() { :; }
     1.9 +do_mpfr_extract() { :; }
    1.10 +do_mpfr() { :; }
    1.11 +do_mpfr_target() { :; }
    1.12 +
    1.13 +# Overide function depending on configuration
    1.14 +if [ "${CT_GMP_MPFR}" = "y" ]; then
    1.15 +
    1.16 +# Download MPFR
    1.17 +do_mpfr_get() {
    1.18 +    CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/  \
    1.19 +                                 http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
    1.20 +}
    1.21 +
    1.22 +# Extract MPFR
    1.23 +do_mpfr_extract() {
    1.24 +    CT_Extract "mpfr-${CT_MPFR_VERSION}"
    1.25 +    CT_Patch "mpfr-${CT_MPFR_VERSION}"
    1.26 +
    1.27 +    # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
    1.28 +    # same version number. Unfortunately, some tarballs of MPFR are not
    1.29 +    # built sanely, and thus ./configure fails on Gentoo.
    1.30 +    # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
    1.31 +    # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
    1.32 +    # This hack is not bad per se, but the MPFR guys would be better not to
    1.33 +    # do that in the future...
    1.34 +    # It seems that MPFR >= 2.4.0 do not need this...
    1.35 +    case "${CT_MPFR_VERSION}" in
    1.36 +        1.*|2.0.*|2.1.*|2.2.*|2.3.*)
    1.37 +            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
    1.38 +            if [ ! -f .autotools.ct-ng ]; then
    1.39 +                CT_DoLog DEBUG "Re-building autotools files"
    1.40 +                CT_DoExecLog ALL autoreconf -fi
    1.41 +                # Starting with libtool-1.9f, config.{guess,sub} are no longer
    1.42 +                # installed without -i, but starting with libtool-2.2.6, they
    1.43 +                # are no longer removed without -i. Sight... Just use -i with
    1.44 +                # libtool >=2
    1.45 +                # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
    1.46 +                # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
    1.47 +                libtoolize_opt=
    1.48 +                case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
    1.49 +                    0.*)    ;;
    1.50 +                    1.*)    ;;
    1.51 +                    *)      libtoolize_opt=-i;;
    1.52 +                esac
    1.53 +                CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
    1.54 +                touch .autotools.ct-ng
    1.55 +            fi
    1.56 +            CT_Popd
    1.57 +            ;;
    1.58 +    esac
    1.59 +}
    1.60 +
    1.61 +do_mpfr() {
    1.62 +    mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    1.63 +    cd "${CT_BUILD_DIR}/build-mpfr"
    1.64 +
    1.65 +    CT_DoStep INFO "Installing MPFR"
    1.66 +
    1.67 +    mpfr_opt=
    1.68 +    # Under Cygwin, we can't build a thread-safe library
    1.69 +    case "${CT_HOST}" in
    1.70 +        *-cygwin)   mpfr_opt="--disable-thread-safe";;
    1.71 +        *)          mpfr_opt="--enable-thread-safe";;
    1.72 +    esac
    1.73 +
    1.74 +    CT_DoLog EXTRA "Configuring MPFR"
    1.75 +    CC="${CT_HOST}-gcc"                                 \
    1.76 +    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
    1.77 +    CT_DoExecLog ALL                                    \
    1.78 +    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
    1.79 +        --build=${CT_BUILD}                             \
    1.80 +        --host=${CT_HOST}                               \
    1.81 +        --prefix="${CT_PREFIX_DIR}"                     \
    1.82 +        ${mpfr_opt}                                     \
    1.83 +        --disable-shared                                \
    1.84 +        --enable-static                                 \
    1.85 +        --with-gmp="${CT_PREFIX_DIR}"
    1.86 +
    1.87 +    CT_DoLog EXTRA "Building MPFR"
    1.88 +    CT_DoExecLog ALL make ${PARALLELMFLAGS}
    1.89 +
    1.90 +    if [ "${CT_MPFR_CHECK}" = "y" ]; then
    1.91 +        CT_DoLog EXTRA "Checking MPFR"
    1.92 +        CT_DoExecLog ALL make ${PARALLELMFLAGS} -s check
    1.93 +    fi
    1.94 +
    1.95 +    CT_DoLog EXTRA "Installing MPFR"
    1.96 +    CT_DoExecLog ALL make install
    1.97 +
    1.98 +    CT_EndStep
    1.99 +}
   1.100 +
   1.101 +if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
   1.102 +
   1.103 +do_mpfr_target() {
   1.104 +    mkdir -p "${CT_BUILD_DIR}/build-mpfr-target"
   1.105 +    cd "${CT_BUILD_DIR}/build-mpfr-target"
   1.106 +
   1.107 +    CT_DoStep INFO "Installing MPFR for the target"
   1.108 +
   1.109 +    mpfr_opt=
   1.110 +    # Under Cygwin, we can't build a thread-safe library
   1.111 +    case "${CT_TARGET}" in
   1.112 +        *-cygwin)   mpfr_opt="--disable-thread-safe";;
   1.113 +        *)          mpfr_opt="--enable-thread-safe";;
   1.114 +    esac
   1.115 +
   1.116 +    CT_DoLog EXTRA "Configuring MPFR"
   1.117 +    CC="${CT_TARGET}-gcc"                               \
   1.118 +    CFLAGS="${CT_CFLAGS_FOR_TARGET}"                    \
   1.119 +    CT_DoExecLog ALL                                    \
   1.120 +    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
   1.121 +        --build=${CT_BUILD}                             \
   1.122 +        --host=${CT_TARGET}                             \
   1.123 +        --prefix=/usr                                   \
   1.124 +        ${mpfr_opt}                                     \
   1.125 +        --disable-shared                                \
   1.126 +        --enable-static                                 \
   1.127 +        --with-gmp="${CT_SYSROOT_DIR}/usr"
   1.128 +
   1.129 +    CT_DoLog EXTRA "Building MPFR"
   1.130 +    CT_DoExecLog ALL make ${PARALLELMFLAGS}
   1.131 +
   1.132 +    # Not possible to check MPFR while X-compiling
   1.133 +
   1.134 +    CT_DoLog EXTRA "Installing MPFR"
   1.135 +    CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
   1.136 +
   1.137 +    CT_EndStep
   1.138 +}
   1.139 +
   1.140 +fi # CT_GMP_MPFR_TARGET == y
   1.141 +
   1.142 +fi # CT_GMP_MPFR == y