From 5e27ad1e5aabdbc0633c380c4ab2959b34a55134 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Wed, 6 Apr 2011 22:30:57 +0200 Subject: 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 --git a/config/companion_libs.in b/config/companion_libs.in index 8cafa7b..5902cbf 100644 --- a/config/companion_libs.in +++ b/config/companion_libs.in @@ -48,10 +48,6 @@ config COMPLIBS bool default n -config WRAPPER_NEEDED - bool - default n - config GMP bool select COMPLIBS @@ -113,11 +109,6 @@ if COMPLIBS 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 @@ 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 - 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 --git a/scripts/build/companion_libs/cloog.sh b/scripts/build/companion_libs/cloog.sh index f1580cb..f329fcb 100644 --- a/scripts/build/companion_libs/cloog.sh +++ b/scripts/build/companion_libs/cloog.sh @@ -37,8 +37,6 @@ 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. @@ -54,17 +52,9 @@ do_cloog() { 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 @@ do_cloog() { --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 --git a/scripts/build/companion_libs/gmp.sh b/scripts/build/companion_libs/gmp.sh index 20c3d04..b8601c5 100644 --- a/scripts/build/companion_libs/gmp.sh +++ b/scripts/build/companion_libs/gmp.sh @@ -21,8 +21,6 @@ do_gmp_extract() { } do_gmp() { - local -a gmp_opts - mkdir -p "${CT_BUILD_DIR}/build-gmp" cd "${CT_BUILD_DIR}/build-gmp" @@ -30,12 +28,6 @@ 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 - CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \ "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \ @@ -45,7 +37,8 @@ do_gmp() { --enable-fft \ --enable-mpbsd \ --enable-cxx \ - "${gmp_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building GMP" CT_DoExecLog ALL make ${JOBSFLAGS} diff --git a/scripts/build/companion_libs/libelf.sh b/scripts/build/companion_libs/libelf.sh index 1e4d36f..d53510e 100644 --- a/scripts/build/companion_libs/libelf.sh +++ b/scripts/build/companion_libs/libelf.sh @@ -22,20 +22,12 @@ do_libelf_extract() { 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 @@ do_libelf() { --enable-compat \ --enable-elf64 \ --enable-extended-format \ - "${libelf_opts[@]}" + --disable-shared \ + --enable-static CT_DoLog EXTRA "Building libelf" CT_DoExecLog ALL make diff --git a/scripts/build/companion_libs/mpc.sh b/scripts/build/companion_libs/mpc.sh index eb6074b..f8cc87b 100644 --- a/scripts/build/companion_libs/mpc.sh +++ b/scripts/build/companion_libs/mpc.sh @@ -22,8 +22,6 @@ do_mpc_extract() { } do_mpc() { - local -a mpc_opts - mkdir -p "${CT_BUILD_DIR}/build-mpc" cd "${CT_BUILD_DIR}/build-mpc" @@ -31,12 +29,6 @@ do_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 - CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \ @@ -45,7 +37,8 @@ do_mpc() { --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 --git a/scripts/build/companion_libs/mpfr.sh b/scripts/build/companion_libs/mpfr.sh index 69c2ebb..a91d5c3 100644 --- a/scripts/build/companion_libs/mpfr.sh +++ b/scripts/build/companion_libs/mpfr.sh @@ -64,8 +64,6 @@ do_mpfr_extract() { } do_mpfr() { - local -a mpfr_opts - mkdir -p "${CT_BUILD_DIR}/build-mpfr" cd "${CT_BUILD_DIR}/build-mpfr" @@ -79,11 +77,6 @@ do_mpfr() { *) 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 @@ do_mpfr() { --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 --git a/scripts/build/companion_libs/ppl.sh b/scripts/build/companion_libs/ppl.sh index 3324400..238c6c4 100644 --- a/scripts/build/companion_libs/ppl.sh +++ b/scripts/build/companion_libs/ppl.sh @@ -24,8 +24,6 @@ do_ppl_extract() { } do_ppl() { - local -a ppl_opts - mkdir -p "${CT_BUILD_DIR}/build-ppl" cd "${CT_BUILD_DIR}/build-ppl" @@ -33,11 +31,6 @@ do_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 CT_DoExecLog CFG \ CFLAGS="${CT_CFLAGS_FOR_HOST}" \ @@ -54,7 +47,8 @@ do_ppl() { --disable-assertions \ --disable-ppl_lcdd \ --disable-ppl_lpsol \ - "${ppl_opts[@]}" + --disable-shared \ + --enable-static # Maybe-options: # --enable-interfaces=... diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index 743f266..d730e28 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -87,56 +87,6 @@ do_finish() { 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 --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index e74a635..a3869c1 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -158,14 +158,7 @@ CT_BUILD_DIR="${CT_WORK_DIR}/${CT_TARGET}/build" 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 --git a/scripts/functions b/scripts/functions index 2bf5767..9f6d0f4 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1030,9 +1030,6 @@ CT_DoSaveState() { /^(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_DoLoadState(){ 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 --git a/scripts/wrapper.c b/scripts/wrapper.c deleted file mode 100644 index 59630f6..0000000 --- a/scripts/wrapper.c +++ /dev/null @@ -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 --git a/scripts/wrapper.in b/scripts/wrapper.in deleted file mode 100644 index b4dfc97..0000000 --- a/scripts/wrapper.in +++ /dev/null @@ -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}" "$@" -- cgit v0.10.2-6-g49f6