scripts/build/internals.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Mon Apr 16 15:25:36 2012 +0200 (2012-04-16)
changeset 2941 13e40098fffc
parent 2544 751c3f735ada
child 3044 c79d55b27724
permissions -rw-r--r--
cc/gcc: update Linaro GCC revisions to 2012.04

Update Linaro GCC with the latest available revisions.

The 4.7 revision is also released, but the infrastructure is not yet ready for
it in CT-NG.

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