scripts/build/mpfr.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Nov 20 17:10:09 2008 +0000 (2008-11-20)
changeset 1063 1b4b6359a329
parent 798 aa89c67f0ffc
child 1112 c72aecd1a9ef
permissions -rw-r--r--
MPFR: correctly re-install config.{guess,sub} with autotools >=2.0.0.

/trunk/scripts/build/mpfr.sh | 14 13 1 0 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
     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_print_filename() { :; }
     6 do_mpfr_get() { :; }
     7 do_mpfr_extract() { :; }
     8 do_mpfr() { :; }
     9 do_mpfr_target() { :; }
    10 
    11 # Overide function depending on configuration
    12 if [ "${CT_GMP_MPFR}" = "y" ]; then
    13 
    14 do_print_filename() {
    15     [ "${CT_GMP_MPFR}" = "y" ] || return 0
    16     echo "mpfr-${CT_MPFR_VERSION}"
    17 }
    18 
    19 # Download MPFR
    20 do_mpfr_get() {
    21     CT_GetFile "${CT_MPFR_FILE}" http://www.mpfr.org/mpfr-current/          \
    22                                  http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
    23 }
    24 
    25 # Extract MPFR
    26 do_mpfr_extract() {
    27     CT_ExtractAndPatch "${CT_MPFR_FILE}"
    28 
    29     # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
    30     # same version number. Unfortunately, some tarballs of MPFR are not
    31     # built sanely, and thus ./configure fails on Gentoo.
    32     # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
    33     # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
    34     # This hack is not bad per se, but the MPFR guys would be better not to
    35     # do that in the future...
    36     CT_Pushd "${CT_SRC_DIR}/${CT_MPFR_FILE}"
    37     if [ ! -f .autotools.ct-ng ]; then
    38         CT_DoLog DEBUG "Re-building autotools files"
    39         CT_DoExecLog ALL autoreconf -fi
    40         # Starting with libtool-1.9f, config.{guess,sub} are no longer
    41         # installed without -i, but starting with libtool-2.2.6, they
    42         # are no longer removed without -i. Sight... Just use -i with
    43         # libtool >=2
    44         # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
    45         # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
    46         libtoolize_opt=
    47         case "$(libtoolize --version |head -n 1 |gawk '{ print $(NF); }')" in
    48             0.*)    ;;
    49             1.*)    ;;
    50             *)      libtoolize_opt=-i;;
    51         esac
    52         CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
    53         touch .autotools.ct-ng
    54     fi
    55     CT_Popd
    56 }
    57 
    58 do_mpfr() {
    59     mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    60     cd "${CT_BUILD_DIR}/build-mpfr"
    61 
    62     CT_DoStep INFO "Installing MPFR"
    63 
    64     CT_DoLog EXTRA "Configuring MPFR"
    65     CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
    66     CT_DoExecLog ALL                            \
    67     "${CT_SRC_DIR}/${CT_MPFR_FILE}/configure"   \
    68         --build=${CT_BUILD}                     \
    69         --host=${CT_HOST}                       \
    70         --prefix="${CT_PREFIX_DIR}"             \
    71         --enable-thread-safe                    \
    72         --disable-shared --enable-static        \
    73         --with-gmp="${CT_PREFIX_DIR}"
    74 
    75     CT_DoLog EXTRA "Building MPFR"
    76     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    77 
    78     if [ "${CT_MPFR_CHECK}" = "y" ]; then
    79         CT_DoLog EXTRA "Checking MPFR"
    80         CT_DoExecLog ALL make ${PARALLELMFLAGS} -s check
    81     fi
    82 
    83     CT_DoLog EXTRA "Installing MPFR"
    84     CT_DoExecLog ALL make install
    85 
    86     CT_EndStep
    87 }
    88 
    89 if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
    90 
    91 do_mpfr_target() {
    92     mkdir -p "${CT_BUILD_DIR}/build-mpfr-target"
    93     cd "${CT_BUILD_DIR}/build-mpfr-target"
    94 
    95     CT_DoStep INFO "Installing MPFR for the target"
    96 
    97     CT_DoLog EXTRA "Configuring MPFR"
    98     CFLAGS="${CT_CFLAGS_FOR_TARGET}"            \
    99     CT_DoExecLog ALL                            \
   100     "${CT_SRC_DIR}/${CT_MPFR_FILE}/configure"   \
   101         --build=${CT_BUILD}                     \
   102         --host=${CT_TARGET}                     \
   103         --prefix=/usr                           \
   104         --enable-thread-safe                    \
   105         --disable-shared --enable-static        \
   106         --with-gmp="${CT_SYSROOT_DIR}/usr"
   107 
   108     CT_DoLog EXTRA "Building MPFR"
   109     CT_DoExecLog ALL make ${PARALLELMFLAGS}
   110 
   111     # Not possible to check MPFR while X-compiling
   112 
   113     CT_DoLog EXTRA "Installing MPFR"
   114     CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
   115 
   116     CT_EndStep
   117 }
   118 
   119 fi # CT_GMP_MPFR_TARGET == y
   120 
   121 fi # CT_GMP_MPFR == y