diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-03-27 11:22:07 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-03-30 13:02:50 -0700 |
commit | 9d190cb3b31ce9b959302f28933f8cddef701497 (patch) | |
tree | 5bb9fe1e3ab61187f0ff2cb0f4767c7a2d4e9904 /recipes-devtools/clang/llvm-project-source.inc | |
parent | f234d64d3b22e09792011e620c431e8df126b460 (diff) | |
download | meta-clang-9d190cb3b31ce9b959302f28933f8cddef701497.tar.gz |
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 <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools/clang/llvm-project-source.inc')
-rw-r--r-- | recipes-devtools/clang/llvm-project-source.inc | 31 |
1 files changed, 19 insertions, 12 deletions
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" | |||
19 | DEPENDS = "" | 19 | DEPENDS = "" |
20 | PACKAGES = "" | 20 | PACKAGES = "" |
21 | 21 | ||
22 | # additional TARGET_VENDOR values we want to support | 22 | # space separated list of additional distro vendor values we want to support e.g. |
23 | # "yoe webos" or "-yoe -webos" '-' is optional | ||
23 | CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR}" | 24 | CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR}" |
24 | 25 | ||
25 | add_more_target_vendors() { | 26 | python add_distro_vendor() { |
26 | local cases="" triples="" | 27 | import subprocess |
27 | for dash_vendor in ${CLANG_EXTRA_OE_VENDORS}; do | 28 | case = "" |
28 | vendor=`echo $dash_vendor | sed 's/^-//g'` | 29 | triple = "" |
29 | cases="$cases.Case(\"$vendor\", Triple::OpenEmbedded)" | 30 | vendors = d.getVar('CLANG_EXTRA_OE_VENDORS') |
30 | triples="$triples\"x86_64-$vendor-linux\"," | 31 | for vendor in vendors.split(): |
31 | done | 32 | # convert -yoe into yoe |
32 | 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" | 33 | vendor = vendor.lstrip('-') |
33 | sed "s#//CLANG_EXTRA_OE_VENDORS_CASES#$cases#g" -i ${S}/llvm/lib/Support/Triple.cpp | 34 | if vendor == "oe": |
34 | sed "s#//CLANG_EXTRA_OE_VENDORS_TRIPLES#$triples#g" -i ${S}/clang/lib/Driver/ToolChains/Gnu.cpp | 35 | continue |
36 | case += '\\n .Case("' + vendor + '", Triple::OpenEmbedded)' | ||
37 | triple += ' "x86_64-' + vendor + '-linux",' | ||
38 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" % (triple)) | ||
39 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
40 | cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/Support/Triple.cpp" % (case)) | ||
41 | subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) | ||
35 | } | 42 | } |
36 | 43 | ||
37 | do_patch[postfuncs] += "add_more_target_vendors" | 44 | do_patch[postfuncs] += "add_distro_vendor" |