2008-04-30 10:43:41 +00:00
|
|
|
# This file adds the functions to build the MPFR library
|
|
|
|
# Copyright 2008 Yann E. MORIN
|
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
do_mpfr_get() { :; }
|
|
|
|
do_mpfr_extract() { :; }
|
2011-07-24 21:53:14 +00:00
|
|
|
do_mpfr_for_build() { :; }
|
2011-07-17 16:56:30 +00:00
|
|
|
do_mpfr_for_host() { :; }
|
2015-11-05 23:49:19 +00:00
|
|
|
do_mpfr_for_target() { :; }
|
2008-06-20 15:16:43 +00:00
|
|
|
|
|
|
|
# Overide function depending on configuration
|
2010-08-23 21:18:49 +00:00
|
|
|
if [ "${CT_MPFR}" = "y" ]; then
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
# Download MPFR
|
|
|
|
do_mpfr_get() {
|
2014-12-08 23:03:08 +00:00
|
|
|
CT_GetFile "mpfr-${CT_MPFR_VERSION}" \
|
2015-11-12 01:18:27 +00:00
|
|
|
{https,http,ftp}://ftp.gnu.org/gnu/mpfr \
|
|
|
|
http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract MPFR
|
|
|
|
do_mpfr_extract() {
|
2009-01-05 23:02:43 +00:00
|
|
|
CT_Extract "mpfr-${CT_MPFR_VERSION}"
|
2010-04-11 21:18:10 +00:00
|
|
|
CT_Patch "mpfr" "${CT_MPFR_VERSION}"
|
2008-04-30 10:43:41 +00:00
|
|
|
|
2008-06-19 21:54:57 +00:00
|
|
|
# OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
|
|
|
|
# same version number. Unfortunately, some tarballs of MPFR are not
|
|
|
|
# built sanely, and thus ./configure fails on Gentoo.
|
|
|
|
# See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
|
|
|
|
# and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
|
2008-06-20 10:58:45 +00:00
|
|
|
# This hack is not bad per se, but the MPFR guys would be better not to
|
2008-06-19 21:54:57 +00:00
|
|
|
# do that in the future...
|
2009-03-08 22:13:27 +00:00
|
|
|
# It seems that MPFR >= 2.4.0 do not need this...
|
|
|
|
case "${CT_MPFR_VERSION}" in
|
2010-04-10 20:45:36 +00:00
|
|
|
2.4.*)
|
2009-08-02 22:49:25 +00:00
|
|
|
CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
|
|
|
|
if [ ! -f .autoreconf.ct-ng ]; then
|
|
|
|
CT_DoLog DEBUG "Running autoreconf"
|
2010-04-12 22:43:09 +00:00
|
|
|
CT_DoExecLog ALL autoreconf
|
2009-08-02 22:49:25 +00:00
|
|
|
touch .autoreconf.ct-ng
|
|
|
|
fi
|
|
|
|
CT_Popd
|
|
|
|
;;
|
2009-03-08 22:13:27 +00:00
|
|
|
1.*|2.0.*|2.1.*|2.2.*|2.3.*)
|
|
|
|
CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
|
|
|
|
if [ ! -f .autotools.ct-ng ]; then
|
|
|
|
CT_DoLog DEBUG "Re-building autotools files"
|
|
|
|
CT_DoExecLog ALL autoreconf -fi
|
|
|
|
# Starting with libtool-1.9f, config.{guess,sub} are no longer
|
|
|
|
# installed without -i, but starting with libtool-2.2.6, they
|
|
|
|
# are no longer removed without -i. Sight... Just use -i with
|
|
|
|
# libtool >=2
|
|
|
|
# See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
|
|
|
|
# and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
|
|
|
|
libtoolize_opt=
|
2016-11-21 07:50:17 +00:00
|
|
|
case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
|
2009-03-08 22:13:27 +00:00
|
|
|
0.*) ;;
|
|
|
|
1.*) ;;
|
|
|
|
*) libtoolize_opt=-i;;
|
|
|
|
esac
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
|
2009-03-08 22:13:27 +00:00
|
|
|
touch .autotools.ct-ng
|
|
|
|
fi
|
|
|
|
CT_Popd
|
|
|
|
;;
|
|
|
|
esac
|
2008-06-20 09:17:06 +00:00
|
|
|
}
|
|
|
|
|
2011-07-24 21:53:14 +00:00
|
|
|
# Build MPFR for running on build
|
|
|
|
# - always build statically
|
|
|
|
# - we do not have build-specific CFLAGS
|
|
|
|
# - install in build-tools prefix
|
|
|
|
do_mpfr_for_build() {
|
|
|
|
local -a mpfr_opts
|
|
|
|
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
native|cross) return 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing MPFR for build"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
mpfr_opts+=( "host=${CT_BUILD}" )
|
|
|
|
mpfr_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
|
|
mpfr_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
2011-07-24 21:53:14 +00:00
|
|
|
do_mpfr_backend "${mpfr_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
# Build MPFR for running on host
|
|
|
|
do_mpfr_for_host() {
|
|
|
|
local -a mpfr_opts
|
2008-06-20 09:17:06 +00:00
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_DoStep INFO "Installing MPFR for host"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
|
|
|
|
|
|
|
|
mpfr_opts+=( "host=${CT_HOST}" )
|
2011-07-25 17:04:17 +00:00
|
|
|
mpfr_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
mpfr_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
do_mpfr_backend "${mpfr_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build MPFR
|
|
|
|
# Parameter : description : type : default
|
|
|
|
# host : machine to run on : tuple : (none)
|
|
|
|
# prefix : prefix to install into : dir : (none)
|
2012-11-16 14:25:57 +00:00
|
|
|
# cflags : cflags to use : string : (empty)
|
|
|
|
# ldflags : ldflags to use : string : (empty)
|
2011-07-17 16:56:30 +00:00
|
|
|
do_mpfr_backend() {
|
|
|
|
local host
|
|
|
|
local prefix
|
|
|
|
local cflags
|
2012-11-16 14:25:57 +00:00
|
|
|
local ldflags
|
2011-07-17 16:56:30 +00:00
|
|
|
local arg
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
2008-06-19 21:54:57 +00:00
|
|
|
|
2009-03-08 22:13:27 +00:00
|
|
|
# Under Cygwin, we can't build a thread-safe library
|
2009-02-07 20:11:13 +00:00
|
|
|
case "${CT_HOST}" in
|
2010-04-10 22:47:23 +00:00
|
|
|
*cygwin*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*mingw*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*darwin*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*) mpfr_opts+=( --enable-thread-safe );;
|
2009-02-07 20:11:13 +00:00
|
|
|
esac
|
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
CT_DoLog EXTRA "Configuring MPFR"
|
2011-03-20 00:05:15 +00:00
|
|
|
CT_DoExecLog CFG \
|
2011-07-17 16:56:30 +00:00
|
|
|
CC="${host}-gcc" \
|
2012-11-16 14:25:57 +00:00
|
|
|
CFLAGS="${cflags}" \
|
|
|
|
LDFLAGS="${ldflags}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
2009-01-04 14:25:58 +00:00
|
|
|
"${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
2011-07-17 16:56:30 +00:00
|
|
|
--host=${host} \
|
|
|
|
--prefix="${prefix}" \
|
|
|
|
--with-gmp="${prefix}" \
|
2011-04-06 20:30:57 +00:00
|
|
|
--disable-shared \
|
|
|
|
--enable-static
|
2008-04-30 10:43:41 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building MPFR"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
2008-04-30 10:43:41 +00:00
|
|
|
|
2010-04-10 21:42:28 +00:00
|
|
|
if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
|
2008-04-30 10:43:41 +00:00
|
|
|
CT_DoLog EXTRA "Checking MPFR"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} -s check
|
2008-04-30 10:43:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing MPFR"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
fi # CT_MPFR
|