scripts/build/companion_libs/mpfr.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Mar 28 01:05:18 2011 +0200 (2011-03-28)
changeset 2362 0888065f8c4d
parent 2275 9ab4392430ad
child 2381 0ca0f85a4b2a
permissions -rw-r--r--
cc/gcc: cleanup the _or_later logic

So far, we've had a version always select appropriate _or_later option,
which in turn would select all previous _or_later options.

Because the dependencies on companion libs were cumulative, that was
working OK. But the upcoming 4.6 will no longer depend on libelf, so
we can't keep the cumulative scheme we've been using so far.

Have each release family select the corresponding dependencies, instead
of relying on selecting previous _or_later.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 # This file adds the functions to build the MPFR library
     2 # Copyright 2008 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_mpfr_get() { :; }
     6 do_mpfr_extract() { :; }
     7 do_mpfr() { :; }
     8 
     9 # Overide function depending on configuration
    10 if [ "${CT_MPFR}" = "y" ]; then
    11 
    12 # Download MPFR
    13 do_mpfr_get() {
    14     CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/  \
    15                                  http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
    16 }
    17 
    18 # Extract MPFR
    19 do_mpfr_extract() {
    20     CT_Extract "mpfr-${CT_MPFR_VERSION}"
    21     CT_Patch "mpfr" "${CT_MPFR_VERSION}"
    22 
    23     # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
    24     # same version number. Unfortunately, some tarballs of MPFR are not
    25     # built sanely, and thus ./configure fails on Gentoo.
    26     # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
    27     # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
    28     # This hack is not bad per se, but the MPFR guys would be better not to
    29     # do that in the future...
    30     # It seems that MPFR >= 2.4.0 do not need this...
    31     case "${CT_MPFR_VERSION}" in
    32         2.4.*)
    33             CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
    34             if [ ! -f .autoreconf.ct-ng ]; then
    35                 CT_DoLog DEBUG "Running autoreconf"
    36                 CT_DoExecLog ALL autoreconf
    37                 touch .autoreconf.ct-ng
    38             fi
    39             CT_Popd
    40             ;;
    41         1.*|2.0.*|2.1.*|2.2.*|2.3.*)
    42             CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
    43             if [ ! -f .autotools.ct-ng ]; then
    44                 CT_DoLog DEBUG "Re-building autotools files"
    45                 CT_DoExecLog ALL autoreconf -fi
    46                 # Starting with libtool-1.9f, config.{guess,sub} are no longer
    47                 # installed without -i, but starting with libtool-2.2.6, they
    48                 # are no longer removed without -i. Sight... Just use -i with
    49                 # libtool >=2
    50                 # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
    51                 # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
    52                 libtoolize_opt=
    53                 case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
    54                     0.*)    ;;
    55                     1.*)    ;;
    56                     *)      libtoolize_opt=-i;;
    57                 esac
    58                 CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
    59                 touch .autotools.ct-ng
    60             fi
    61             CT_Popd
    62             ;;
    63     esac
    64 }
    65 
    66 do_mpfr() {
    67     local -a mpfr_opts
    68 
    69     mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    70     cd "${CT_BUILD_DIR}/build-mpfr"
    71 
    72     CT_DoStep INFO "Installing MPFR"
    73 
    74     # Under Cygwin, we can't build a thread-safe library
    75     case "${CT_HOST}" in
    76         *cygwin*)   mpfr_opts+=( --disable-thread-safe );;
    77         *mingw*)    mpfr_opts+=( --disable-thread-safe );;
    78         *darwin*)   mpfr_opts+=( --disable-thread-safe );;
    79         *)          mpfr_opts+=( --enable-thread-safe  );;
    80     esac
    81 
    82     if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    83         mpfr_opts+=( --enable-shared --disable-static )
    84     else
    85         mpfr_opts+=( --disable-shared --enable-static )
    86     fi
    87 
    88     CT_DoLog EXTRA "Configuring MPFR"
    89     CT_DoExecLog CFG                                    \
    90     CC="${CT_HOST}-gcc"                                 \
    91     CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
    92     "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
    93         --build=${CT_BUILD}                             \
    94         --host=${CT_HOST}                               \
    95         --prefix="${CT_COMPLIBS_DIR}"                   \
    96         --with-gmp="${CT_COMPLIBS_DIR}"                 \
    97         "${mpfr_opts[@]}"
    98 
    99     CT_DoLog EXTRA "Building MPFR"
   100     CT_DoExecLog ALL make ${JOBSFLAGS}
   101 
   102     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   103         CT_DoLog EXTRA "Checking MPFR"
   104         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   105     fi
   106 
   107     CT_DoLog EXTRA "Installing MPFR"
   108     CT_DoExecLog ALL make install
   109 
   110     CT_EndStep
   111 }
   112 
   113 fi # CT_MPFR