libc/glibc: fix {e,}glibc add-ons with short or long names 1.11
author"Nicolás Reynolds" <fauno@kiwwwi.com.ar>
Fri May 27 22:02:30 2011 -0300 (2011-05-27)
branch1.11
changeset 2553fe2c448bf3b7
parent 2552 cc285cc98e65
child 2554 e378a7ccc345
libc/glibc: fix {e,}glibc add-ons with short or long names

Fixes the issue with {e,}glibc addons having short and long names (such as
eglibc-ports-2_13 and ports), which caused configure scripts to run
through them twice and thus configuring incorrectly.

For instance, the mips64el-n32-linux-gnu toolchain would be recognized
correctly first, but then the second pass would change it to mips32,
building a mixed MIPS-III N32 and MIPS-I libc.

Signed-off-by: Nicolás Reynolds <fauno@kiwwwi.com.ar>
[yann.morin.1992@anciens.enib.fr: remove spurious trailing spaces]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from af25723a794f2017f45c300369a6d36849e22236)
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc.sh
     1.1 --- a/scripts/build/libc/eglibc.sh	Wed May 25 20:23:48 2011 +0200
     1.2 +++ b/scripts/build/libc/eglibc.sh	Fri May 27 22:02:30 2011 -0300
     1.3 @@ -109,15 +109,26 @@
     1.4          [ "${addon}" = "nptl" ] && continue || true
     1.5          CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
     1.6          CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
     1.7 +
     1.8 +        CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
     1.9 +            -d "${addon}" -a -d "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.10 +
    1.11          # Some addons have the 'long' name, while others have the
    1.12          # 'short' name, but patches are non-uniformly built with
    1.13          # either the 'long' or 'short' name, whatever the addons name
    1.14 -        # so we have to make symlinks from the existing to the missing
    1.15 -        # Fortunately for us, [ -d foo ], when foo is a symlink to a
    1.16 -        # directory, returns true!
    1.17 -        [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    1.18 -        [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.19 +        # but we prefer the 'short' name and avoid duplicates.
    1.20 +        if [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ]; then
    1.21 +            mv "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    1.22 +        fi
    1.23 +
    1.24 +        ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.25 +
    1.26          CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}"
    1.27 +
    1.28 +        # Remove the long name since it can confuse configure scripts to run
    1.29 +        # the same source twice.
    1.30 +        rm "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.31 +
    1.32          CT_Popd
    1.33      done
    1.34  
     2.1 --- a/scripts/build/libc/glibc.sh	Wed May 25 20:23:48 2011 +0200
     2.2 +++ b/scripts/build/libc/glibc.sh	Fri May 27 22:02:30 2011 -0300
     2.3 @@ -54,15 +54,24 @@
     2.4          [ "${addon}" = "nptl" ] && continue || true
     2.5          CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
     2.6  
     2.7 +        CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
     2.8 +            -d "${addon}" -a -d "glibc-${addon}-${CT_LIBC_VERSION}"
     2.9 +
    2.10          # Some addons have the 'long' name, while others have the
    2.11          # 'short' name, but patches are non-uniformly built with
    2.12          # either the 'long' or 'short' name, whatever the addons name
    2.13 -        # so we have to make symlinks from the existing to the missing
    2.14 -        # Fortunately for us, [ -d foo ], when foo is a symlink to a
    2.15 -        # directory, returns true!
    2.16 -        [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    2.17 -        [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    2.18 +        # but we prefer the 'short' name and avoid duplicates.
    2.19 +        if [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ]; then
    2.20 +            mv "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    2.21 +        fi
    2.22 +
    2.23 +        ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    2.24 +
    2.25          CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
    2.26 +
    2.27 +        # Remove the long name since it can confuse configure scripts to run
    2.28 +        # the same source twice.
    2.29 +        rm "glibc-${addon}-${CT_LIBC_VERSION}"
    2.30      done
    2.31  
    2.32      # The configure files may be older than the configure.in files