scripts/build/companion_libs/mpfr.sh
changeset 3115 1c68438f44f7
parent 3114 8453ccdc5098
child 3116 f7a40ba0b651
     1.1 --- a/scripts/build/companion_libs/mpfr.sh	Thu Nov 15 20:51:31 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,152 +0,0 @@
     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_for_build() { :; }
    1.11 -do_mpfr_for_host() { :; }
    1.12 -
    1.13 -# Overide function depending on configuration
    1.14 -if [ "${CT_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 -        2.4.*)
    1.37 -            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
    1.38 -            if [ ! -f .autoreconf.ct-ng ]; then
    1.39 -                CT_DoLog DEBUG "Running autoreconf"
    1.40 -                CT_DoExecLog ALL autoreconf
    1.41 -                touch .autoreconf.ct-ng
    1.42 -            fi
    1.43 -            CT_Popd
    1.44 -            ;;
    1.45 -        1.*|2.0.*|2.1.*|2.2.*|2.3.*)
    1.46 -            CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
    1.47 -            if [ ! -f .autotools.ct-ng ]; then
    1.48 -                CT_DoLog DEBUG "Re-building autotools files"
    1.49 -                CT_DoExecLog ALL autoreconf -fi
    1.50 -                # Starting with libtool-1.9f, config.{guess,sub} are no longer
    1.51 -                # installed without -i, but starting with libtool-2.2.6, they
    1.52 -                # are no longer removed without -i. Sight... Just use -i with
    1.53 -                # libtool >=2
    1.54 -                # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
    1.55 -                # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
    1.56 -                libtoolize_opt=
    1.57 -                case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
    1.58 -                    0.*)    ;;
    1.59 -                    1.*)    ;;
    1.60 -                    *)      libtoolize_opt=-i;;
    1.61 -                esac
    1.62 -                CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
    1.63 -                touch .autotools.ct-ng
    1.64 -            fi
    1.65 -            CT_Popd
    1.66 -            ;;
    1.67 -    esac
    1.68 -}
    1.69 -
    1.70 -# Build MPFR for running on build
    1.71 -# - always build statically
    1.72 -# - we do not have build-specific CFLAGS
    1.73 -# - install in build-tools prefix
    1.74 -do_mpfr_for_build() {
    1.75 -    local -a mpfr_opts
    1.76 -
    1.77 -    case "${CT_TOOLCHAIN_TYPE}" in
    1.78 -        native|cross)   return 0;;
    1.79 -    esac
    1.80 -
    1.81 -    CT_DoStep INFO "Installing MPFR for build"
    1.82 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-build-${CT_BUILD}"
    1.83 -
    1.84 -    mpfr_opts+=( "host=${CT_BUILD}" )
    1.85 -    mpfr_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.86 -    do_mpfr_backend "${mpfr_opts[@]}"
    1.87 -
    1.88 -    CT_Popd
    1.89 -    CT_EndStep
    1.90 -}
    1.91 -
    1.92 -# Build MPFR for running on host
    1.93 -do_mpfr_for_host() {
    1.94 -    local -a mpfr_opts
    1.95 -
    1.96 -    CT_DoStep INFO "Installing MPFR for host"
    1.97 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
    1.98 -
    1.99 -    mpfr_opts+=( "host=${CT_HOST}" )
   1.100 -    mpfr_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
   1.101 -    mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
   1.102 -    do_mpfr_backend "${mpfr_opts[@]}"
   1.103 -
   1.104 -    CT_Popd
   1.105 -    CT_EndStep
   1.106 -}
   1.107 -
   1.108 -# Build MPFR
   1.109 -#     Parameter     : description               : type      : default
   1.110 -#     host          : machine to run on         : tuple     : (none)
   1.111 -#     prefix        : prefix to install into    : dir       : (none)
   1.112 -#     cflags        : host cflags to use        : string    : (empty)
   1.113 -do_mpfr_backend() {
   1.114 -    local host
   1.115 -    local prefix
   1.116 -    local cflags
   1.117 -    local arg
   1.118 -
   1.119 -    for arg in "$@"; do
   1.120 -        eval "${arg// /\\ }"
   1.121 -    done
   1.122 -
   1.123 -    # Under Cygwin, we can't build a thread-safe library
   1.124 -    case "${CT_HOST}" in
   1.125 -        *cygwin*)   mpfr_opts+=( --disable-thread-safe );;
   1.126 -        *mingw*)    mpfr_opts+=( --disable-thread-safe );;
   1.127 -        *darwin*)   mpfr_opts+=( --disable-thread-safe );;
   1.128 -        *)          mpfr_opts+=( --enable-thread-safe  );;
   1.129 -    esac
   1.130 -
   1.131 -    CT_DoLog EXTRA "Configuring MPFR"
   1.132 -    CT_DoExecLog CFG                                    \
   1.133 -    CC="${host}-gcc"                                    \
   1.134 -    CFLAGS="${CT_CFLAGS_FOR_HOST}"                      \
   1.135 -    "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure"   \
   1.136 -        --build=${CT_BUILD}                             \
   1.137 -        --host=${host}                                  \
   1.138 -        --prefix="${prefix}"                            \
   1.139 -        --with-gmp="${prefix}"                          \
   1.140 -        --disable-shared                                \
   1.141 -        --enable-static
   1.142 -
   1.143 -    CT_DoLog EXTRA "Building MPFR"
   1.144 -    CT_DoExecLog ALL make ${JOBSFLAGS}
   1.145 -
   1.146 -    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   1.147 -        CT_DoLog EXTRA "Checking MPFR"
   1.148 -        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   1.149 -    fi
   1.150 -
   1.151 -    CT_DoLog EXTRA "Installing MPFR"
   1.152 -    CT_DoExecLog ALL make install
   1.153 -}
   1.154 -
   1.155 -fi # CT_MPFR