From e115a9ba307e11910bb444234b8331f279fb2a2b Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Tue, 20 Mar 2018 06:52:23 +0500 Subject: [PATCH] external-toolchain-cross-canadian: ship TARGET_PREFIX symlinks When EXTERNAL_TARGET_SYS != TARGET_PREFIX, which is generally the case, we should ship symlinks with the other prefix. This is largely for compatibility with existing scripts, but also means we don't need to alter the variables in environment-setup, i.e. CC. Signed-off-by: Christopher Larson --- .../external-toolchain-cross-canadian.bbclass | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/classes/external-toolchain-cross-canadian.bbclass b/classes/external-toolchain-cross-canadian.bbclass index e5ab0dd..e81e843 100644 --- a/classes/external-toolchain-cross-canadian.bbclass +++ b/classes/external-toolchain-cross-canadian.bbclass @@ -22,3 +22,27 @@ libexecdir = "${exec_prefix}/libexec" # We're relying on a compatible host libc, not one from a nativesdk build INSANE_SKIP_${PN} += "build-deps file-rdeps" + +do_install_append () { + for i in ${D}${bindir}/${EXTERNAL_TARGET_SYS}-*; do + if [ -e "$i" ]; then + j="$(basename "$i")" + ln -sv "$j" "${D}${bindir}/${TARGET_PREFIX}${j#${EXTERNAL_TARGET_SYS}-}" + fi + done +} + +python add_files_links () { + prefix = d.getVar('EXTERNAL_TARGET_SYS') + '-' + full_prefix = os.path.join(d.getVar('bindir'), prefix) + new_prefix = d.getVar('TARGET_PREFIX') + for pkg in d.getVar('PACKAGES').split(): + files = (d.getVar('FILES_%s' % pkg) or '').split() + new_files = [] + for f in files: + if f.startswith(full_prefix): + new_files.append(f.replace(prefix, new_prefix)) + if new_files: + d.appendVar('FILES_%s' % pkg, ' ' + ' '.join(new_files)) +} +do_package[prefuncs] += "add_files_links"