scripts/build/mpfr.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Apr 20 21:10:03 2009 +0000 (2009-04-20)
changeset 1299 3448ac3f1a5d
parent 1290 108eaf22653b
child 1456 94fc77c37418
permissions -rw-r--r--
There's no longer any reason to require GNU awk:
- the only part that required it (socks proxy settings) is gone,
- all remaining awk scripts are POSIXly correct (or should be).

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