diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2010-03-25 22:42:00 +0100 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2010-03-25 22:42:00 +0100 |
commit | f36ceb7f544f2d5d993c09b316892dad43503da5 (patch) | |
tree | a9804089ddb78d0009830dbca6a6cd6d7414a77b /scripts/populate.in | |
parent | a67a23877fdc73b090ee542251cc99168b3fb079 (diff) | |
download | crosstool-ng-f36ceb7f544f2d5d993c09b316892dad43503da5.tar.gz crosstool-ng-f36ceb7f544f2d5d993c09b316892dad43503da5.tar.bz2 crosstool-ng-f36ceb7f544f2d5d993c09b316892dad43503da5.zip |
scripts/populate: properly locate the sysroot and required tools
This fixes two problems:
- the sysroot might be in a sub-directory (think SYSROOT_DIR_PREFIX)
- it is not needed to have the target tuple to properly detect the sysroot
and the required tools
As a side effect, this script is now no longer dependent on the target
tuple, and in the future, we might be able to share it across many
toolchains (when/if we can install all of them in the same place).
Diffstat (limited to 'scripts/populate.in')
-rw-r--r-- | scripts/populate.in | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/scripts/populate.in b/scripts/populate.in index 703b3b62..027303d8 100644 --- a/scripts/populate.in +++ b/scripts/populate.in @@ -4,20 +4,32 @@ # Licensed under the GPL v2 set -e -# Detect where the toolchain is: -CT_PREFIX_DIR="$(cd "$(dirname "$0")/.."; pwd)" -CT_BIN_DIR="${CT_PREFIX_DIR}/bin" -CT_READELF="${CT_BIN_DIR}/@@CT_TARGET@@-readelf" -CT_LIB_DIR="${CT_PREFIX_DIR}/lib" -CT_SYSROOT_DIR="$(cd "${CT_BIN_DIR}/../@@CT_TARGET@@/sys-root"; pwd)" - -myname=$(basename "$0") - # Use the tools discovered by crosstool-NG's ./configure: install="@@CT_install@@" grep="@@CT_grep@@" sed="@@CT_sed@@" +# Detect where the toolchain is: +CT_PREFIX_DIR="$(cd "$(dirname "$0")/.."; pwd)" +CT_GCC="${0%-populate}-gcc" +CT_READELF="${0%-populate}-readelf" +CT_CFG_PREFIX_DIR="$("${CT_GCC}" -v 2>&1 \ + |tr ' ' '\n' \ + |"${grep}" -E -- '--prefix=' \ + |cut -d = -f 2- + )" +CT_CFG_SYSROOT_DIR="$("${CT_GCC}" -v 2>&1 \ + |tr ' ' '\n' \ + |"${grep}" -E -- '--with-sysroot=' \ + |cut -d = -f 2- + )" +CT_SYSROOT_DIR="$(echo "${CT_CFG_SYSROOT_DIR}" \ + |"${sed}" -r -e "s:^${CT_CFG_PREFIX_DIR}:${CT_PREFIX_DIR}:;" \ + |"${sed}" -r -e 's,/+,/,g;' \ + )" + +myname=$(basename "$0") + doHelp() { cat <<_EOF_ NAME |