mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-18 20:37:56 +00:00
Make companion libs static.
This follows the trend set by 1*.sh scripts that configure ISL, GMP, MPFR, CLooG, etc. Building with shared libraries presents all kinds of problems: - The shared libraries need to be installed into ${CT_PREFIX_DIR}. - The binaries linked against companion libs need to have proper RPATH, or they're looking for shared libs in .build/${CT_PREFIX}/buildtools/lib. - All libraries must agree as to whether they're built shared, static, or both. Otherwise, gettext tries to link in static libncurses.a into a shared library and fails (since libncurses was compiled without the -fPIC switch and hence contains relocations that cannot be handled in a shared library). So this fixes the current mess. If we decide to re-enable building the companion libs shared, we should probably make this dependent on a separate suboption of CT_STATIC_TOOLCHAIN. Add a config loosely based on one reported in the issue 274. Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
da3f8c4ec5
commit
3dbb576c17
@ -0,0 +1,26 @@
|
||||
CT_EXPERIMENTAL=y
|
||||
CT_LOCAL_TARBALLS_DIR="${HOME}/src"
|
||||
CT_SAVE_TARBALLS=y
|
||||
CT_LOG_EXTRA=y
|
||||
CT_ARCH_CPU="cortex-a9"
|
||||
CT_ARCH_FPU="neon"
|
||||
CT_ARCH_FLOAT_HW=y
|
||||
CT_ARCH_arm=y
|
||||
CT_TARGET_VENDOR="cortexa9_neon"
|
||||
CT_CANADIAN=y
|
||||
CT_HOST="x86_64-w64-mingw32"
|
||||
CT_TOOLCHAIN_ENABLE_NLS=y
|
||||
CT_KERNEL_linux=y
|
||||
CT_BINUTILS_LINKER_LD_GOLD=y
|
||||
CT_BINUTILS_GOLD_THREADS=y
|
||||
CT_BINUTILS_LD_WRAPPER=y
|
||||
CT_LIBC_ADDONS_LIST="libidn"
|
||||
CT_LIBC_LOCALES=y
|
||||
CT_LIBC_GLIBC_KERNEL_VERSION_NONE=y
|
||||
CT_CC_GCC_SHOW_LINARO=y
|
||||
# CT_CC_GCC_ENABLE_TARGET_OPTSPACE is not set
|
||||
CT_CC_LANG_CXX=y
|
||||
CT_DEBUG_gdb=y
|
||||
# CT_GDB_CROSS_PYTHON is not set
|
||||
CT_GDB_NATIVE=y
|
||||
CT_GDB_NATIVE_STATIC=y
|
@ -0,0 +1,3 @@
|
||||
reporter_name="modbw"
|
||||
reporter_url=""
|
||||
reporter_comment="Loosely based on config submitted in issue 274"
|
@ -87,7 +87,7 @@ do_libelf_for_target() {
|
||||
libelf_opts+=( "host=${CT_TARGET}" )
|
||||
|
||||
libelf_opts+=( "prefix=${prefix}" )
|
||||
libelf_opts+=( "shared=y" )
|
||||
libelf_opts+=( "shared=${CT_SHARED_LIBS}" )
|
||||
do_libelf_backend "${libelf_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
|
@ -31,7 +31,6 @@ do_expat_for_host() {
|
||||
expat_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
||||
expat_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
expat_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
expat_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
|
||||
|
||||
do_expat_backend "${expat_opts[@]}"
|
||||
|
||||
@ -59,7 +58,7 @@ do_expat_for_target() {
|
||||
esac
|
||||
expat_opts+=( "prefix=${prefix}" )
|
||||
expat_opts+=( "destdir=${CT_SYSROOT_DIR}" )
|
||||
expat_opts+=( "static_build=y" )
|
||||
expat_opts+=( "shared=${CT_SHARED_LIBS}" )
|
||||
|
||||
do_expat_backend "${expat_opts[@]}"
|
||||
|
||||
@ -78,6 +77,7 @@ do_expat_backend() {
|
||||
local prefix
|
||||
local cflags
|
||||
local ldflags
|
||||
local shared
|
||||
local arg
|
||||
local -a extra_config
|
||||
|
||||
@ -85,9 +85,8 @@ do_expat_backend() {
|
||||
eval "${arg// /\\ }"
|
||||
done
|
||||
|
||||
if [ "${static_build}" = "y" ]; then
|
||||
if [ "${shared}" != "y" ]; then
|
||||
extra_config+=("--disable-shared")
|
||||
extra_config+=("--enable-static")
|
||||
fi
|
||||
|
||||
CT_DoLog EXTRA "Configuring expat"
|
||||
@ -99,6 +98,7 @@ do_expat_backend() {
|
||||
--build=${CT_BUILD} \
|
||||
--host=${host} \
|
||||
--prefix="${prefix}" \
|
||||
--enable-static \
|
||||
"${extra_config[@]}"
|
||||
|
||||
CT_DoLog EXTRA "Building expat"
|
||||
|
@ -90,6 +90,7 @@ do_ncurses_for_target() {
|
||||
do_ncurses_backend host="${CT_TARGET}" \
|
||||
prefix="${prefix}" \
|
||||
destdir="${CT_SYSROOT_DIR}" \
|
||||
shared="${CT_SHARED_LIBS}" \
|
||||
"${opts[@]}"
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
@ -102,6 +103,7 @@ fi
|
||||
# prefix : prefix to install into : dir : (none)
|
||||
# cflags : cflags to use : string : (empty)
|
||||
# ldflags : ldflags to use : string : (empty)
|
||||
# shared : build shared lib : bool : n
|
||||
# --* : passed to configure : n/a : n/a
|
||||
do_ncurses_backend() {
|
||||
local -a ncurses_opts
|
||||
@ -109,6 +111,7 @@ do_ncurses_backend() {
|
||||
local prefix
|
||||
local cflags
|
||||
local ldflags
|
||||
local shared
|
||||
local arg
|
||||
local for_target
|
||||
|
||||
@ -127,7 +130,7 @@ do_ncurses_backend() {
|
||||
ncurses_opts+=("--with-abi-version=5")
|
||||
fi
|
||||
|
||||
case "$host" in
|
||||
case "${host}" in
|
||||
*-*-mingw*)
|
||||
# Needed to build for mingw, see
|
||||
# http://lists.gnu.org/archive/html/info-gnu/2011-02/msg00020.html
|
||||
@ -136,6 +139,10 @@ do_ncurses_backend() {
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${shared}" = "y" ]; then
|
||||
ncurses_opts+=("--with-shared")
|
||||
fi
|
||||
|
||||
CT_DoLog EXTRA "Configuring ncurses"
|
||||
CT_DoExecLog CFG \
|
||||
CFLAGS="${cflags}" \
|
||||
@ -145,6 +152,7 @@ do_ncurses_backend() {
|
||||
--host=${host} \
|
||||
--prefix="${prefix}" \
|
||||
--with-install-prefix="${destdir}" \
|
||||
--without-debug \
|
||||
--enable-termcap \
|
||||
"${ncurses_opts[@]}"
|
||||
|
||||
|
@ -35,7 +35,6 @@ do_libiconv_for_build() {
|
||||
libiconv_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
||||
libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
||||
libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
||||
libiconv_opts+=( "static_build=y" )
|
||||
do_libiconv_backend "${libiconv_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
@ -46,12 +45,6 @@ do_libiconv_for_build() {
|
||||
do_libiconv_for_host() {
|
||||
local -a libiconv_opts
|
||||
|
||||
case "$CT_HOST" in
|
||||
*darwin*|*linux*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
CT_DoStep INFO "Installing libiconv for host"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libiconv-host-${CT_HOST}"
|
||||
|
||||
@ -59,7 +52,6 @@ do_libiconv_for_host() {
|
||||
libiconv_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
||||
libiconv_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
libiconv_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
libiconv_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
|
||||
do_libiconv_backend "${libiconv_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
@ -70,13 +62,13 @@ do_libiconv_for_host() {
|
||||
# Parameter : description : type : default
|
||||
# host : machine to run on : tuple : (none)
|
||||
# prefix : prefix to install into : dir : (none)
|
||||
# static_build : build statically : bool : no
|
||||
# shared : build shared lib : bool : no
|
||||
# cflags : host cflags to use : string : (empty)
|
||||
# ldflags : host ldflags to use : string : (empty)
|
||||
do_libiconv_backend() {
|
||||
local host
|
||||
local prefix
|
||||
local static_build
|
||||
local shared
|
||||
local cflags
|
||||
local ldflags
|
||||
local arg
|
||||
@ -88,11 +80,8 @@ do_libiconv_backend() {
|
||||
|
||||
CT_DoLog EXTRA "Configuring libiconv"
|
||||
|
||||
CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/libiconv-${CT_LIBICONV_VERSION}/." "."
|
||||
|
||||
if [ "${static_build}" = "y" ]; then
|
||||
if [ "${shared}" != "y" ]; then
|
||||
extra_config+=("--disable-shared")
|
||||
extra_config+=("--enable-static")
|
||||
fi
|
||||
|
||||
CT_DoExecLog CFG \
|
||||
@ -102,6 +91,7 @@ do_libiconv_backend() {
|
||||
--build=${CT_BUILD} \
|
||||
--host="${host}" \
|
||||
--prefix="${prefix}" \
|
||||
--enable-static \
|
||||
--disable-nls \
|
||||
"${extra_config[@]}" \
|
||||
|
||||
|
@ -35,7 +35,6 @@ do_gettext_for_build() {
|
||||
gettext_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
||||
gettext_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
||||
gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
||||
gettext_opts+=( "static_build=y" )
|
||||
do_gettext_backend "${gettext_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
@ -46,12 +45,6 @@ do_gettext_for_build() {
|
||||
do_gettext_for_host() {
|
||||
local -a gettext_opts
|
||||
|
||||
case "$CT_HOST" in
|
||||
*linux*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
CT_DoStep INFO "Installing gettext for host"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gettext-host-${CT_HOST}"
|
||||
|
||||
@ -59,7 +52,6 @@ do_gettext_for_host() {
|
||||
gettext_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
||||
gettext_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
gettext_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
gettext_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
|
||||
do_gettext_backend "${gettext_opts[@]}"
|
||||
|
||||
CT_Popd
|
||||
@ -70,13 +62,13 @@ do_gettext_for_host() {
|
||||
# Parameter : description : type : default
|
||||
# host : machine to run on : tuple : (none)
|
||||
# prefix : prefix to install into : dir : (none)
|
||||
# static_build : build statically : bool : no
|
||||
# shared : build shared lib : bool : no
|
||||
# cflags : host cflags to use : string : (empty)
|
||||
# ldflags : host ldflags to use : string : (empty)
|
||||
do_gettext_backend() {
|
||||
local host
|
||||
local prefix
|
||||
local static_build
|
||||
local shared
|
||||
local cflags
|
||||
local ldflags
|
||||
local arg
|
||||
@ -88,14 +80,15 @@ do_gettext_backend() {
|
||||
|
||||
CT_DoLog EXTRA "Configuring gettext"
|
||||
|
||||
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/gettext-${CT_GETTEXT_VERSION}/." .
|
||||
|
||||
# A bit ugly. D__USE_MINGW_ANSI_STDIO=1 has its own {v}asprintf functions
|
||||
# but gettext configure doesn't see this flag when it checks for that. An
|
||||
# alternative may be to use CC="${host}-gcc ${cflags}" but that didn't
|
||||
# work.
|
||||
# -O2 works around bug at http://savannah.gnu.org/bugs/?36443
|
||||
# gettext needs some fixing for MinGW-w64 it would seem.
|
||||
# -DLIBXML_STATIC needed to link with libxml (provided by gnulib) under
|
||||
# MinGW: without this flag, xmlFree is defined as `dllimport` by libxml
|
||||
# headers and hence fails to link.
|
||||
case "${host}" in
|
||||
*mingw*)
|
||||
case "${cflags}" in
|
||||
@ -104,13 +97,12 @@ do_gettext_backend() {
|
||||
;;
|
||||
esac
|
||||
extra_config+=( --enable-threads=win32 )
|
||||
cflags=$cflags" -O2"
|
||||
cflags=$cflags" -O2 -DLIBXML_STATIC"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${static_build}" = "y" ]; then
|
||||
if [ "${shared}" != "y" ]; then
|
||||
extra_config+=("--disable-shared")
|
||||
extra_config+=("--enable-static")
|
||||
fi
|
||||
|
||||
CT_DoExecLog CFG \
|
||||
@ -120,6 +112,7 @@ do_gettext_backend() {
|
||||
--build=${CT_BUILD} \
|
||||
--host="${host}" \
|
||||
--prefix="${prefix}" \
|
||||
--enable-static \
|
||||
--disable-java \
|
||||
--disable-native-java \
|
||||
--disable-csharp \
|
||||
|
Loading…
Reference in New Issue
Block a user