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>
yann@1225
     1
# This file contains crosstool-NG internal steps
yann@1225
     2
yann@1225
     3
# This step is called once all components were built, to remove
yann@1225
     4
# un-wanted files, to add tuple aliases, and to add the final
yann@1225
     5
# crosstool-NG-provided files.
yann@1225
     6
do_finish() {
yann@1401
     7
    local _t
yann@2213
     8
    local _type
titus@2089
     9
    local strip_args
yann@2301
    10
    local gcc_version
yann@1401
    11
yann@1225
    12
    CT_DoStep INFO "Cleaning-up the toolchain's directory"
yann@1225
    13
linux@2060
    14
    if [ "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
titus@2089
    15
        case "$CT_HOST" in
titus@2089
    16
            *darwin*)
titus@2089
    17
                strip_args=""
titus@2089
    18
                ;;
titus@2089
    19
            *)
titus@2089
    20
                strip_args="--strip-all -v"
titus@2089
    21
                ;;
titus@2089
    22
        esac
linux@2060
    23
        CT_DoLog INFO "Stripping all toolchain executables"
linux@2060
    24
        CT_Pushd "${CT_PREFIX_DIR}"
zhenqiang@3044
    25
zhenqiang@3044
    26
        # Strip gdbserver
zhenqiang@3044
    27
        if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
zhenqiang@3062
    28
            CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args}         \
zhenqiang@3062
    29
                             "${CT_TARGET}/debug-root/usr/bin/gdbserver"
zhenqiang@3044
    30
        fi
yann@2430
    31
        # We can not use the version in CT_CC_VERSION because
yann@2430
    32
        # of the Linaro stuff. So, harvest the version string
yann@2430
    33
        # directly from the gcc sources...
yann@2430
    34
        # All gcc 4.x seem to have the version in gcc/BASE-VER
yann@2430
    35
        # while version prior to 4.x have the version in gcc/version.c
yann@2430
    36
        # Of course, here is not the better place to do that...
yann@2430
    37
        if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then
yann@2430
    38
            gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" )
yann@2430
    39
        else
yann@2430
    40
            gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
yann@2430
    41
                               "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c"   \
yann@2430
    42
                         )
yann@2430
    43
        fi
yann@2301
    44
        for _t in "bin/${CT_TARGET}-"*                                      \
yann@2301
    45
                  "${CT_TARGET}/bin/"*                                      \
yann@2301
    46
                  "libexec/gcc/${CT_TARGET}/${gcc_version}/"*               \
yann@2301
    47
                  "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \
yann@2213
    48
        ; do
yann@2213
    49
            _type="$( file "${_t}" |cut -d ' ' -f 2- )"
yann@2213
    50
            case "${_type}" in
yann@2357
    51
                *script*executable*)
yann@2213
    52
                    ;;
yann@2213
    53
                *executable*)
yann@2213
    54
                    CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
yann@2213
    55
                    ;;
yann@2213
    56
            esac
linux@2060
    57
        done
linux@2060
    58
        CT_Popd
linux@2060
    59
    fi
linux@2060
    60
yann@1225
    61
    if [ "${CT_BARE_METAL}" != "y" ]; then
yann@1225
    62
        CT_DoLog EXTRA "Installing the populate helper"
yann@1225
    63
        sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
yann@1225
    64
               -e 's|@@CT_install@@|'"${install}"'|g;'  \
yann@1225
    65
               -e 's|@@CT_bash@@|'"${bash}"'|g;'        \
yann@1225
    66
               -e 's|@@CT_grep@@|'"${grep}"'|g;'        \
yann@1225
    67
               -e 's|@@CT_make@@|'"${make}"'|g;'        \
yann@1225
    68
               -e 's|@@CT_sed@@|'"${sed}"'|g;'          \
yann@1225
    69
               "${CT_LIB_DIR}/scripts/populate.in"      \
yann@1225
    70
               >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
yann@1225
    71
        CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
yann@1225
    72
    fi
yann@1225
    73
yann@2034
    74
    if [ "${CT_LIBC_XLDD}" = "y" ]; then
yann@2034
    75
        CT_DoLog EXTRA "Installing a cross-ldd helper"
yann@2184
    76
        sed -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;'   \
yann@2185
    77
               -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;'     \
yann@2187
    78
               -e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|g;' \
yann@2185
    79
               -e 's|@@CT_install@@|'"${install}"'|g;'      \
yann@2185
    80
               -e 's|@@CT_bash@@|'"${bash}"'|g;'            \
yann@2185
    81
               -e 's|@@CT_grep@@|'"${grep}"'|g;'            \
yann@2185
    82
               -e 's|@@CT_make@@|'"${make}"'|g;'            \
yann@2185
    83
               -e 's|@@CT_sed@@|'"${sed}"'|g;'              \
yann@2185
    84
               "${CT_LIB_DIR}/scripts/xldd.in"              \
yann@2034
    85
               >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
yann@2034
    86
        CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
yann@2034
    87
    fi
yann@2034
    88
yann@1225
    89
    # Create the aliases to the target tools
yann@1225
    90
    CT_DoLog EXTRA "Creating toolchain aliases"
yann@1225
    91
    CT_Pushd "${CT_PREFIX_DIR}/bin"
yann@1225
    92
    for t in "${CT_TARGET}-"*; do
yann@1225
    93
        if [ -n "${CT_TARGET_ALIAS}" ]; then
yann@1225
    94
            _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
yann@2550
    95
            CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
yann@1225
    96
        fi
yann@1225
    97
        if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
yann@1225
    98
            _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
yann@2004
    99
            if [ "${_t}" = "${t}" ]; then
yann@2004
   100
                CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
yann@2004
   101
            else
yann@2550
   102
                CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
yann@2004
   103
            fi
yann@1225
   104
        fi
yann@1225
   105
    done
yann@1225
   106
    CT_Popd
yann@1225
   107
yann@1518
   108
    CT_DoLog EXTRA "Removing access to the build system tools"
yann@1518
   109
    CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
yann@1518
   110
yann@1225
   111
    # Remove the generated documentation files
yann@1225
   112
    if [ "${CT_REMOVE_DOCS}" = "y" ]; then
yann@1225
   113
        CT_DoLog EXTRA "Removing installed documentation"
yann@2236
   114
        CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{,share/}{man,info}
yann@2236
   115
        CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{,share/}{man,info}
yann@2236
   116
        CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
yann@1225
   117
    fi
yann@1225
   118
yann@2117
   119
    # Remove the lib* symlinks, now:
yann@2117
   120
    # The symlinks are needed only during the build process.
yann@2117
   121
    # The final gcc will still search those dirs, but will also search
yann@2117
   122
    # the standard lib/ dirs, so we can get rid of the symlinks
yann@2544
   123
    CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
yann@2544
   124
    CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"
yann@2117
   125
yann@1225
   126
    CT_EndStep
yann@1225
   127
}