From daeedba20ada9dc40e892725a857c41e484b2a28 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 28 May 2024 09:57:05 +0200 Subject: New rule ["shell", "cmds"] Add a new rule to execute shell comands, honoring the shell tool chain. Is is done in such a way, that coreutils (in particular, pwd) can also come from the binary dirs of the shell tool chain. --- shell/EXPRESSIONS | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'shell/EXPRESSIONS') diff --git a/shell/EXPRESSIONS b/shell/EXPRESSIONS index 722e897..34a5c92 100644 --- a/shell/EXPRESSIONS +++ b/shell/EXPRESSIONS @@ -99,4 +99,73 @@ , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } } +, "prolog": + { "vars": ["fieldname", "TOOLCHAIN_DIR"] + , "imports": {"list_provider": ["./", "..", "field_list_provider"]} + , "expression": + { "type": "let*" + , "bindings": + [ ["provider", "bin dirs"] + , ["bin dirs", {"type": "CALL_EXPRESSION", "name": "list_provider"}] + , [ "relative paths" + , { "type": "foreach" + , "range": {"type": "var", "name": "bin dirs"} + , "body": + { "type": "join" + , "separator": "/" + , "$1": + [ "." + , { "type": "var" + , "name": "TOOLCHAIN_DIR" + , "default": "toolchain" + } + , {"type": "var", "name": "_"} + ] + } + } + ] + , [ "pwd paths" + , { "type": "foreach" + , "range": {"type": "var", "name": "bin dirs"} + , "body": + { "type": "join" + , "separator": "/" + , "$1": + [ "$(pwd)" + , { "type": "var" + , "name": "TOOLCHAIN_DIR" + , "default": "toolchain" + } + , {"type": "var", "name": "_"} + ] + } + } + ] + ] + , "body": + [ "__PATH=$PATH" + , { "type": "join" + , "$1": + [ "export PATH=" + , { "type": "join" + , "separator": ":" + , "$1": {"type": "var", "name": "relative paths"} + } + , "${PATH:+:}${PATH}" + ] + } + , { "type": "join" + , "$1": + [ "export PATH=" + , { "type": "join" + , "separator": ":" + , "$1": {"type": "var", "name": "pwd paths"} + } + , "${__PATH:+:}${__PATH}" + ] + } + , "unset __PATH" + ] + } + } } -- cgit v1.2.3