complibs: allow either static or shared build

This commit is contained in:
Yann E. MORIN" 2010-04-11 00:47:23 +02:00
parent 5b663e2aae
commit 5b27e8de52
8 changed files with 105 additions and 36 deletions

View File

@ -17,7 +17,6 @@ config WRAPPER_NEEDED
config GMP
bool
select COMPLIBS
select WRAPPER_NEEDED
help
gcc 4.3.0 and above requires GMP to build some frontends, and some
other components can use them as well.
@ -35,7 +34,6 @@ config MPFR
bool
select GMP
select COMPLIBS
select WRAPPER_NEEDED
help
gcc 4.3.0 and above requires MPFR to build some frontends, and some
other components can use them as well.
@ -54,7 +52,6 @@ config PPL
select GMP
select MPFR
select COMPLIBS
select WRAPPER_NEEDED
help
gcc-4.4.0 and above requires PPL to build some parts of the optimiser
(the GRAPHITE loop optimisation, to be precise).
@ -69,7 +66,6 @@ config CLOOG
select MPFR
select PPL
select COMPLIBS
select WRAPPER_NEEDED
help
gcc-4.4.0 and above requires CLooG/PPL to build some parts of the
optimiser (the GRAPHITE loop optimisation, to be precise).
@ -85,7 +81,6 @@ config MPC
select PPL
select CLOOG
select COMPLIBS
select WRAPPER_NEEDED
help
gcc-4.4.0 and above can also optionally use MPC to enable additional
optimisations on complex numbers. Although MPC is optional,
@ -98,7 +93,6 @@ config MPC
config LIBELF
bool
select COMPLIBS
select WRAPPER_NEEDED
help
gcc-4.5.0 and above can also use libelf to enable some optimisation
(LTO, Link-Time Optimisation, to be precise). Although libelf is
@ -170,14 +164,14 @@ endif
config FOO
bool
if COMPLIBS
comment "Companion libraries common options"
depends on COMPLIBS || WRAPPER_NEEDED
config COMPLIBS_CHECK
bool
prompt "| Check the companion libraries builds (!!! READ HELP!!!)"
prompt "Check the companion libraries builds (!!! READ HELP!!!)"
default n
depends on COMPLIBS
help
It is highly recommended to check the newly built companion libraries.
Unfortunately, this is a very intensive task, and takes a loooong time.
@ -192,6 +186,19 @@ config COMPLIBS_CHECK
building PPL on my machine takes roughly 1'40", while checking it takes
about 1h40'...
config COMPLIBS_SHARED
bool
prompt "Build shared companion libraries"
default n
depends on COMPLIBS
select WRAPPER_NEEDED
help
By default, the companion libraries will be build static. If you want to
build shared libraries, then you can say 'Y' here, but a wrapper will be
needed (see docs/overview.txt,section "Tools wrapper").
It is highly recommended that you keep static libraries.
choice
bool
prompt "| Install tools wrapper as:"
@ -223,4 +230,6 @@ config TOOLS_WRAPPER
default "script" if TOOLS_WRAPPER_SCRIPT
default "exec" if TOOLS_WRAPPER_EXEC
endif # COMPLIBS
endmenu

View File

