# HG changeset patch # User "Yann E. MORIN" # Date 1217839494 0 # Node ID c2212f59e1cf2869c862bfb94577f6dab5ad168d # Parent b13657cd64b324966f15ed26f6c1fe6ab5e6be65 Michael ABBOTT reported that populate is not relocatable. Fix this by determining both the cross-readelf and the sys-root at runtime, not at build time. /trunk/configure | 1 1 0 0 + /trunk/scripts/crosstool.sh | 14 6 8 0 ++++++-------- /trunk/tools/populate.in | 6 4 2 0 ++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff -r b13657cd64b3 -r c2212f59e1cf configure --- a/configure Fri Aug 01 09:23:58 2008 +0000 +++ b/configure Mon Aug 04 08:44:54 2008 +0000 @@ -23,6 +23,7 @@ tar gzip bzip2 +readlink ' PREFIX_DEFAULT=/usr/local diff -r b13657cd64b3 -r c2212f59e1cf scripts/crosstool.sh --- a/scripts/crosstool.sh Fri Aug 01 09:23:58 2008 +0000 +++ b/scripts/crosstool.sh Mon Aug 04 08:44:54 2008 +0000 @@ -427,9 +427,9 @@ # Install the /populator/ CT_DoLog EXTRA "Installing the populate helper" - sed -r -e 's,@@CT_READELF@@,'"${CT_PREFIX_DIR}/bin/${CT_TARGET}-readelf"',g;' \ - -e 's,@@CT_SYSROOT_DIR@@,'"${CT_SYSROOT_DIR}"',g;' \ - "${CT_LIB_DIR}/tools/populate.in" >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" + sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \ + "${CT_LIB_DIR}/tools/populate.in" \ + >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate" # Create the aliases to the target tools @@ -438,15 +438,13 @@ for t in "${CT_TARGET}-"*; do if [ -n "${CT_TARGET_ALIAS}" ]; then _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;') - CT_DoLog DEBUG "Linking '${_t}' -> '${t}'" - ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL + ln -sv "${t}" "${_t}" 2>&1 fi if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}") - CT_DoLog DEBUG "Linking '${_t}' -> '${t}'" - ln -sv "${t}" "${_t}" 2>&1 |CT_DoLog ALL + ln -sv "${t}" "${_t}" 2>&1 fi - done + done |CT_DoLog ALL CT_Popd CT_EndStep diff -r b13657cd64b3 -r c2212f59e1cf tools/populate.in --- a/tools/populate.in Fri Aug 01 09:23:58 2008 +0000 +++ b/tools/populate.in Mon Aug 04 08:44:54 2008 +0000 @@ -4,8 +4,10 @@ # (C) 2007 Yann E. MORIN # Licensed under the GPL v2 -CT_READELF="@@CT_READELF@@" -CT_SYSROOT_DIR="@@CT_SYSROOT_DIR@@" +# Detect where the toolchain is: +BIN_DIR="$(cd "$(dirname "$(readlink -fn "$0")")"; pwd)" +CT_READELF="${BIN_DIR}/@@CT_TARGET@@-readelf" +CT_SYSROOT_DIR="${BIN_DIR}/../@@CT_TARGET@@/sys-root" myname=$(basename "$0")