diff options
-rw-r--r-- | rules/CC/RULES | 7 | ||||
-rw-r--r-- | rules/transitions/EXPRESSIONS | 25 |
2 files changed, 22 insertions, 10 deletions
diff --git a/rules/CC/RULES b/rules/CC/RULES index 33b8520e..c30aaee1 100644 --- a/rules/CC/RULES +++ b/rules/CC/RULES @@ -26,7 +26,10 @@ [ "Optional toolchain directory. A collection of artifacts that provide" , "the tools CC, CXX, and AR (if needed). Note that only artifacts of" , "the specified targets are considered (no runfiles etc.). Specifying" - , "this field extends artifacts from \"base\"." + , "this field extends artifacts from \"base\". If the toolchain" + , "supports cross-compilation, it should perform a dispatch on the" + , "configuration variable \"BUILD_ARCH\" to determine for which" + , "architecture to generate code for." ] , "deps": [ "Optional CC libraries any CC library and CC binary implicitly depend" @@ -69,7 +72,7 @@ , "with \":\". Specifying this field extends values from \"base\"." ] } - , "config_vars": ["ARCH", "HOST_ARCH"] + , "config_vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH"] , "imports": { "base-provides": "defaults-base-provides" , "base-provides-list": "defaults-base-provides-list" diff --git a/rules/transitions/EXPRESSIONS b/rules/transitions/EXPRESSIONS index 4fd0d1e9..596b20ef 100644 --- a/rules/transitions/EXPRESSIONS +++ b/rules/transitions/EXPRESSIONS @@ -1,13 +1,22 @@ { "for host": - { "vars": ["ARCH", "HOST_ARCH"] + { "vars": ["ARCH", "HOST_ARCH", "TARGET_ARCH"] , "expression": - { "type": "singleton_map" - , "key": "TARGET_ARCH" - , "value": - { "type": "var" - , "name": "HOST_ARCH" - , "default": {"type": "var", "name": "ARCH"} - } + { "type": "let*" + , "bindings": + [ [ "BUILD_ARCH" + , { "type": "var" + , "name": "TARGET_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + , [ "TARGET_ARCH" + , { "type": "var" + , "name": "HOST_ARCH" + , "default": {"type": "var", "name": "ARCH"} + } + ] + ] + , "body": {"type": "env", "vars": ["BUILD_ARCH", "TARGET_ARCH"]} } } , "target properties": |