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/make/RULES | |
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/make/RULES')
-rw-r--r-- | CC/foreign/make/RULES | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/CC/foreign/make/RULES b/CC/foreign/make/RULES index e831d4c..f084f24 100644 --- a/CC/foreign/make/RULES +++ b/CC/foreign/make/RULES @@ -181,6 +181,7 @@ , "for host": ["transitions", "for host"] , "map_provider": ["", "field_map_provider"] , "sh": ["shell", "sh"] + , "sh-PATH": ["shell", "PATH"] } , "config_transitions": { "defaults": @@ -264,6 +265,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": @@ -276,6 +298,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" @@ -546,6 +578,7 @@ , "for host": ["transitions", "for host"] , "map_provider": ["", "field_map_provider"] , "sh": ["shell", "sh"] + , "sh-PATH": ["shell", "PATH"] } , "config_transitions": { "defaults": @@ -717,6 +750,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": @@ -729,6 +783,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" |