@ -95,6 +95,7 @@ do_cc_core() {
local lang_opt
local tmp
local -a extra_config
local core_LDFLAGS
eval $1
eval $2
@ -162,10 +163,17 @@ do_cc_core() {
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
# When companion libraries are build static (eg !shared),
# the libstdc++ is not pulled automatically, although it
# is needed. Shoe-horn it in our LDFLAGS
if [ -z "${CT_COMPLIBS_SHARED}" ]; then
core_LDFLAGS='-lstdc++'
fi
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
CC_FOR_BUILD="${CT_BUILD}-gcc" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
LDFLAGS="-lstdc++" \
LDFLAGS="${core_LDFLAGS}" \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \
--build=${CT_BUILD} \
@ -257,6 +265,7 @@ do_cc_core() {
do_cc() {
local -a extra_config
local tmp
local final_LDFLAGS
# If building for bare metal, nothing to be done here, the static core conpiler is enough!
[ "${CT_BARE_METAL}" = "y" ] && return 0
@ -325,13 +334,20 @@ do_cc() {
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
# When companion libraries are build static (eg !shared),
# the libstdc++ is not pulled automatically, although it
# is needed. Shoe-horn it in our LDFLAGS
if [ -z "${CT_COMPLIBS_SHARED}" ]; then
final_LDFLAGS='-lstdc++'
fi
# --enable-symvers=gnu really only needed for sh4 to work around a
# detection problem only matters for gcc-3.2.x and later, I think.
# --disable-nls to work around crash bug on ppc405, but also because
# embedded systems don't really need message catalogs...
CC_FOR_BUILD="${CT_BUILD}-gcc" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
LDFLAGS="-lstdc++" \
LDFLAGS="${final_LDFLAGS}" \
CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \

View File

@ -35,6 +35,8 @@ do_cloog_extract() {
do_cloog() {
local _t
local cloog_LDFLAGS
local -a cloog_opts
# Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
# while versions 0.15.4 onward do have the version in the dirname.
@ -49,8 +51,16 @@ do_cloog() {
CT_DoStep INFO "Installing CLooG/ppl"
CT_DoLog EXTRA "Configuring CLooG/ppl"
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
cloog_opts+=( --enable-shared --disable-static )
else
cloog_opts+=( --disable-shared --enable-static )
cloog_LDFLAGS='-lstdc++'
fi
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
LDFLAGS='-lstdc++' \
LDFLAGS="${cloog_LDFLAGS}" \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/cloog-ppl${_t}/configure" \
--build=${CT_BUILD} \
@ -58,9 +68,8 @@ do_cloog() {
--prefix="${CT_PREFIX_DIR}" \
--with-gmp="${CT_PREFIX_DIR}" \
--with-ppl="${CT_PREFIX_DIR}" \
--disable-shared \
--enable-static \
--with-bits=gmp
--with-bits=gmp \
"${cloog_opts[@]}"
CT_DoLog EXTRA "Building CLooG/ppl"
CT_DoExecLog ALL make ${PARALLELMFLAGS}

View File

@ -24,6 +24,7 @@ do_gmp_extract() {
if [ "${CT_GMP}" = "y" ]; then
do_gmp() {
local -a gmp_opts
mkdir -p "${CT_BUILD_DIR}/build-gmp"
cd "${CT_BUILD_DIR}/build-gmp"
@ -32,17 +33,22 @@ do_gmp() {
CT_DoLog EXTRA "Configuring GMP"
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
gmp_opts+=( --enable-shared --disable-static )
else
gmp_opts+=( --disable-shared --enable-static )
fi
CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_PREFIX_DIR}" \
--disable-shared \
--enable-static \
--enable-fft \
--enable-mpbsd \
--enable-cxx
--enable-cxx \
"${gmp_opts[@]}"
CT_DoLog EXTRA "Building GMP"
CT_DoExecLog ALL make ${PARALLELMFLAGS}

View File

@ -24,12 +24,21 @@ if [ "${CT_LIBELF}" = "y" ]; then
# Uncomment when we need it for gcc-4.5
# WARNING! This function is absolutely UNTESTED yet!
do_libelf() {
: # Remove this line!
: # Remove this line! and uncomment the following lines
# local -a libelf_opts
#
# CT_DoStep INFO "Installing libelf"
# mkdir -p "${CT_BUILD_DIR}/build-libelf"
# CT_Pushd "${CT_BUILD_DIR}/build-libelf"
#
# CT_DoLog EXTRA "Configuring libelf"
#
# if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
# libelf_opts+=( --enable-shared --disable-static )
# else
# libelf_opts+=( --disable-shared --enable-static )
# fi
#
# CC="${CT_TARGET}-gcc" \
# CT_DoExecLog ALL \
# "${CT_SRC_DIR}/libelf-${CT_LIBELF_VERSION}/configure" \
@ -39,9 +48,8 @@ do_libelf() {
# --prefix="${CT_PREFIX_DIR}" \
# --enable-compat \
# --enable-elf64 \
# --enable-static \
# --enable-shared \
# --enable-extended-format
# --enable-extended-format \
# "${libelf_opts[@]}"
#
# CT_DoLog EXTRA "Building libelf"
# CT_DoExecLog ALL make

View File

@ -23,12 +23,21 @@ do_mpc_extract() {
}
do_mpc() {
local -a mpc_opts
mkdir -p "${CT_BUILD_DIR}/build-mpc"
cd "${CT_BUILD_DIR}/build-mpc"
CT_DoStep INFO "Installing MPC"
CT_DoLog EXTRA "Configuring MPC"
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
mpc_opts+=( --enable-shared --disable-static )
else
mpc_opts+=( --disable-shared --enable-static )
fi
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CT_DoExecLog ALL \
"${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
@ -37,8 +46,7 @@ do_mpc() {
--prefix="${CT_PREFIX_DIR}" \
--with-gmp="${CT_PREFIX_DIR}" \
--with-mpfr="${CT_PREFIX_DIR}" \
--disable-shared \
--enable-static
"${mpc_opts[@]}"
CT_DoLog EXTRA "Building MPC"
CT_DoExecLog ALL make ${PARALLELMFLAGS}

View File

@ -67,20 +67,27 @@ do_mpfr_extract() {
if [ "${CT_MPFR}" = "y" ]; then
do_mpfr() {
local -a mpfr_opts
mkdir -p "${CT_BUILD_DIR}/build-mpfr"
cd "${CT_BUILD_DIR}/build-mpfr"
CT_DoStep INFO "Installing MPFR"
mpfr_opt=
# Under Cygwin, we can't build a thread-safe library
case "${CT_HOST}" in
*cygwin*) mpfr_opt="--disable-thread-safe";;
*mingw*) mpfr_opt="--disable-thread-safe";;
*darwin*) mpfr_opt="--disable-thread-safe";;
*) mpfr_opt="--enable-thread-safe";;
*cygwin*) mpfr_opts+=( --disable-thread-safe );;
*mingw*) mpfr_opts+=( --disable-thread-safe );;
*darwin*) mpfr_opts+=( --disable-thread-safe );;
*) mpfr_opts+=( --enable-thread-safe );;
esac
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
mpfr_opts+=( --enable-shared --disable-static )
else
mpfr_opts+=( --disable-shared --enable-static )
fi
CT_DoLog EXTRA "Configuring MPFR"
CC="${CT_HOST}-gcc" \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
@ -89,10 +96,8 @@ do_mpfr() {
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_PREFIX_DIR}" \
${mpfr_opt} \
--disable-shared \
--enable-static \
--with-gmp="${CT_PREFIX_DIR}"
--with-gmp="${CT_PREFIX_DIR}" \
"${mpfr_opts[@]}"
CT_DoLog EXTRA "Building MPFR"
CT_DoExecLog ALL make ${PARALLELMFLAGS}

View File

@ -25,12 +25,21 @@ do_ppl_extract() {
}
do_ppl() {
local -a ppl_opts
mkdir -p "${CT_BUILD_DIR}/build-ppl"
cd "${CT_BUILD_DIR}/build-ppl"
CT_DoStep INFO "Installing PPL"
CT_DoLog EXTRA "Configuring PPL"
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
ppl_opts+=( --enable-shared --disable-static )
else
ppl_opts+=( --disable-shared --enable-static )
fi
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CXXFLAGS="${CT_CFLAGS_FOR_HOST}" \
CT_DoExecLog ALL \
@ -40,12 +49,11 @@ do_ppl() {
--prefix="${CT_PREFIX_DIR}" \
--with-libgmp-prefix="${CT_PREFIX_DIR}" \
--with-libgmpxx-prefix="${CT_PREFIX_DIR}" \
--disable-shared \
--enable-static \
--disable-debugging \
--disable-assertions \
--disable-ppl_lcdd \
--disable-ppl_lpsol
--disable-ppl_lpsol \
"${ppl_opts[@]}"
# Maybe-options:
# --enable-interfaces=...