From 80fc8486700df3cbad607c29145a4aaf2309b326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds=22?= Date: Fri, 27 May 2011 22:02:30 -0300 Subject: libc/glibc: fix {e,}glibc add-ons with short or long names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 [yann.morin.1992@anciens.enib.fr: remove spurious trailing spaces] Signed-off-by: "Yann E. MORIN" (transplanted from af25723a794f2017f45c300369a6d36849e22236) diff --git a/scripts/build/libc/eglibc.sh b/scripts/build/libc/eglibc.sh index 12890be..680d6c4 100644 --- a/scripts/build/libc/eglibc.sh +++ b/scripts/build/libc/eglibc.sh @@ -109,15 +109,26 @@ do_libc_extract() { [ "${addon}" = "nptl" ] && continue || true CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}" + + CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \ + -d "${addon}" -a -d "eglibc-${addon}-${CT_LIBC_VERSION}" + # Some addons have the 'long' name, while others have the # 'short' name, but patches are non-uniformly built with # either the 'long' or 'short' name, whatever the addons name - # so we have to make symlinks from the existing to the missing - # Fortunately for us, [ -d foo ], when foo is a symlink to a - # directory, returns true! - [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}" - [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}" + # but we prefer the 'short' name and avoid duplicates. + if [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ]; then + mv "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}" + fi + + ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}" + CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}" + + # Remove the long name since it can confuse configure scripts to run + # the same source twice. + rm "eglibc-${addon}-${CT_LIBC_VERSION}" + CT_Popd done diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index f569c6f..00f5d4b 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -54,15 +54,24 @@ do_libc_extract() { [ "${addon}" = "nptl" ] && continue || true CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}" + CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \ + -d "${addon}" -a -d "glibc-${addon}-${CT_LIBC_VERSION}" + # Some addons have the 'long' name, while others have the # 'short' name, but patches are non-uniformly built with # either the 'long' or 'short' name, whatever the addons name - # so we have to make symlinks from the existing to the missing - # Fortunately for us, [ -d foo ], when foo is a symlink to a - # directory, returns true! - [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}" - [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}" + # but we prefer the 'short' name and avoid duplicates. + if [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ]; then + mv "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}" + fi + + ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}" + CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}" + + # Remove the long name since it can confuse configure scripts to run + # the same source twice. + rm "glibc-${addon}-${CT_LIBC_VERSION}" done # The configure files may be older than the configure.in files -- cgit v0.10.2-6-g49f6