diff options
author | Gregory M. Tuner <gmt@be-evil.net> | 2014-05-30 22:20:20 -0700 |
---|---|---|
committer | Gregory M. Tuner <gmt@be-evil.net> | 2014-05-30 22:22:04 -0700 |
commit | a8311d436680663d6fc3959f2d526ee32ed7afd2 (patch) | |
tree | f4e3bfadb19941174f74a24e655191b64eaa22c1 | |
parent | dev-libs/libnl: ununmask as unmasked upstream (diff) | |
download | gmt-a8311d436680663d6fc3959f2d526ee32ed7afd2.tar.gz gmt-a8311d436680663d6fc3959f2d526ee32ed7afd2.tar.bz2 gmt-a8311d436680663d6fc3959f2d526ee32ed7afd2.zip |
eclass/multilib-build: correct carelessly merged upstream recipe for MULTILIB_CHOST_TOOLS merging
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
-rw-r--r-- | eclass/multilib-build.eclass | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass index ff2d212..cdd8643 100644 --- a/eclass/multilib-build.eclass +++ b/eclass/multilib-build.eclass @@ -1002,35 +1002,54 @@ _EOF_ local dir=${f%/*} local fn=${f##*/} - cp "${root}${f}" "${root}/${dir}/${CHOST}-${fn}" || die + # decide if we behave like upstream, or if we are skipping the whole business about + # linking the native program to the CHOST executable because that was handled by + # a redundant @wrapped MULTILIB_WRAPPED_EXECUTABLE + local dosymlink=yes + for f1 in "${MULTILIB_WRAPPED_EXECUTABLES[@]}" ; do + [[ ${f1:0:1} == @ ]] || continue + f1=${f1:1} + # strip leading slashes + f1="${f1#/}" + [[ ${f1} =~ ^/+ ]] && f1="${f1#${BASH_REMATCH[0]}}" + # and then usr/include + f1="${f1#usr/include}" + if [[ ${f} == ${f1} ]] ; then + dosymlink=no + break + fi + done - # symlink the native one back (unless it's also an @wrapped-MULTILIB_WRAPPED_EXECUTABLE) - if multilib_is_native_abi; then - dosymlink=yes - for f1 in "${MULTILIB_WRAPPED_EXECUTABLES[@]}" ; do - [[ ${f1:0:1} == @ ]] || continue - f1=${f1:1} - # strip leading slashes - f1="${f1#/}" - [[ ${f1} =~ ^/+ ]] && f1="${f1#${BASH_REMATCH[0]}}" - # and then usr/include - f1="${f1#usr/include}" - if [[ ${f} == ${f1} ]] ; then - dosymlink=no - break - fi - done - if [[ ${dosymlink} == yes ]] ; then - # rewrite the symlink target - local target=$(readlink "${root}${f}") - local target_dir - local target_fn=${target##*/} + # don't rewrite symlink targets if we are relying on redundant @wrapping! + # that would be bad (even if it worked it'd be awfully confusing) + if [[ ${dosymlink} == yes && -L "${root}${f}" ]]; then + # rewrite the symlink target + local target=$(readlink "${root}${f}") + local target_dir + local target_fn=${target##*/} - [[ ${target} == */* ]] && target_dir=${target%/*} + [[ ${target} == */* ]] && target_dir=${target%/*} + rm "${root}${f}" || die + ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" \ + "${root}${f}" || die + elif [[ -L "${root}${f}" ]]; then + ewarn "============ hell no ===============" + ewarn "\"${root}${f}\" is installed as a symlink by upstream or ebuild code; meanwhile," + ewarn "it is both @wrapped in MULTILIB_WRAPPED_EXECUTABLES and present in MULTILIB_CHOST_TOOLS." + ewarn "If that makes perfect sense to you, you're smarter than me." + ewarn "====================================" + die "\"${root}${f}\" seems 'semantically oversaturated'; giving up the ghost." + fi + + # always copy whatever it is to the ${CHOST}-prefixed name + cp "${root}${f}" "${root}${dir}/${CHOST}-${fn}" || die + + # symlink the native one back (unless it's redundantly @wrapped -- in that case, leave it be) + if multilib_is_native_abi; then + if [[ ${dosymlink} == yes ]]; then rm "${root}${f}" || die - ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" \ - "${root}${f}" + ln -s "${CHOST}-${fn}" "${root}${f}" || die fi else rm "${root}${f}" || die |