complibs: split companion libraries to backend/frontend, a-la cc_core

Move the actual complibs codes to backend functions that builds the
required combo of build/host/target as requested by a frontend.

This split is currently a no-op, but is required for the upcoming
canadian-cross rework, where we'll be needing to build the complibs
twice, one for build/build, and one for build/host.

This applies to the six companion libraries:
 - GMP
 - MPFR
 - PPL
 - Cloog/PPL
 - MPC
 - libelf

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-07-17 18:56:30 +02:00
parent 533e5c128c
commit 2e3cc45633
7 changed files with 249 additions and 117 deletions

View File

@ -4,7 +4,7 @@
do_cloog_get() { :; }
do_cloog_extract() { :; }
do_cloog() { :; }
do_cloog_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_CLOOG}" = "y" ]; then
@ -33,25 +33,49 @@ do_cloog_extract() {
fi
}
do_cloog() {
# Build CLooG/PPL for running on host
do_cloog_for_host() {
local -a cloog_opts
CT_DoStep INFO "Installing CLooG/PPL for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cloog-ppl-host-${CT_HOST}"
cloog_opts+=( "host=${CT_HOST}" )
cloog_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
cloog_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
do_cloog_backend "${cloog_opts[@]}"
CT_Popd
CT_EndStep
}
# Build ClooG/PPL
# Parameter : description : type : default
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# cflags : host cflags to use : string : (empty)
do_cloog_backend() {
local host
local prefix
local cflags
local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
local arg
mkdir -p "${CT_BUILD_DIR}/build-cloog-ppl"
cd "${CT_BUILD_DIR}/build-cloog-ppl"
CT_DoStep INFO "Installing CLooG/ppl"
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring CLooG/ppl"
CT_DoExecLog CFG \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CFLAGS="${cflags}" \
LIBS="-lm" \
"${cloog_src_dir}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_COMPLIBS_DIR}" \
--with-gmp="${CT_COMPLIBS_DIR}" \
--with-ppl="${CT_COMPLIBS_DIR}" \
--host=${host} \
--prefix="${prefix}" \
--with-gmp="${prefix}" \
--with-ppl="${prefix}" \
--with-bits=gmp \
--with-host-libstdcxx='-lstdc++' \
--disable-shared \
@ -67,8 +91,6 @@ do_cloog() {
CT_DoLog EXTRA "Installing CLooG/ppl"
CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
CT_EndStep
}
fi # CT_CLOOG

View File

@ -4,7 +4,7 @@
do_gmp_get() { :; }
do_gmp_extract() { :; }
do_gmp() { :; }
do_gmp_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_GMP}" = "y" ]; then
@ -20,20 +20,45 @@ do_gmp_extract() {
CT_Patch "gmp" "${CT_GMP_VERSION}"
}
do_gmp() {
mkdir -p "${CT_BUILD_DIR}/build-gmp"
cd "${CT_BUILD_DIR}/build-gmp"
# Build GMP for running on host
do_gmp_for_host() {
local -a gmp_opts
CT_DoStep INFO "Installing GMP"
CT_DoStep INFO "Installing GMP for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
gmp_opts+=( "host=${CT_HOST}" )
gmp_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
do_gmp_backend "${gmp_opts[@]}"
CT_Popd
CT_EndStep
}
# Build GMP
# Parameter : description : type : default
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# cflags : host cflags to use : string : (empty)
do_gmp_backend() {
local host
local prefix
local cflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring GMP"
CT_DoExecLog CFG \
CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \
CFLAGS="${cflags} -fexceptions" \
"${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_COMPLIBS_DIR}" \
--host=${host} \
--prefix="${prefix}" \
--enable-fft \
--enable-mpbsd \
--enable-cxx \
@ -50,8 +75,6 @@ do_gmp() {
CT_DoLog EXTRA "Installing GMP"
CT_DoExecLog ALL make install
CT_EndStep
}
fi # CT_GMP

View File

@ -2,7 +2,7 @@
do_libelf_get() { :; }
do_libelf_extract() { :; }
do_libelf() { :; }
do_libelf_for_host() { :; }
do_libelf_for_target() { :; }
if [ "${CT_LIBELF}" = "y" -o "${CT_LIBELF_TARGET}" = "y" ]; then
@ -21,32 +21,17 @@ do_libelf_extract() {
if [ "${CT_LIBELF}" = "y" ]; then
do_libelf() {
CT_DoStep INFO "Installing libelf"
mkdir -p "${CT_BUILD_DIR}/build-libelf"
CT_Pushd "${CT_BUILD_DIR}/build-libelf"
# Build libelf for running on host
do_libelf_for_host() {
local -a libelf_opts
CT_DoLog EXTRA "Configuring libelf"
CT_DoStep INFO "Installing libelf for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-host-${CT_HOST}"
CT_DoExecLog CFG \
CC="${CT_HOST}-gcc" \
CFLAGS="-fPIC" \
"${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--target=${CT_TARGET} \
--prefix="${CT_COMPLIBS_DIR}" \
--enable-compat \
--enable-elf64 \
--enable-extended-format \
--disable-shared \
--enable-static
CT_DoLog EXTRA "Building libelf"
CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing libelf"
CT_DoExecLog ALL make install
libelf_opts+=( "host=${CT_HOST}" )
libelf_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
libelf_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
do_libelf_backend "${libelf_opts[@]}"
CT_Popd
CT_EndStep
@ -57,31 +42,16 @@ fi # CT_LIBELF
if [ "${CT_LIBELF_TARGET}" = "y" ]; then
do_libelf_for_target() {
local -a libelf_opts
CT_DoStep INFO "Installing libelf for the target"
mkdir -p "${CT_BUILD_DIR}/build-libelf-for-target"
CT_Pushd "${CT_BUILD_DIR}/build-libelf-for-target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
CT_DoLog EXTRA "Configuring libelf"
CT_DoExecLog CFG \
CC="${CT_TARGET}-gcc" \
CFLAGS="-fPIC" \
RANLIB="${CT_TARGET}-ranlib" \
"${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--target=${CT_TARGET} \
--prefix=/usr \
--enable-compat \
--enable-elf64 \
--enable-shared \
--enable-extended-format \
--enable-static
CT_DoLog EXTRA "Building libelf"
CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing libelf"
CT_DoExecLog ALL make instroot="${CT_SYSROOT_DIR}" install
libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
libelf_opts+=( "host=${CT_TARGET}" )
libelf_opts+=( "prefix=/usr" )
libelf_opts+=( "shared=y" )
do_libelf_backend "${libelf_opts[@]}"
CT_Popd
CT_EndStep
@ -89,4 +59,54 @@ do_libelf_for_target() {
fi # CT_LIBELF_TARGET
# Build libelf
# Parameter : description : type : default
# destdir : out-of-tree install dir : string : /
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# cflags : host cflags to use : string : (empty)
# shared : also buils shared lib : bool : n
do_libelf_backend() {
local destdir="/"
local host
local prefix
local cflags
local shared
local -a extra_config
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring libelf"
if [ "${shared}" = "y" ]; then
extra_config+=( --enable-shared )
else
extra_config+=( --disable-shared )
fi
CT_DoExecLog CFG \
CC="${host}-gcc" \
RANLIB="${host}-ranlib" \
CFLAGS="${cflags} -fPIC" \
"${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${host} \
--target=${CT_TARGET} \
--prefix="${prefix}" \
--enable-compat \
--enable-elf64 \
--enable-extended-format \
--enable-static \
"${extra_config[@]}"
CT_DoLog EXTRA "Building libelf"
CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing libelf"
CT_DoExecLog ALL make instroot="${destdir}" install
}
fi # CT_LIBELF || CT_LIBELF_TARGET

View File

@ -4,7 +4,7 @@
do_mpc_get() { :; }
do_mpc_extract() { :; }
do_mpc() { :; }
do_mpc_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_MPC}" = "y" ]; then
@ -21,22 +21,47 @@ do_mpc_extract() {
CT_Patch "mpc" "${CT_MPC_VERSION}"
}
do_mpc() {
mkdir -p "${CT_BUILD_DIR}/build-mpc"
cd "${CT_BUILD_DIR}/build-mpc"
# Build MPC for running on host
do_mpc_for_host() {
local -a mpc_opts
CT_DoStep INFO "Installing MPC"
CT_DoStep INFO "Installing MPC for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
mpc_opts+=( "host=${CT_HOST}" )
mpc_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
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)
# cflags : host cflags to use : string : (empty)
do_mpc_backend() {
local host
local prefix
local cflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring MPC"
CT_DoExecLog CFG \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CFLAGS="${cflags}" \
"${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_COMPLIBS_DIR}" \
--with-gmp="${CT_COMPLIBS_DIR}" \
--with-mpfr="${CT_COMPLIBS_DIR}" \
--host=${host} \
--prefix="${prefix}" \
--with-gmp="${prefix}" \
--with-mpfr="${prefix}" \
--disable-shared \
--enable-static
@ -50,8 +75,6 @@ do_mpc() {
CT_DoLog EXTRA "Installing MPC"
CT_DoExecLog ALL make install
CT_EndStep
}
fi # CT_MPC

View File

@ -4,7 +4,7 @@
do_mpfr_get() { :; }
do_mpfr_extract() { :; }
do_mpfr() { :; }
do_mpfr_for_host() { :; }
# Overide function depending on configuration
if [ "${CT_MPFR}" = "y" ]; then
@ -63,11 +63,36 @@ do_mpfr_extract() {
esac
}
do_mpfr() {
mkdir -p "${CT_BUILD_DIR}/build-mpfr"
cd "${CT_BUILD_DIR}/build-mpfr"
# Build MPFR for running on host
do_mpfr_for_host() {
local -a mpfr_opts
CT_DoStep INFO "Installing MPFR"
CT_DoStep INFO "Installing MPFR for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}"
mpfr_opts+=( "host=${CT_HOST}" )
mpfr_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
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)
# cflags : host cflags to use : string : (empty)
do_mpfr_backend() {
local host
local prefix
local cflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
# Under Cygwin, we can't build a thread-safe library
case "${CT_HOST}" in
@ -77,16 +102,15 @@ do_mpfr() {
*) mpfr_opts+=( --enable-thread-safe );;
esac
CT_DoLog EXTRA "Configuring MPFR"
CT_DoExecLog CFG \
CC="${CT_HOST}-gcc" \
CC="${host}-gcc" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
"${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_COMPLIBS_DIR}" \
--with-gmp="${CT_COMPLIBS_DIR}" \
--host=${host} \
--prefix="${prefix}" \
--with-gmp="${prefix}" \
--disable-shared \
--enable-static
@ -100,8 +124,6 @@ do_mpfr() {
CT_DoLog EXTRA "Installing MPFR"
CT_DoExecLog ALL make install
CT_EndStep
}
fi # CT_MPFR

View File

@ -4,7 +4,7 @@
do_ppl_get() { :; }
do_ppl_extract() { :; }
do_ppl() { :; }
do_ppl_for_host() { :; }
# Overide functions depending on configuration
if [ "${CT_PPL}" = "y" ]; then
@ -23,25 +23,49 @@ do_ppl_extract() {
CT_Patch "ppl" "${CT_PPL_VERSION}"
}
do_ppl() {
mkdir -p "${CT_BUILD_DIR}/build-ppl"
cd "${CT_BUILD_DIR}/build-ppl"
# Build PPL for running on host
do_ppl_for_host() {
local -a ppl_opts
CT_DoStep INFO "Installing PPL"
CT_DoStep INFO "Installing PPL for host"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-ppl-host-${CT_HOST}"
ppl_opts+=( "host=${CT_HOST}" )
ppl_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
ppl_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
do_ppl_backend "${ppl_opts[@]}"
CT_Popd
CT_EndStep
}
# Build PPL
# Parameter : description : type : default
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# cflags : host cflags to use : string : (empty)
do_ppl_backend() {
local host
local prefix
local cflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring PPL"
CT_DoExecLog CFG \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CXXFLAGS="${CT_CFLAGS_FOR_HOST}" \
CFLAGS="${cflags}" \
CXXFLAGS="${cflags}" \
"${CT_SRC_DIR}/ppl-${CT_PPL_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_COMPLIBS_DIR}" \
--with-libgmp-prefix="${CT_COMPLIBS_DIR}" \
--with-libgmpxx-prefix="${CT_COMPLIBS_DIR}" \
--with-gmp-prefix="${CT_COMPLIBS_DIR}" \
--host=${host} \
--prefix="${prefix}" \
--with-libgmp-prefix="${prefix}" \
--with-libgmpxx-prefix="${prefix}" \
--with-gmp-prefix="${prefix}" \
--enable-watchdog \
--disable-debugging \
--disable-assertions \
@ -66,9 +90,7 @@ do_ppl() {
CT_DoExecLog ALL make install
# Remove spuriously installed file
CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/bin/ppl-config"
CT_EndStep
CT_DoExecLog ALL rm -f "${prefix}/bin/ppl-config"
}
fi # CT_PPL

View File

@ -17,12 +17,12 @@ help-env::
# Please keep the last line with a '\' and keep the following empy line:
# it helps when diffing and merging.
CT_STEPS := libc_check_config \
gmp \
mpfr \
ppl \
cloog \
mpc \
libelf \
gmp_for_host \
mpfr_for_host \
ppl_for_host \
cloog_for_host \
mpc_for_host \
libelf_for_host \
binutils_for_host \
elf2flt_for_host \
sstrip_for_host \