2009-05-25 18:22:26 +00:00
|
|
|
# This file adds the functions to build the MPC library
|
|
|
|
# Copyright 2009 Yann E. MORIN
|
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
|
|
|
|
do_mpc_get() { :; }
|
|
|
|
do_mpc_extract() { :; }
|
2011-07-24 21:53:14 +00:00
|
|
|
do_mpc_for_build() { :; }
|
2011-07-17 16:56:30 +00:00
|
|
|
do_mpc_for_host() { :; }
|
2015-11-05 23:49:19 +00:00
|
|
|
do_mpc_for_target() { :; }
|
2009-05-25 18:22:26 +00:00
|
|
|
|
|
|
|
# Overide functions depending on configuration
|
2010-02-17 22:47:47 +00:00
|
|
|
if [ "${CT_MPC}" = "y" ]; then
|
2009-05-25 18:22:26 +00:00
|
|
|
|
|
|
|
# Download MPC
|
|
|
|
do_mpc_get() {
|
|
|
|
CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz \
|
2015-04-26 15:09:08 +00:00
|
|
|
{http,ftp,https}://ftp.gnu.org/gnu/mpc \
|
|
|
|
http://www.multiprecision.org/mpc/download
|
2009-05-25 18:22:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract MPC
|
|
|
|
do_mpc_extract() {
|
|
|
|
CT_Extract "mpc-${CT_MPC_VERSION}"
|
2010-04-11 21:18:10 +00:00
|
|
|
CT_Patch "mpc" "${CT_MPC_VERSION}"
|
2009-05-25 18:22:26 +00:00
|
|
|
}
|
|
|
|
|
2011-07-24 21:53:14 +00:00
|
|
|
# Build MPC for running on build
|
|
|
|
# - always build statically
|
|
|
|
# - install in build-tools prefix
|
|
|
|
do_mpc_for_build() {
|
|
|
|
local -a mpc_opts
|
|
|
|
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
native|cross) return 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing MPC for build"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
mpc_opts+=( "host=${CT_BUILD}" )
|
|
|
|
mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
mpc_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
|
|
mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
2011-07-24 21:53:14 +00:00
|
|
|
do_mpc_backend "${mpc_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
# Build MPC for running on host
|
|
|
|
do_mpc_for_host() {
|
|
|
|
local -a mpc_opts
|
2009-05-25 18:22:26 +00:00
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_DoStep INFO "Installing MPC for host"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
|
|
|
|
|
|
|
|
mpc_opts+=( "host=${CT_HOST}" )
|
2011-07-25 17:04:17 +00:00
|
|
|
mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
mpc_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
do_mpc_backend "${mpc_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build MPC
|
|
|
|
# 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_mpc_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
|
2009-05-25 18:22:26 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring MPC"
|
2010-04-10 22:47:23 +00:00
|
|
|
|
2010-10-22 20:02:57 +00:00
|
|
|
CT_DoExecLog CFG \
|
2011-07-17 16:56:30 +00:00
|
|
|
CFLAGS="${cflags}" \
|
2012-11-16 14:25:57 +00:00
|
|
|
LDFLAGS="${ldflags}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
2009-05-25 18:22:26 +00:00
|
|
|
"${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
2011-07-17 16:56:30 +00:00
|
|
|
--host=${host} \
|
|
|
|
--prefix="${prefix}" \
|
|
|
|
--with-gmp="${prefix}" \
|
|
|
|
--with-mpfr="${prefix}" \
|
2011-04-06 20:30:57 +00:00
|
|
|
--disable-shared \
|
|
|
|
--enable-static
|
2009-05-25 18:22:26 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building MPC"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
2009-05-25 18:22:26 +00:00
|
|
|
|
2010-04-10 21:42:28 +00:00
|
|
|
if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
|
2017-02-11 20:49:48 +00:00
|
|
|
if [ "${host}" = "${CT_BUILD}" ]; then
|
|
|
|
CT_DoLog EXTRA "Checking MPC"
|
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} -s check
|
|
|
|
else
|
|
|
|
# Cannot run host binaries on build in a canadian cross
|
|
|
|
CT_DoLog EXTRA "Skipping check for MPC on the host"
|
|
|
|
fi
|
2009-05-25 18:22:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing MPC"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2009-05-25 18:22:26 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 22:47:47 +00:00
|
|
|
fi # CT_MPC
|