From 9d190cb3b31ce9b959302f28933f8cddef701497 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 27 Mar 2021 11:22:07 -0700 Subject: llvm-project-source: Re-implement add_more_target_vendors in python This is to avoid a ton of shell variables becoming dependencies Add every case in a new line Signed-off-by: Khem Raj --- ...4-set-Yocto-based-GCC-install-search-path.patch | 6 ++--- recipes-devtools/clang/llvm-project-source.inc | 31 +++++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch index dd4317f..dd5a9a2 100644 --- a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch +++ b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch @@ -56,15 +56,13 @@ Signed-off-by: Khem Raj clang/lib/Driver/ToolChains/Gnu.cpp | 1 + 1 file changed, 1 insertion(+) -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 05d1d3003881..e56812145e6d 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2109,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( +@@ -2109,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetecto "x86_64-redhat-linux", "x86_64-suse-linux", "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux", "x86_64-unknown-linux", -+ "x86_64-oe-linux", //CLANG_EXTRA_OE_VENDORS_TRIPLES ++ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES "x86_64-amazon-linux", "x86_64-linux-android"}; static const char *const X32LibDirs[] = {"/libx32"}; static const char *const X86LibDirs[] = {"/lib32", "/lib"}; diff --git a/recipes-devtools/clang/llvm-project-source.inc b/recipes-devtools/clang/llvm-project-source.inc index c954f4e..8ccc4b1 100644 --- a/recipes-devtools/clang/llvm-project-source.inc +++ b/recipes-devtools/clang/llvm-project-source.inc @@ -19,19 +19,26 @@ INHIBIT_DEFAULT_DEPS = "1" DEPENDS = "" PACKAGES = "" -# additional TARGET_VENDOR values we want to support +# space separated list of additional distro vendor values we want to support e.g. +# "yoe webos" or "-yoe -webos" '-' is optional CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR}" -add_more_target_vendors() { - local cases="" triples="" - for dash_vendor in ${CLANG_EXTRA_OE_VENDORS}; do - vendor=`echo $dash_vendor | sed 's/^-//g'` - cases="$cases.Case(\"$vendor\", Triple::OpenEmbedded)" - triples="$triples\"x86_64-$vendor-linux\"," - done - bbnote "Adding support following TARGET_VENDOR values: ${CLANG_EXTRA_OE_VENDORS} in ${S}/llvm/lib/Support/Triple.cpp and ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" - sed "s#//CLANG_EXTRA_OE_VENDORS_CASES#$cases#g" -i ${S}/llvm/lib/Support/Triple.cpp - sed "s#//CLANG_EXTRA_OE_VENDORS_TRIPLES#$triples#g" -i ${S}/clang/lib/Driver/ToolChains/Gnu.cpp +python add_distro_vendor() { + import subprocess + case = "" + triple = "" + vendors = d.getVar('CLANG_EXTRA_OE_VENDORS') + for vendor in vendors.split(): + # convert -yoe into yoe + vendor = vendor.lstrip('-') + if vendor == "oe": + continue + case += '\\n .Case("' + vendor + '", Triple::OpenEmbedded)' + triple += ' "x86_64-' + vendor + '-linux",' + cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" % (triple)) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/Support/Triple.cpp" % (case)) + subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) } -do_patch[postfuncs] += "add_more_target_vendors" +do_patch[postfuncs] += "add_distro_vendor" -- cgit v1.2.3-54-g00ecf