From 54393b2288110c8d2ebcc0c19c14b62e286a6ab9 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 29 Jul 2024 11:06:44 +0200 Subject: ["CC", "libary"] properly stage ar action In this action we support a user provided toolchain, hence all the components of the library need to go into a subdirectory to avoid staiging conflicts. --- CC/EXPRESSIONS | 69 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index c7ee9e0..34c0ed4 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1047,26 +1047,59 @@ , "cond": {"type": "var", "name": "objects"} , "else": {"type": "empty_map"} , "then": - { "type": "ACTION" - , "outs": [{"type": "var", "name": "libpath"}] - , "inputs": - { "type": "map_union" - , "$1": - [ {"type": "var", "name": "TOOLCHAIN"} - , {"type": "var", "name": "objects"} + { "type": "let*" + , "bindings": + [ [ "staged objects" + , { "type": "to_subdir" + , "subdir": "work" + , "$1": {"type": "var", "name": "objects"} + } ] - } - , "env": - {"type": "var", "name": "ENV", "default": {"type": "empty_map"}} - , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "AR", "default": "ar"} - , "cqs" - , {"type": "var", "name": "libpath"} - ] - , {"type": "keys", "$1": {"type": "var", "name": "objects"}} + , [ "staged libpath" + , { "type": "join" + , "$1": ["work/", {"type": "var", "name": "libpath"}] + } + ] + , [ "staged lib" + , { "type": "ACTION" + , "outs": [{"type": "var", "name": "staged libpath"}] + , "inputs": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "TOOLCHAIN"} + , {"type": "var", "name": "staged objects"} + ] + } + , "env": + { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + , "cmd": + { "type": "++" + , "$1": + [ [ {"type": "var", "name": "AR", "default": "ar"} + , "cqs" + , {"type": "var", "name": "staged libpath"} + ] + , { "type": "keys" + , "$1": {"type": "var", "name": "staged objects"} + } + ] + } + } + ] + , [ "lib artifact" + , { "type": "lookup" + , "map": {"type": "var", "name": "staged lib"} + , "key": {"type": "var", "name": "staged libpath"} + } ] + ] + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "libpath"} + , "value": {"type": "var", "name": "lib artifact"} } } } -- cgit v1.2.3 From 128ff7d3abd575419e719ad224d9a42ee93d09a6 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 29 Jul 2024 11:31:50 +0200 Subject: ["CC", "binary"] stage link action ... to avoid staging conflicts with the toolchain --- CC/EXPRESSIONS | 100 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 21 deletions(-) diff --git a/CC/EXPRESSIONS b/CC/EXPRESSIONS index 34c0ed4..ab7c922 100644 --- a/CC/EXPRESSIONS +++ b/CC/EXPRESSIONS @@ -1387,40 +1387,98 @@ , "else": {"type": "var", "name": "name"} } ] - , [ "binary" + , [ "binpath (in work)" + , {"type": "join", "$1": ["work/", {"type": "var", "name": "binpath"}]} + ] + , ["TOOLCHAIN_DIR", "../toolchain"] + , ["COMPILER", {"type": "CALL_EXPRESSION", "name": "compiler"}] + , [ "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"}] + } + ] + } + } + } + ] + } + ] + , [ "cmd" + , { "type": "++" + , "$1": + [ [ {"type": "var", "name": "COMPILER"} + , "-o" + , {"type": "var", "name": "binpath"} + ] + , {"type": "var", "name": "COMPILE_FLAGS"} + , {"type": "var", "name": "link-args"} + , {"type": "var", "name": "LDFLAGS"} + ] + } + ] + , [ "binary (in work)" , { "type": "ACTION" - , "outs": [{"type": "var", "name": "binpath"}] + , "outs": [{"type": "var", "name": "binpath (in work)"}] , "inputs": { "type": "disjoint_map_union" , "$1": [ {"type": "var", "name": "TOOLCHAIN"} - , {"type": "var", "name": "objects"} - , {"type": "var", "name": "link-deps"} - , { "type": "var" - , "name": "cflags-files" - , "default": {"type": "empty_map"} - } - , { "type": "var" - , "name": "ldflags-files" - , "default": {"type": "empty_map"} + , { "type": "to_subdir" + , "subdir": "work" + , "$1": + { "type": "disjoint_map_union" + , "$1": + [ {"type": "var", "name": "objects"} + , {"type": "var", "name": "link-deps"} + , { "type": "var" + , "name": "cflags-files" + , "default": {"type": "empty_map"} + } + , { "type": "var" + , "name": "ldflags-files" + , "default": {"type": "empty_map"} + } + ] + } } ] } , "cmd": - { "type": "++" - , "$1": - [ [ {"type": "var", "name": "COMPILER"} - , "-o" - , {"type": "var", "name": "binpath"} + [ "sh" + , "-c" + , { "type": "join" + , "$1": + [ "cd work && " + , {"type": "join_cmd", "$1": {"type": "var", "name": "cmd"}} ] - , {"type": "var", "name": "COMPILE_FLAGS"} - , {"type": "var", "name": "link-args"} - , {"type": "var", "name": "LDFLAGS"} - ] - } + } + ] , "env": {"type": "var", "name": "ENV"} } ] + , [ "binary" + , { "type": "singleton_map" + , "key": {"type": "var", "name": "binpath"} + , "value": + { "type": "lookup" + , "map": {"type": "var", "name": "binary (in work)"} + , "key": {"type": "var", "name": "binpath (in work)"} + } + } + ] ] , "body": {"type": "var", "name": "binary"} } -- cgit v1.2.3