scripts/functions: Fix CT_ExtractGit function.
Change CT_ExtractGit so that it clones the repository, instead of just
symlinking it. After cloning, any given ref is checked out, or if no
ref is given, the HEAD of the repository is checked out.
This makes CT_Extract behave similar for git repositories as it does
for tarballs, so that it for example can be used for passing glibc-ports
as a git repository.
Signed-off-by: "Esben Haabendal" <esben.haabendal@prevas.dk>
[yann.morin.1998@anciens.enib.fr: fix incomplete var rename]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
1 # This file contains crosstool-NG internal steps
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.
12 CT_DoStep INFO "Cleaning-up the toolchain's directory"
14 if [ "${CT_STRIP_ALL_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
20 strip_args="--strip-all -v"
23 CT_DoLog INFO "Stripping all toolchain executables"
24 CT_Pushd "${CT_PREFIX_DIR}"
25 # We can not use the version in CT_CC_VERSION because
26 # of the Linaro stuff. So, harvest the version string
27 # directly from the gcc sources...
28 # All gcc 4.x seem to have the version in gcc/BASE-VER
29 # while version prior to 4.x have the version in gcc/version.c
30 # Of course, here is not the better place to do that...
31 if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then
32 gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" )
34 gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
35 "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c" \
38 for _t in "bin/${CT_TARGET}-"* \
39 "${CT_TARGET}/bin/"* \
40 "libexec/gcc/${CT_TARGET}/${gcc_version}/"* \
41 "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \
43 _type="$( file "${_t}" |cut -d ' ' -f 2- )"
48 CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
55 if [ "${CT_BARE_METAL}" != "y" ]; then
56 CT_DoLog EXTRA "Installing the populate helper"
57 sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
58 -e 's|@@CT_install@@|'"${install}"'|g;' \
59 -e 's|@@CT_bash@@|'"${bash}"'|g;' \
60 -e 's|@@CT_grep@@|'"${grep}"'|g;' \
61 -e 's|@@CT_make@@|'"${make}"'|g;' \
62 -e 's|@@CT_sed@@|'"${sed}"'|g;' \
63 "${CT_LIB_DIR}/scripts/populate.in" \
64 >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
65 CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
68 if [ "${CT_LIBC_XLDD}" = "y" ]; then
69 CT_DoLog EXTRA "Installing a cross-ldd helper"
70 sed -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;' \
71 -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
72 -e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|g;' \
73 -e 's|@@CT_install@@|'"${install}"'|g;' \
74 -e 's|@@CT_bash@@|'"${bash}"'|g;' \
75 -e 's|@@CT_grep@@|'"${grep}"'|g;' \
76 -e 's|@@CT_make@@|'"${make}"'|g;' \
77 -e 's|@@CT_sed@@|'"${sed}"'|g;' \
78 "${CT_LIB_DIR}/scripts/xldd.in" \
79 >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
80 CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
83 # Create the aliases to the target tools
84 CT_DoLog EXTRA "Creating toolchain aliases"
85 CT_Pushd "${CT_PREFIX_DIR}/bin"
86 for t in "${CT_TARGET}-"*; do
87 if [ -n "${CT_TARGET_ALIAS}" ]; then
88 _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
89 CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
91 if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
92 _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
93 if [ "${_t}" = "${t}" ]; then
94 CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
96 CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
102 CT_DoLog EXTRA "Removing access to the build system tools"
103 CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
105 # Remove the generated documentation files
106 if [ "${CT_REMOVE_DOCS}" = "y" ]; then
107 CT_DoLog EXTRA "Removing installed documentation"
108 CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{,share/}{man,info}
109 CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{,share/}{man,info}
110 CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
113 # Remove the lib* symlinks, now:
114 # The symlinks are needed only during the build process.
115 # The final gcc will still search those dirs, but will also search
116 # the standard lib/ dirs, so we can get rid of the symlinks
117 CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
118 CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"