scripts/build/internals.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Thu Jan 10 00:27:13 2013 +0100 (2013-01-10)
changeset 3159 fb71cad4b085
parent 3044 c79d55b27724
permissions -rw-r--r--
arch/arm: OABI is no more, switch to only EABI

Well, leave the prompt as an OBSOLETE thing, scheduled to
be removed soon.

As an indication OABI lives its last days, gcc-4.8 will no
longer recognise non-EABI targets.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.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 
    26         # Strip gdbserver
    27         if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
    28             CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args}         \
    29                              "${CT_TARGET}/debug-root/usr/bin/gdbserver"
    30         fi
    31         # We can not use the version in CT_CC_VERSION because
    32         # of the Linaro stuff. So, harvest the version string
    33         # directly from the gcc sources...
    34         # All gcc 4.x seem to have the version in gcc/BASE-VER
    35         # while version prior to 4.x have the version in gcc/version.c
    36         # Of course, here is not the better place to do that...
    37         if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then
    38             gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" )
    39         else
    40             gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
    41                                "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c"   \
    42                          )
    43         fi
    44         for _t in "bin/${CT_TARGET}-"*                                      \
    45                   "${CT_TARGET}/bin/"*                                      \
    46                   "libexec/gcc/${CT_TARGET}/${gcc_version}/"*               \
    47                   "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \
    48         ; do
    49             _type="$( file "${_t}" |cut -d ' ' -f 2- )"
    50             case "${_type}" in
    51                 *script*executable*)
    52                     ;;
    53                 *executable*)
    54                     CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
    55                     ;;
    56             esac
    57         done
    58         CT_Popd
    59     fi
    60 
    61     if [ "${CT_BARE_METAL}" != "y" ]; then
    62         CT_DoLog EXTRA "Installing the populate helper"
    63         sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
    64                -e 's|@@CT_install@@|'"${install}"'|g;'  \
    65                -e 's|@@CT_bash@@|'"${bash}"'|g;'        \
    66                -e 's|@@CT_grep@@|'"${grep}"'|g;'        \
    67                -e 's|@@CT_make@@|'"${make}"'|g;'        \
    68                -e 's|@@CT_sed@@|'"${sed}"'|g;'          \
    69                "${CT_LIB_DIR}/scripts/populate.in"      \
    70                >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
    71         CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
    72     fi
    73 
    74     if [ "${CT_LIBC_XLDD}" = "y" ]; then
    75         CT_DoLog EXTRA "Installing a cross-ldd helper"
    76         sed -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;'   \
    77                -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;'     \
    78                -e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|g;' \
    79                -e 's|@@CT_install@@|'"${install}"'|g;'      \
    80                -e 's|@@CT_bash@@|'"${bash}"'|g;'            \
    81                -e 's|@@CT_grep@@|'"${grep}"'|g;'            \
    82                -e 's|@@CT_make@@|'"${make}"'|g;'            \
    83                -e 's|@@CT_sed@@|'"${sed}"'|g;'              \
    84                "${CT_LIB_DIR}/scripts/xldd.in"              \
    85                >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
    86         CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
    87     fi
    88 
    89     # Create the aliases to the target tools
    90     CT_DoLog EXTRA "Creating toolchain aliases"
    91     CT_Pushd "${CT_PREFIX_DIR}/bin"
    92     for t in "${CT_TARGET}-"*; do
    93         if [ -n "${CT_TARGET_ALIAS}" ]; then
    94             _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
    95             CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
    96         fi
    97         if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
    98             _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
    99             if [ "${_t}" = "${t}" ]; then
   100                 CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
   101             else
   102                 CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
   103             fi
   104         fi
   105     done
   106     CT_Popd
   107 
   108     CT_DoLog EXTRA "Removing access to the build system tools"
   109     CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
   110 
   111     # Remove the generated documentation files
   112     if [ "${CT_REMOVE_DOCS}" = "y" ]; then
   113         CT_DoLog EXTRA "Removing installed documentation"
   114         CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{,share/}{man,info}
   115         CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{,share/}{man,info}
   116         CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
   117     fi
   118 
   119     # Remove the lib* symlinks, now:
   120     # The symlinks are needed only during the build process.
   121     # The final gcc will still search those dirs, but will also search
   122     # the standard lib/ dirs, so we can get rid of the symlinks
   123     CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
   124     CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"
   125 
   126     CT_EndStep
   127 }