diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-05-13 11:07:43 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-05-15 13:45:18 +0200 |
commit | d246c53e66b22c7a5b2bb273be5478dba2467357 (patch) | |
tree | 209344799a8a51549d8ef27095ff657aeee25d9d /patch | |
parent | 07924d28e81fe36ddb8e020552a7392fcf1227a0 (diff) | |
download | rules-cc-d246c53e66b22c7a5b2bb273be5478dba2467357.tar.gz |
Add shell defaults
So far, our rules, where depending on the shell, implicitly use
"normal" defaults, hard-coded in the rules. Support configuring
those in a default target, in the same way we do so for other tools,
like the C compiler. In this, it is also possible to bring your
own shell, built as a (compiled) target.
Diffstat (limited to 'patch')
-rw-r--r-- | patch/RULES | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/patch/RULES b/patch/RULES index 446f842..e7d50f9 100644 --- a/patch/RULES +++ b/patch/RULES @@ -144,13 +144,15 @@ { "doc": ["Replace a file, logically in place, by a patched version"] , "target_fields": ["src", "patch"] , "config_vars": ["PATCH", "ENV"] - , "implicit": {"patch-defaults": ["defaults"]} + , "implicit": + {"patch-defaults": ["defaults"], "defaults": [["shell", "defaults"]]} , "field_doc": { "src": [ "The single source file to patch, typically an explicit file reference." ] , "patch": ["The patch to apply."] , "patch-defaults": ["The patch binary (and toolchain) to use"] + , "defaults": ["The shell toolchain to use"] } , "artifacts_doc": ["The patched file, staged to the position the of the original file"] @@ -163,12 +165,23 @@ , "default-ENV": "default-ENV" , "default-PATH": "default-PATH" , "default-NON_SYSTEM_TOOLS": "default-NON_SYSTEM_TOOLS" + , "sh-TOOLCHAIN": ["CC", "default-TOOLCHAIN"] + , "sh-PATH": ["CC", "default-PATH"] + , "sh": ["shell", "sh"] } , "expression": { "type": "let*" , "bindings": [ ["TOOLCHAIN_DIR", "toolchain"] - , ["TOOLCHAIN", {"type": "CALL_EXPRESSION", "name": "default-TOOLCHAIN"}] + , [ "TOOLCHAIN" + , { "type": "disjoint_map_union" + , "msg": "Staging conflict between patch and sh toolchain" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "default-TOOLCHAIN"} + , {"type": "CALL_EXPRESSION", "name": "sh-TOOLCHAIN"} + ] + } + ] , [ "TOOLCHAIN" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "TOOLCHAIN_DIR"} @@ -228,6 +241,7 @@ { "type": "++" , "$1": [ {"type": "CALL_EXPRESSION", "name": "default-PATH"} + , {"type": "CALL_EXPRESSION", "name": "sh-PATH"} , { "type": "if" , "cond": {"type": "var", "name": "ENV_PATH"} , "then": [{"type": "var", "name": "ENV_PATH"}] @@ -239,6 +253,7 @@ ] } ] + , ["sh", {"type": "CALL_EXPRESSION", "name": "sh"}] , [ "orig" , { "type": "let*" , "bindings": [["fieldname", "src"], ["location", "orig"]] @@ -294,7 +309,7 @@ , { "type": "ACTION" , "inputs": {"type": "var", "name": "inputs"} , "outs": ["patched"] - , "cmd": ["sh", "./run_patch.sh"] + , "cmd": [{"type": "var", "name": "sh"}, "./run_patch.sh"] , "env": {"type": "var", "name": "ENV"} } ] |