# HG changeset patch # User "Yann E. MORIN" # Date 1302121857 -7200 # Node ID 0ca0f85a4b2a527a5b6936d46fd8500648eb4877 # Parent 40fe96dff39e57e11273e245f5446c631b24da23 complibs: disable building shared libs Managing the shared version of the companion libraries has become cumbersome. Also, it will one day be possible to use the companion libraries from the host distribution, and then we will be able to easily use either shared or static libs. As a side note, while working on the canadian-rework series, it has become quite more complex to properly handle shared companion libraries, as they need to be built both for the build and gost systems. That's not easy to handle. At all. Signed-off-by: "Yann E. MORIN" diff -r 40fe96dff39e -r 0ca0f85a4b2a config/companion_libs.in --- a/config/companion_libs.in Wed Apr 06 21:34:22 2011 +0200 +++ b/config/companion_libs.in Wed Apr 06 22:30:57 2011 +0200 @@ -48,10 +48,6 @@ bool default n -config WRAPPER_NEEDED - bool - default n - config GMP bool select COMPLIBS @@ -113,11 +109,6 @@ comment "Companion libraries common options" -config COMPLIBS_BACKUP - bool - default y - depends on ! COMPLIBS_SHARED - config COMPLIBS_CHECK bool prompt "Check the companion libraries builds (!!! READ HELP!!!)" @@ -136,52 +127,6 @@ 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 - depends on ! STATIC_TOOLCHAIN - 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/4 - Building the toolchain.txt", in the section - "Tools wrapper"). - - It is highly recommended that you keep static libraries. - -choice - bool - prompt "| Install tools wrapper as:" - depends on WRAPPER_NEEDED - default TOOLS_WRAPPER_SHELL - -config TOOLS_WRAPPER_SCRIPT - bool - prompt "shell script" - help - If your host has a shell, then you should say 'Y' here, to use - a (very very simple) shell script as wrapper. - - See: "docs/4 - Building the toolchain.txt", in the section "Tools wrapper". - -config TOOLS_WRAPPER_EXEC - bool - prompt "executable" - help - If your host lacks a shell, then you should say 'Y' here, to use - an executable. - - See: "docs/4 - Building the toolchain.txt", in the section "Tools wrapper". - -endchoice - -config TOOLS_WRAPPER - string - default "script" if TOOLS_WRAPPER_SCRIPT - default "exec" if TOOLS_WRAPPER_EXEC - endif # COMPLIBS endmenu diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/cloog.sh --- a/scripts/build/companion_libs/cloog.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/cloog.sh Wed Apr 06 22:30:57 2011 +0200 @@ -37,8 +37,6 @@ 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. @@ -54,17 +52,9 @@ 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_opts+=( --with-host-libstdcxx='-lstdc++' ) - cloog_LDFLAGS='-lm' - fi - CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ - LDFLAGS="${cloog_LDFLAGS}" \ + LDFLAGS="-lm" \ "${CT_SRC_DIR}/cloog-ppl${_t}/configure" \ --build=${CT_BUILD} \ --host=${CT_HOST} \ @@ -72,7 +62,9 @@ --with-gmp="${CT_COMPLIBS_DIR}" \ --with-ppl="${CT_COMPLIBS_DIR}" \ --with-bits=gmp \ - "${cloog_opts[@]}" + --with-host-libstdcxx='-lstdc++' \ + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building CLooG/ppl" CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/gmp.sh --- a/scripts/build/companion_libs/gmp.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/gmp.sh Wed Apr 06 22:30:57 2011 +0200 @@ -21,8 +21,6 @@ } do_gmp() { - local -a gmp_opts - mkdir -p "${CT_BUILD_DIR}/build-gmp" cd "${CT_BUILD_DIR}/build-gmp" @@ -30,12 +28,6 @@ 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 - CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \ "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \ @@ -45,7 +37,8 @@ --enable-fft \ --enable-mpbsd \ --enable-cxx \ - "${gmp_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building GMP" CT_DoExecLog ALL make ${JOBSFLAGS} diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/libelf.sh --- a/scripts/build/companion_libs/libelf.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/libelf.sh Wed Apr 06 22:30:57 2011 +0200 @@ -22,20 +22,12 @@ if [ "${CT_LIBELF}" = "y" ]; then do_libelf() { - 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 - CT_DoExecLog CFG \ CC="${CT_HOST}-gcc" \ CFLAGS="-fPIC" \ @@ -47,7 +39,8 @@ --enable-compat \ --enable-elf64 \ --enable-extended-format \ - "${libelf_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building libelf" CT_DoExecLog ALL make diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/mpc.sh --- a/scripts/build/companion_libs/mpc.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/mpc.sh Wed Apr 06 22:30:57 2011 +0200 @@ -22,8 +22,6 @@ } do_mpc() { - local -a mpc_opts - mkdir -p "${CT_BUILD_DIR}/build-mpc" cd "${CT_BUILD_DIR}/build-mpc" @@ -31,12 +29,6 @@ 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 - CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \ @@ -45,7 +37,8 @@ --prefix="${CT_COMPLIBS_DIR}" \ --with-gmp="${CT_COMPLIBS_DIR}" \ --with-mpfr="${CT_COMPLIBS_DIR}" \ - "${mpc_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building MPC" CT_DoExecLog ALL make ${JOBSFLAGS} diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/mpfr.sh --- a/scripts/build/companion_libs/mpfr.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/mpfr.sh Wed Apr 06 22:30:57 2011 +0200 @@ -64,8 +64,6 @@ } do_mpfr() { - local -a mpfr_opts - mkdir -p "${CT_BUILD_DIR}/build-mpfr" cd "${CT_BUILD_DIR}/build-mpfr" @@ -79,11 +77,6 @@ *) 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" CT_DoExecLog CFG \ @@ -94,7 +87,8 @@ --host=${CT_HOST} \ --prefix="${CT_COMPLIBS_DIR}" \ --with-gmp="${CT_COMPLIBS_DIR}" \ - "${mpfr_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building MPFR" CT_DoExecLog ALL make ${JOBSFLAGS} diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/companion_libs/ppl.sh --- a/scripts/build/companion_libs/ppl.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/companion_libs/ppl.sh Wed Apr 06 22:30:57 2011 +0200 @@ -24,8 +24,6 @@ } do_ppl() { - local -a ppl_opts - mkdir -p "${CT_BUILD_DIR}/build-ppl" cd "${CT_BUILD_DIR}/build-ppl" @@ -33,11 +31,6 @@ 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 CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ @@ -54,7 +47,8 @@ --disable-assertions \ --disable-ppl_lcdd \ --disable-ppl_lpsol \ - "${ppl_opts[@]}" + --disable-shared \ + --enable-static # Maybe-options: # --enable-interfaces=... diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/build/internals.sh --- a/scripts/build/internals.sh Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/build/internals.sh Wed Apr 06 22:30:57 2011 +0200 @@ -87,56 +87,6 @@ done CT_Popd - # If using the companion libraries, we need a wrapper - # that will set LD_LIBRARY_PATH approriately - if [ "${CT_WRAPPER_NEEDED}" = "y" ]; then - CT_DoLog EXTRA "Installing toolchain wrappers" - CT_Pushd "${CT_PREFIX_DIR}/bin" - - case "$CT_SYS_OS" in - Darwin|FreeBSD) - # wrapper does not work (when using readlink -m) - CT_DoLog WARN "Forcing usage of binary tool wrapper" - CT_TOOLS_WRAPPER="exec" - ;; - esac - # Install the wrapper - case "${CT_TOOLS_WRAPPER}" in - script) - CT_DoExecLog DEBUG install \ - -m 0755 \ - "${CT_LIB_DIR}/scripts/wrapper.in" \ - ".${CT_TARGET}-wrapper" - ;; - exec) - CT_DoExecLog DEBUG "${CT_HOST}-gcc" \ - -Wall -Wextra -Werror \ - -Os \ - "${CT_LIB_DIR}/scripts/wrapper.c" \ - -o ".${CT_TARGET}-wrapper" - if [ "${CT_DEBUG_CT}" != "y" ]; then - # If not debugging crosstool-NG, strip the wrapper - CT_DoExecLog DEBUG "${CT_HOST}-strip" ".${CT_TARGET}-wrapper" - fi - ;; - esac - - # Replace every tools with the wrapper - # Do it unconditionally, even for those tools that happen to be shell - # scripts, we don't know if they would in the end spawn a binary... - # Just skip symlinks - for _t in "${CT_TARGET}-"*; do - if [ ! -L "${_t}" ]; then - CT_DoExecLog ALL mv "${_t}" ".${_t}" - CT_DoExecLog ALL ln ".${CT_TARGET}-wrapper" "${_t}" - fi - done - - # Get rid of the wrapper, we're using hardlinks - CT_DoExecLog DEBUG rm -f ".${CT_TARGET}-wrapper" - CT_Popd - fi - CT_DoLog EXTRA "Removing access to the build system tools" CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools" diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/crosstool-NG.sh.in Wed Apr 06 22:30:57 2011 +0200 @@ -158,14 +158,7 @@ CT_BUILDTOOLS_PREFIX_DIR="${CT_WORK_DIR}/${CT_TARGET}/buildtools" CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state" CT_CONFIG_DIR="${CT_BUILD_DIR}/configs" -if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then - CT_COMPLIBS_DIR="${CT_PREFIX_DIR}" - # Set LD_LIBRARY_PATH to point to prefix/lib so we can find our own - # libraries; add as first path, so we get hit first by the dynamic linker - CT_SetLibPath "${CT_COMPLIBS_DIR}/lib" first -else - CT_COMPLIBS_DIR="${CT_BUILD_DIR}/static" -fi +CT_COMPLIBS_DIR="${CT_BUILD_DIR}/static" # Compute test suite install directory CT_TEST_SUITE_DIR=${CT_INSTALL_DIR}/test-suite diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/functions --- a/scripts/functions Wed Apr 06 21:34:22 2011 +0200 +++ b/scripts/functions Wed Apr 06 22:30:57 2011 +0200 @@ -1030,9 +1030,6 @@ /^(UID|EUID)=/d; /^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh" - if [ "${CT_COMPLIBS_BACKUP}" = "y" ]; then - CT_DoTarballIfExists "${CT_COMPLIBS_DIR}" "${state_dir}/complibs_dir" - fi CT_DoTarballIfExists "${CT_BUILDTOOLS_PREFIX_DIR}" "${state_dir}/buildtools_dir" CT_DoTarballIfExists "${CT_CONFIG_DIR}" "${state_dir}/config_dir" CT_DoTarballIfExists "${CT_CC_CORE_STATIC_PREFIX_DIR}" "${state_dir}/cc_core_static_prefix_dir" @@ -1071,9 +1068,6 @@ CT_DoExtractTarballIfExists "${state_dir}/cc_core_static_prefix_dir" "${CT_CC_CORE_STATIC_PREFIX_DIR}" CT_DoExtractTarballIfExists "${state_dir}/config_dir" "${CT_CONFIG_DIR}" CT_DoExtractTarballIfExists "${state_dir}/buildtools_dir" "${CT_BUILDTOOLS_PREFIX_DIR}" - if [ "${CT_COMPLIBS_BACKUP}" = "y" ]; then - CT_DoExtractTarballIfExists "${state_dir}/complibs_dir" "${CT_COMPLIBS_DIR}" - fi # Restore the environment, discarding any error message # (for example, read-only bash internals) diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/wrapper.c --- a/scripts/wrapper.c Wed Apr 06 21:34:22 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __APPLE__ -#define LDLP "DYLD_LIBRARY_PATH" -#else -#define LDLP "LD_LIBRARY_PATH" -#endif - -/* Needed for execve */ -extern char **environ; - -int main( int argc, - char** argv ) -{ - char *fullname; /* 'fullname' is used to store the absolute path to the - tool being executed; it serves as a base to compute - the realname of that tool, and the directory holding - our runtime libraries */ - char *realname; /* 'realname' is the real name of the tool, that is what - the wrapper is currently impersonating */ - char *basedir; /* 'libdir' contains our runtime libraries */ - - char *lastslash; /* Temporary variables now */ - char *ldlibpath; - size_t len; - int execve_ret; - - /* Avoid the warning-treated-as-error: "error: unused parameter 'argc'" */ - len = argc; - - /* In case we have a relative or absolute pathname (ie. contains a slash), - * then realpath wll work. But if the tool was found in the PATH, realpath - * won't work, and we'll have to search ourselves. - * This if{}else{} block allocates memory for fullname. */ - if( strchr( argv[0], '/' ) ) { - fullname = (char*) malloc( PATH_MAX * sizeof(char) ); - if( ! realpath( argv[0], fullname ) ) { - perror( "tool wrapper" ); - exit( 1 ); - } - } else { - char *path; - char *mypath; - char *colon; - char *testname; - struct stat st; - - fullname = NULL; - colon = mypath = path = strdup( getenv( "PATH" ) ); - while( colon ) { - colon = strchr( mypath, ':' ); - if( colon ) { - *colon = '\0'; - } - testname = strdup( mypath ); - testname = (char*) realloc( testname, strlen( testname ) - + strlen( argv[0] ) - + 2 * sizeof(char) ); - memset( testname + strlen( testname ), - 0, - strlen( argv[0] ) + 2 * sizeof(char) ); - strcat( testname, "/" ); - strcat( testname, argv[0] ); - if( stat( testname, &st ) == 0 ) { - /* OK, exists. Is it a regular file, or a - * symlink, which the current user may execute? */ - if( S_ISREG( st.st_mode ) && ! access( testname, X_OK | R_OK ) ) { - fullname = strdup( testname ); - break; - } - } - free( testname ); - mypath = colon + 1; - } - free( path ); - if( ! fullname ) { - fprintf( stderr, "tool wrapper: %s: command not found\n", argv[0] ); - exit( 1 ); - } - } - - /* Duplicate my own name to add the 'dot' to tool name */ - realname = strdup( fullname ); - realname = (char*) realloc( realname, strlen( realname) + 2 * sizeof(char) ); - realname[ strlen( realname ) + 1 ] = '\0'; - - /* Add the dot after the last '/' */ - lastslash = strrchr( realname, '/' ); - memmove( lastslash + 1, lastslash, strlen( lastslash ) ); - *( lastslash + 1 ) = '.'; - - /* Compute the basedir of the tool */ - basedir = strdup( fullname ); - lastslash = strrchr( basedir, '/' ); - *lastslash = '\0'; - lastslash = strrchr( basedir, '/' ); - *lastslash = '\0'; - - /* Append '/lib' */ - len = strlen( basedir ); - basedir = (char*) realloc( basedir, len + 5 ); - *( basedir + len ) = '\0'; - strcat( basedir, "/lib" ); - - /* Now add the directory with our runtime libraries to the - front of the library search path, LD_LIBRARY_PATH */ - ldlibpath = getenv(LDLP); - if( ldlibpath ) { - basedir = (char*) realloc( basedir, strlen( basedir ) - + strlen( ldlibpath ) - + 2 * sizeof(char) ); - strcat( basedir, ":" ); - strcat( basedir, ldlibpath ); - } - - if( setenv( LDLP, basedir, 1 ) ) { - errno = ENOMEM; - perror( "tool wrapper" ); - exit( 1 ); - } - - /* Execute the real tool, now */ - execve_ret = execve( realname, argv, environ ); - - /* In case something went wrong above, print a - diagnostic message, and exit with error code 1 */ - perror( "tool wrapper" ); - return 1; -} diff -r 40fe96dff39e -r 0ca0f85a4b2a scripts/wrapper.in --- a/scripts/wrapper.in Wed Apr 06 21:34:22 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#!/bin/sh - -# this wrapper will not work under BSD systems or others -# not containig the GNU readlink. -# Under those, wrapper.c will forcibly be used -# regardless of the config file setting. - -canonicalizedname=$(readlink -nm "${0}") -dirname="$(dirname "${canonicalizedname}")" -basename="$(basename "${canonicalizedname}")" - -ld_lib_path="$(dirname "${dirname}")/lib" - -case ":${LD_LIBRARY_PATH}:" in - *":${ld_lib_path}:"*) ;; - *) LD_LIBRARY_PATH="${ld_lib_path}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}";; -esac - -export LD_LIBRARY_PATH -exec "${dirname}/.${basename}" "$@"