summaryrefslogtreecommitdiff
path: root/CC/foreign/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-08-16 15:10:31 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-08-16 15:37:37 +0200
commit54bb2a33b3e36123f8f411f77ec8e76f5b021e3d (patch)
treef1ccc4416475df33a9e494cf8e27d5843bbc6a3f /CC/foreign/EXPRESSIONS
parentebf3cf04bc80ae7bf083220e63e739bf32151c95 (diff)
downloadrules-cc-54bb2a33b3e36123f8f411f77ec8e76f5b021e3d.tar.gz
rules: Propagate PATH list from defaults
... instead of creating an ENV from it and propagating this. The idea is to keep PATH entries separate and only join them with ":" when we need it. In this way, we can accumulate PATHs from multiple defaults later, and perform a deduplication ("nub_left") to shorten the final string length.
Diffstat (limited to 'CC/foreign/EXPRESSIONS')
-rw-r--r--CC/foreign/EXPRESSIONS31
1 files changed, 31 insertions, 0 deletions
diff --git a/CC/foreign/EXPRESSIONS b/CC/foreign/EXPRESSIONS
index 64e0e27..1692f83 100644
--- a/CC/foreign/EXPRESSIONS
+++ b/CC/foreign/EXPRESSIONS
@@ -43,6 +43,7 @@
, "imports":
{ "compiler-cc": ["CC", "compiler-cc"]
, "default-ENV": ["CC", "default-ENV"]
+ , "default-PATH": ["CC", "default-PATH"]
, "default-TOOLCHAIN": ["CC", "default-TOOLCHAIN"]
, "default-NON_SYSTEM_TOOLS": ["CC", "default-NON_SYSTEM_TOOLS"]
}
@@ -69,6 +70,36 @@
]
}
]
+ , [ "ENV_PATH"
+ , { "type": "lookup"
+ , "map": {"type": "var", "name": "ENV"}
+ , "key": "PATH"
+ }
+ ]
+ , [ "ENV"
+ , { "type": "map_union"
+ , "$1":
+ [ {"type": "var", "name": "ENV"}
+ , { "type": "singleton_map"
+ , "key": "PATH"
+ , "value":
+ { "type": "join"
+ , "separator": ":"
+ , "$1":
+ { "type": "++"
+ , "$1":
+ [ {"type": "CALL_EXPRESSION", "name": "default-PATH"}
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "ENV_PATH"}
+ , "then": [{"type": "var", "name": "ENV_PATH"}]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ ]
, [ "expand_exec.c"
, { "type": "singleton_map"
, "key": "expand_exec.c"