scripts/build/internals.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Apr 24 15:39:53 2011 +0200 (2011-04-24)
changeset 2408 560670f2ce09
parent 2381 0ca0f85a4b2a
child 2425 055e505f28be
permissions -rw-r--r--
internals/finish: do not remove ${PREFIX}/include

gcc installs the C++ headers in ${PREFIX}/include/ but we trash
that directory at the end of the build.

We previously removed that directory as it contained the companion
libraries header files. But it's been some time now that we isntall
the companion libraries in their own dedicated place, so we do not
need to remove that directory.

Until we have a better fix, just keep that directory for now.

Reported-by: Bob Rossi <bob@brasko.net>
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 the lib* symlinks, now:
   102     # The symlinks are needed only during the build process.
   103     # The final gcc will still search those dirs, but will also search
   104     # the standard lib/ dirs, so we can get rid of the symlinks
   105     for d in                            \
   106         "${CT_PREFIX_DIR}"              \
   107         "${CT_PREFIX_DIR}/${CT_TARGET}" \
   108     ; do
   109         CT_DoExecLog ALL rm -f "${d}/lib32"
   110         CT_DoExecLog ALL rm -f "${d}/lib64"
   111     done
   112 
   113     # Also remove the lib/ symlink out-side of sysroot
   114     if [ "${CT_USE_SYSROOT}" = "y" ]; then
   115         CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/${CT_TARGET}/lib"
   116     fi
   117 
   118     CT_EndStep
   119 }