summaryrefslogtreecommitdiff
path: root/CC/foreign/shell/RULES
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-08-30 17:03:14 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-08-30 19:01:12 +0200
commit4118e0b9930d11f6062751db4f1656e8cc2a680a (patch)
treea839d9d63048f38f596e4613fdf5d11bd22b4ca2 /CC/foreign/shell/RULES
parenta27d18f2265c74804842c1170396dbc273c9e1c9 (diff)
downloadrules-cc-4118e0b9930d11f6062751db4f1656e8cc2a680a.tar.gz
foreign: Implement 'expand_exec' via POSIX shell
... and coreutils by default. This has the advantage that no C compiler and no specific toolchain definition is required to build rule-internal tools. 'expand_exec' is provided via an implicit target with proper config transition for host, so it could be overwritten by the rule user. The C code of the previous implementation is still kept as an example.
Diffstat (limited to 'CC/foreign/shell/RULES')
-rw-r--r--CC/foreign/shell/RULES18
1 files changed, 18 insertions, 0 deletions
diff --git a/CC/foreign/shell/RULES b/CC/foreign/shell/RULES
index fc682d5..ffffc26 100644
--- a/CC/foreign/shell/RULES
+++ b/CC/foreign/shell/RULES
@@ -29,6 +29,7 @@
, "implicit":
{ "defaults": [["CC", "defaults"]]
, "foreign-defaults": [["CC/foreign", "defaults"]]
+ , "expand_exec": [["./", "..", "expand_exec"]]
}
, "field_doc":
{ "project":
@@ -110,8 +111,15 @@
}
, "imports":
{ "artifacts": ["", "field_artifacts"]
+ , "stage_field": ["", "stage_singleton_field"]
, "shell-build": "shell-build"
, "install-deps": ["CC", "install-with-deps stage"]
+ , "for host": ["transitions", "for host"]
+ }
+ , "config_transitions":
+ { "defaults":
+ [{"type": "empty_map"}, {"type": "CALL_EXPRESSION", "name": "for host"}]
+ , "expand_exec": [{"type": "CALL_EXPRESSION", "name": "for host"}]
}
, "expression":
{ "type": "let*"
@@ -143,6 +151,16 @@
]
, ["outs", {"type": "FIELD", "name": "outs"}]
, ["out_dirs", {"type": "FIELD", "name": "out_dirs"}]
+ , [ "expand_exec"
+ , { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "expand_exec"]
+ , ["location", "expand_exec"]
+ , ["transition", {"type": "CALL_EXPRESSION", "name": "for host"}]
+ ]
+ , "body": {"type": "CALL_EXPRESSION", "name": "stage_field"}
+ }
+ ]
]
, "body":
{ "type": "RESULT"