scripts/build/internals.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Apr 06 22:30:57 2011 +0200 (2011-04-06)
changeset 2381 0ca0f85a4b2a
parent 2357 21025504dbc9
child 2408 560670f2ce09
permissions -rw-r--r--
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" <yann.morin.1998@anciens.enib.fr>
     1 # This file contains crosstool-NG internal steps
     2 
     3 # This step is called once all components were built, to remove
     4 # un-wanted files, to add tuple aliases, and to add the final
     5 # crosstool-NG-provided files.
     6 do_finish() {
     7     local _t
     8     local _type
     9     local strip_args
    10     local gcc_version
    11 
    12     CT_DoStep INFO "Cleaning-up the toolchain's directory"
    13 
    14     if [ "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
    15         case "$CT_HOST" in
    16             *darwin*)
    17                 strip_args=""
    18                 ;;
    19             *)
    20                 strip_args="--strip-all -v"
    21                 ;;
    22         esac
    23         CT_DoLog INFO "Stripping all toolchain executables"
    24         CT_Pushd "${CT_PREFIX_DIR}"
    25         gcc_version=$( "./bin/${CT_TARGET}-gcc" -dumpversion )
    26         for _t in "bin/${CT_TARGET}-"*                                      \
    27                   "${CT_TARGET}/bin/"*                                      \
    28                   "libexec/gcc/${CT_TARGET}/${gcc_version}/"*               \
    29                   "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \
    30         ; do
    31             _type="$( file "${_t}" |cut -d ' ' -f 2- )"
    32             case "${_type}" in
    33                 *script*executable*)
    34                     ;;
    35                 *executable*)
    36                     CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
    37                     ;;
    38             esac
    39         done
    40         CT_Popd
    41     fi
    42 
    43     if [ "${CT_BARE_METAL}" != "y" ]; then
    44         CT_DoLog EXTRA "Installing the populate helper"
    45         sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
    46                -e 's|@@CT_install@@|'"${install}"'|g;'  \
    47                -e 's|@@CT_bash@@|'"${bash}"'|g;'        \
    48                -e 's|@@CT_grep@@|'"${grep}"'|g;'        \
    49                -e 's|@@CT_make@@|'"${make}"'|g;'        \
    50                -e 's|@@CT_sed@@|'"${sed}"'|g;'          \
    51                "${CT_LIB_DIR}/scripts/populate.in"      \
    52                >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
    53         CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
    54     fi
    55 
    56     if [ "${CT_LIBC_XLDD}" = "y" ]; then
    57         CT_DoLog EXTRA "Installing a cross-ldd helper"
    58         sed -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;'   \
    59                -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;'     \
    60                -e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|g;' \
    61                -e 's|@@CT_install@@|'"${install}"'|g;'      \
    62                -e 's|@@CT_bash@@|'"${bash}"'|g;'            \
    63                -e 's|@@CT_grep@@|'"${grep}"'|g;'            \
    64                -e 's|@@CT_make@@|'"${make}"'|g;'            \
    65                -e 's|@@CT_sed@@|'"${sed}"'|g;'              \
    66                "${CT_LIB_DIR}/scripts/xldd.in"              \
    67                >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
    68         CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
    69     fi
    70 
    71     # Create the aliases to the target tools
    72     CT_DoLog EXTRA "Creating toolchain aliases"
    73     CT_Pushd "${CT_PREFIX_DIR}/bin"
    74     for t in "${CT_TARGET}-"*; do
    75         if [ -n "${CT_TARGET_ALIAS}" ]; then
    76             _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
    77             CT_DoExecLog ALL ln -sv "${t}" "${_t}"
    78         fi
    79         if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
    80             _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
    81             if [ "${_t}" = "${t}" ]; then
    82                 CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
    83             else
    84                 CT_DoExecLog ALL ln -sv "${t}" "${_t}"
    85             fi
    86         fi
    87     done
    88     CT_Popd
    89 
    90     CT_DoLog EXTRA "Removing access to the build system tools"
    91     CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
    92 
    93     # Remove the generated documentation files
    94     if [ "${CT_REMOVE_DOCS}" = "y" ]; then
    95         CT_DoLog EXTRA "Removing installed documentation"
    96         CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{,share/}{man,info}
    97         CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{,share/}{man,info}
    98         CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
    99     fi
   100 
   101     # Remove headers installed by native companion libraries
   102     CT_DoForceRmdir "${CT_PREFIX_DIR}/include"
   103 
   104     # Remove the lib* symlinks, now:
   105     # The symlinks are needed only during the build process.
   106     # The final gcc will still search those dirs, but will also search
   107     # the standard lib/ dirs, so we can get rid of the symlinks
   108     for d in                            \
   109         "${CT_PREFIX_DIR}"              \
   110         "${CT_PREFIX_DIR}/${CT_TARGET}" \
   111     ; do
   112         CT_DoExecLog ALL rm -f "${d}/lib32"
   113         CT_DoExecLog ALL rm -f "${d}/lib64"
   114     done
   115 
   116     # Also remove the lib/ symlink out-side of sysroot
   117     if [ "${CT_USE_SYSROOT}" = "y" ]; then
   118         CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
   119     fi
   120 
   121     CT_EndStep
   122 }