diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-07-29 10:48:35 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-07-29 15:01:18 +0200 |
commit | 57facd4556240e961d44298082b9105b0d62f0c6 (patch) | |
tree | f40e08e3314d5e970d5eef954aeb50cc3bf23024 /CC/foreign/cmake | |
parent | e3bf397df26fc63c7348ec834bf7e6f31ef6f894 (diff) | |
download | rules-cc-57facd4556240e961d44298082b9105b0d62f0c6.tar.gz |
foreign rules: always honor toolchain environment and ENV
Even for trivial actions, do not rely on the framework to pull in
enough paths to correctly iterpret argv[0]. A remote execution is
supposed to interpret argv[0] in the set environment; in particular,
if PATH is empty it is correct behaviour to not find any program
by basename.
Diffstat (limited to 'CC/foreign/cmake')
-rw-r--r-- | CC/foreign/cmake/RULES | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/CC/foreign/cmake/RULES b/CC/foreign/cmake/RULES index 917b4af..aa0c5d7 100644 --- a/CC/foreign/cmake/RULES +++ b/CC/foreign/cmake/RULES @@ -165,6 +165,7 @@ , "for host": ["transitions", "for host"] , "map_provider": ["", "field_map_provider"] , "sh": ["shell", "sh"] + , "sh-PATH": ["shell", "PATH"] } , "config_transitions": { "defaults": @@ -248,6 +249,27 @@ , "body": {"type": "CALL_EXPRESSION", "name": "sh"} } ] + , [ "sh-PATH" + , { "type": "join" + , "separator": ":" + , "$1": + { "type": "let*" + , "bindings": [["fieldname", "shell defaults"]] + , "body": {"type": "CALL_EXPRESSION", "name": "sh-PATH"} + } + } + ] + , [ "sh-ENV" + , { "type": "if" + , "cond": {"type": "var", "name": "sh-PATH"} + , "then": + { "type": "singleton_map" + , "key": "PATH" + , "value": {"type": "var", "name": "sh-PATH"} + } + , "else": {"type": "empty_map"} + } + ] , [ "install_dir" , { "type": "ACTION" , "inputs": @@ -260,6 +282,16 @@ , "cmd": [{"type": "var", "name": "sh"}, "-c", ":"] , "outs": {"type": "var", "name": "installed_out_files"} , "out_dirs": {"type": "var", "name": "installed_out_dirs"} + , "env": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "sh-ENV"} + , { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + ] + } } ] , [ "out_files" @@ -516,6 +548,7 @@ , "for host": ["transitions", "for host"] , "map_provider": ["", "field_map_provider"] , "sh": ["shell", "sh"] + , "sh-PATH": ["shell", "PATH"] } , "config_transitions": { "defaults": @@ -686,6 +719,27 @@ , "body": {"type": "CALL_EXPRESSION", "name": "sh"} } ] + , [ "sh-PATH" + , { "type": "join" + , "separator": ":" + , "$1": + { "type": "let*" + , "bindings": [["fieldname", "shell defaults"]] + , "body": {"type": "CALL_EXPRESSION", "name": "sh-PATH"} + } + } + ] + , [ "sh-ENV" + , { "type": "if" + , "cond": {"type": "var", "name": "sh-PATH"} + , "then": + { "type": "singleton_map" + , "key": "PATH" + , "value": {"type": "var", "name": "sh-PATH"} + } + , "else": {"type": "empty_map"} + } + ] , [ "install_dir" , { "type": "ACTION" , "inputs": @@ -698,6 +752,16 @@ , "cmd": [{"type": "var", "name": "sh"}, "-c", ":"] , "outs": {"type": "var", "name": "installed_files"} , "out_dirs": {"type": "var", "name": "installed_dirs"} + , "env": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "sh-ENV"} + , { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + ] + } } ] , [ "hdrs" |