Files
poky/meta/recipes-devtools/clang/clang-cross_git.bb
Khem Raj 57a4230055 clang-cross: Create <cross>-clang binary copy instead of symlink
With clang cleanup in [1] we ended up removing this logic, which
is still required.

This ensures that search path for subsequent tools e.g. linker
assembler are searched in the same dir where <cross>-clang is
installed. If its a symlink to ../clang then the reference
installation dir is ../ and all cross-tools are not there
so clang will fail to find assembler/linker from cross staging
area and use /usr/bin/ld or /usr/bin/as  which we do not want

[1] https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/clang/clang-cross_git.bb?id=5d96ed55acf7b9a908241222097ad809355de7cf

(From OE-Core rev: 3b0128fe6421e64674fd250e0b4e6afb1c8ce436)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-08-11 18:04:25 +01:00

33 lines
1.2 KiB
BlitzBasic

# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Cross compiler wrappers for LLVM based C/C++ compiler"
HOMEPAGE = "http://clang.llvm.org/"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SECTION = "devel"
PN = "clang-cross-${TARGET_ARCH}"
inherit cross
DEPENDS = "clang-native virtual/cross-binutils ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', 'lld-native', '', d)}"
do_install() {
install -d ${D}${bindir}
for tool in clang-tidy lld ld.lld llvm-profdata \
llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov
do
if [ -x ${STAGING_BINDIR_NATIVE}/$tool ]; then
ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
fi
done
# GNU Linker and assembler is needed in same directory as clang binaries else
# it will fallback to host linker which is not desired
install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang
ln -sf ${TARGET_PREFIX}clang ${D}${bindir}/${TARGET_PREFIX}clang++
}
# clang driver being copied above is already stripped
INHIBIT_SYSROOT_STRIP = "1"