diff options
Diffstat (limited to 'rules')
-rw-r--r-- | rules/CC/EXPRESSIONS | 434 | ||||
-rw-r--r-- | rules/CC/RULES | 91 | ||||
-rw-r--r-- | rules/transitions/EXPRESSIONS | 42 |
3 files changed, 425 insertions, 142 deletions
diff --git a/rules/CC/EXPRESSIONS b/rules/CC/EXPRESSIONS index 938c342..a4bdbd9 100644 --- a/rules/CC/EXPRESSIONS +++ b/rules/CC/EXPRESSIONS @@ -215,13 +215,20 @@ , "debug-deps": { "doc": ["Collect debug dependencies (sources/headers) from given target_fields"] - , "vars": ["deps-provider", "deps-fieldnames", "deps-transition"] + , "vars": + [ "deps-provider" + , "deps-fieldnames" + , "deps-transition" + , "modified-transitions" + ] , "vars_doc": { "deps-provider": ["Name of provider to use (debug-srcs/debug-hdrs)."] , "deps-fieldnames": ["List of target_field names to collect dependencies from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"provider_list": ["./", "..", "field_provider_list"]} , "expression": @@ -238,7 +245,17 @@ { "type": "let*" , "bindings": [ ["provider", {"type": "var", "name": "deps-provider"}] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] , ["default", {"type": "empty_map"}] ] , "body": [{"type": "CALL_EXPRESSION", "name": "provider_list"}] @@ -250,12 +267,14 @@ } , "compile-deps": { "doc": ["Collect compile dependencies (headers) from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect dependencies from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": { "runfiles_list": ["./", "..", "field_runfiles_list"] @@ -275,7 +294,17 @@ { "type": "let*" , "bindings": [ ["provider", "compile-deps"] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] , ["default", {"type": "empty_map"}] ] , "body": @@ -290,12 +319,14 @@ } , "compile-args-deps": { "doc": ["Collect compile arguments from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect arguments from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": @@ -308,7 +339,17 @@ { "type": "let*" , "bindings": [ ["provider", "compile-args"] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } @@ -317,38 +358,75 @@ } , "link-deps": { "doc": ["Collect link dependencies (libraries) from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": + [ "deps-fieldnames" + , "deps-transition" + , "modified-transitions" + , "component-fieldnames" + ] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect dependencies from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": { "artifacts_list": ["./", "..", "field_artifacts_list"] , "provider_list": ["./", "..", "field_provider_list"] } , "expression": - { "type": "disjoint_map_union" - , "$1": - { "type": "++" - , "$1": - { "type": "foreach" - , "var": "fieldname" - , "range": {"type": "var", "name": "deps-fieldnames"} - , "body": - { "type": "++" + { "type": "let*" + , "bindings": + [ [ "drop_artifacts" + , { "type": "set" , "$1": - { "type": "let*" - , "bindings": - [ ["provider", "link-deps"] - , ["default", {"type": "empty_map"}] - , ["transition", {"type": "var", "name": "deps-transition"}] - ] - , "body": - [ {"type": "CALL_EXPRESSION", "name": "provider_list"} - , {"type": "CALL_EXPRESSION", "name": "artifacts_list"} - ] + {"type": "var", "name": "component-fieldnames", "default": []} + } + ] + ] + , "body": + { "type": "disjoint_map_union" + , "$1": + { "type": "++" + , "$1": + { "type": "foreach" + , "var": "fieldname" + , "range": {"type": "var", "name": "deps-fieldnames"} + , "body": + { "type": "++" + , "$1": + { "type": "let*" + , "bindings": + [ ["provider", "link-deps"] + , ["default", {"type": "empty_map"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] + ] + , "body": + [ {"type": "CALL_EXPRESSION", "name": "provider_list"} + , { "type": "if" + , "cond": + { "type": "lookup" + , "map": {"type": "var", "name": "drop_artifacts"} + , "key": {"type": "var", "name": "fieldname"} + } + , "then": [] + , "else": + {"type": "CALL_EXPRESSION", "name": "artifacts_list"} + } + ] + } } } } @@ -357,12 +435,14 @@ } , "link-args-deps": { "doc": ["Collect linker arguments from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect arguments from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": @@ -375,7 +455,17 @@ { "type": "let*" , "bindings": [ ["provider", "link-args"] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } @@ -384,12 +474,14 @@ } , "run-libs-deps": { "doc": ["Collect runtime libraries from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect dependencies from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"provider_list": ["./", "..", "field_provider_list"]} , "expression": @@ -408,7 +500,17 @@ , "bindings": [ ["provider", "run-libs"] , ["default", {"type": "empty_map"}] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] ] , "body": {"type": "CALL_EXPRESSION", "name": "provider_list"} } @@ -420,12 +522,14 @@ , "run-libs-args-deps": { "doc": ["Collect runtime libraries link arguments from given target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect arguments from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"list_provider": ["./", "..", "field_list_provider"]} , "expression": @@ -438,7 +542,17 @@ { "type": "let*" , "bindings": [ ["provider", "run-libs-args"] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] ] , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} } @@ -447,12 +561,15 @@ } , "pkg-map-provider-deps": { "doc": ["Collect maps from provider \"package\" for given target_fields"] - , "vars": ["pkg-key", "deps-fieldnames", "deps-transition"] + , "vars": + ["pkg-key", "deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "pkg-key": ["Key to lookup in provider \"package\"."] , "deps-fieldnames": ["List of target_field names to collect maps from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"provider_list": ["./", "..", "field_provider_list"]} , "expression": @@ -468,7 +585,17 @@ , "bindings": [ ["provider", "package"] , ["default", {"type": "empty_map"}] - , ["transition", {"type": "var", "name": "deps-transition"}] + , [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] ] , "body": { "type": "foreach" @@ -488,11 +615,13 @@ } , "cflags-files-deps": { "doc": ["Collect cflags files from target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect files from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"pkg-provider": "pkg-map-provider-deps"} , "expression": @@ -503,11 +632,13 @@ } , "ldflags-files-deps": { "doc": ["Collect cflags files from target_fields"] - , "vars": ["deps-fieldnames", "deps-transition"] + , "vars": ["deps-fieldnames", "deps-transition", "modified-transitions"] , "vars_doc": { "deps-fieldnames": ["List of target_field names to collect files from."] , "deps-transition": ["The optional configuration transition for the targets."] + , "modified-transitions": + ["Map telling fields that need to be transitioned differently"] } , "imports": {"pkg-provider": "pkg-map-provider-deps"} , "expression": @@ -729,7 +860,11 @@ , "private-hdrs" , "compile-deps" , "cflags-files" + , "component-fieldnames" + , "deps-transition" + , "modified-transitions" ] + , "imports": {"field_artifacts": ["./", "..", "field_artifacts"]} , "expression": { "type": "let*" , "bindings": @@ -757,93 +892,129 @@ ] } ] - ] - , "body": - { "type": "map_union" - , "$1": - { "type": "foreach_map" - , "var_key": "src_name" - , "var_val": "src_val" - , "range": {"type": "var", "name": "srcs"} - , "body": - { "type": "let*" - , "bindings": - [ [ "work src_name" - , { "type": "join" - , "separator": "/" - , "$1": ["work", {"type": "var", "name": "src_name"}] - } - ] - , [ "inputs" - , { "type": "map_union" - , "$1": - [ {"type": "var", "name": "all hdrs"} - , { "type": "singleton_map" - , "key": {"type": "var", "name": "work src_name"} - , "value": {"type": "var", "name": "src_val"} + , [ "my objects" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "var_key": "src_name" + , "var_val": "src_val" + , "range": {"type": "var", "name": "srcs"} + , "body": + { "type": "let*" + , "bindings": + [ [ "work src_name" + , { "type": "join" + , "separator": "/" + , "$1": ["work", {"type": "var", "name": "src_name"}] } - , { "type": "var" - , "name": "cflags-files" - , "default": {"type": "empty_map"} + ] + , [ "inputs" + , { "type": "map_union" + , "$1": + [ {"type": "var", "name": "all hdrs"} + , { "type": "singleton_map" + , "key": {"type": "var", "name": "work src_name"} + , "value": {"type": "var", "name": "src_val"} + } + , { "type": "var" + , "name": "cflags-files" + , "default": {"type": "empty_map"} + } + , { "type": "var" + , "name": "TOOLCHAIN" + , "default": {"type": "empty_map"} + } + ] } - , { "type": "var" - , "name": "TOOLCHAIN" - , "default": {"type": "empty_map"} + ] + , [ "out" + , { "type": "change_ending" + , "$1": {"type": "var", "name": "src_name"} + , "ending": ".o" } ] - } - ] - , [ "out" - , { "type": "change_ending" - , "$1": {"type": "var", "name": "src_name"} - , "ending": ".o" - } - ] - , [ "work out" - , { "type": "join" - , "separator": "/" - , "$1": ["work", {"type": "var", "name": "out"}] - } - ] - , [ "action output" - , { "type": "ACTION" - , "outs": [{"type": "var", "name": "work out"}] - , "inputs": {"type": "var", "name": "inputs"} - , "env": - { "type": "var" - , "name": "ENV" - , "default": {"type": "empty_map"} - } - , "cmd": - { "type": "++" - , "$1": - [ [{"type": "var", "name": "COMPILER"}] - , {"type": "var", "name": "COMPILE_FLAGS"} - , ["-I", "work", "-isystem", "include"] - , ["-c", {"type": "var", "name": "work src_name"}] - , ["-o", {"type": "var", "name": "work out"}] - ] - } - } - ] - , [ "staged output artifact" - , { "type": "map_union" - , "$1": - { "type": "foreach_map" - , "range": {"type": "var", "name": "action output"} - , "var_val": "object" - , "body": - { "type": "singleton_map" - , "key": {"type": "var", "name": "out"} - , "value": {"type": "var", "name": "object"} + , [ "work out" + , { "type": "join" + , "separator": "/" + , "$1": ["work", {"type": "var", "name": "out"}] } - } - } - ] - ] - , "body": {"type": "var", "name": "staged output artifact"} + ] + , [ "action output" + , { "type": "ACTION" + , "outs": [{"type": "var", "name": "work out"}] + , "inputs": {"type": "var", "name": "inputs"} + , "env": + { "type": "var" + , "name": "ENV" + , "default": {"type": "empty_map"} + } + , "cmd": + { "type": "++" + , "$1": + [ [{"type": "var", "name": "COMPILER"}] + , {"type": "var", "name": "COMPILE_FLAGS"} + , ["-I", "work", "-isystem", "include"] + , ["-c", {"type": "var", "name": "work src_name"}] + , ["-o", {"type": "var", "name": "work out"}] + ] + } + } + ] + , [ "staged output artifact" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "action output"} + , "var_val": "object" + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "out"} + , "value": {"type": "var", "name": "object"} + } + } + } + ] + ] + , "body": {"type": "var", "name": "staged output artifact"} + } + } } - } + ] + , [ "component artifacts" + , { "type": "disjoint_map_union" + , "$1": + { "type": "foreach" + , "var": "fieldname" + , "range": + {"type": "var", "name": "component-fieldnames", "default": []} + , "body": + { "type": "let*" + , "bindings": + [ [ "transition" + , { "type": "lookup" + , "map": + { "type": "var" + , "name": "modified-transitions" + , "default": {"type": "empty_map"} + } + , "key": {"type": "var", "name": "fieldname"} + , "default": {"type": "var", "name": "deps-transition"} + } + ] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "field_artifacts"} + } + } + } + ] + ] + , "body": + { "type": "disjoint_map_union" + , "msg": "Stating conflict between own objects and objects of components" + , "$1": + [ {"type": "var", "name": "my objects"} + , {"type": "var", "name": "component artifacts"} + ] } } } @@ -999,6 +1170,9 @@ , "compile-args" , "cflags-files" , "defaults-transition" + , "component-fieldnames" + , "deps-transition" + , "modified-transitions" ] , "imports": { "compiler": "compiler" @@ -1184,6 +1358,10 @@ , "extra-provides" , "public-fieldnames" , "private-fieldnames" + , "component-fieldnames" + , "deps-transition" + , "modified-transitions" + , "defaults-transition" ] , "imports": { "compile-deps": "compile-deps" @@ -1354,6 +1532,9 @@ , "cflags-files" , "ldflags-files" , "defaults-transition" + , "component-fieldnames" + , "deps-transition" + , "modified-transitions" ] , "imports": { "compiler": "compiler" @@ -1559,8 +1740,10 @@ , "extra-provides" , "defaults-transition" , "deps-transition" + , "modified-transitions" , "public-fieldnames" , "private-fieldnames" + , "component-fieldnames" ] , "imports": { "compile-deps": "compile-deps" @@ -1761,6 +1944,7 @@ , "compile-args" , "cflags-files" , "defaults-transition" + , "component-fieldnames" ] , "imports": { "compiler": "compiler" @@ -1848,6 +2032,7 @@ , "AR" , "ENV" , "BUILD_POSITION_INDEPENDENT" + , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" , "DEBUG" , "name" , "pure C" @@ -1863,6 +2048,10 @@ , "extra-provides" , "public-fieldnames" , "private-fieldnames" + , "component-fieldnames" + , "deps-transition" + , "modified-transitions" + , "defaults-transition" ] , "imports": { "compile-deps": "compile-deps" @@ -1903,7 +2092,15 @@ , "$1": { "type": "++" , "$1": - [ {"type": "keys", "$1": {"type": "var", "name": "objects"}} + [ { "type": "if" + , "cond": + { "type": "var" + , "name": "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" + } + , "then": [] + , "else": + {"type": "keys", "$1": {"type": "var", "name": "objects"}} + } , {"type": "var", "name": "ldflags", "default": []} , {"type": "var", "name": "private-ldflags", "default": []} , {"type": "CALL_EXPRESSION", "name": "link-args-deps"} @@ -2209,6 +2406,7 @@ , "private-ldflags" , "stage" , "private-fieldnames" + , "component-fieldnames" ] , "imports": { "compile-deps": "compile-deps" diff --git a/rules/CC/RULES b/rules/CC/RULES index e5d887a..0a69375 100644 --- a/rules/CC/RULES +++ b/rules/CC/RULES @@ -384,6 +384,7 @@ , "private-deps" , "proto" , "private-proto" + , "components" ] , "string_fields": [ "name" @@ -398,7 +399,7 @@ , "soversion" , "pkg-name" ] - , "config_fields": ["shared", "object_only"] + , "config_fields": ["shared"] , "config_vars": [ "CC" , "CXX" @@ -411,6 +412,8 @@ , "AR" , "ENV" , "BUILD_POSITION_INDEPENDENT" + , "BUILD_OBJECT_ONLY" + , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" , "DEBUG" ] , "implicit": {"defaults": ["defaults"]} @@ -423,6 +426,11 @@ [ "Any header files that only need to be present when compiling the" , "source files, but are not needed for any consumer of the library." ] + , "components": + [ "Any other libraries that are considered part of this library;" + , "all object files of those are included unconditionally into this" + , "library." + ] , "stage": [ "The logical location of all header and source files, as well as the" , "resulting library file. Individual directory components are joined" @@ -473,15 +481,7 @@ , "duplicate work will be carried out, even if the same proto library" , "is used at various places)." ] - , "shared": - [ "If non-empty, produce a shared instead of a static library. Setting" - , "this option is mutually exclusive to the \"object_only\" option." - ] - , "object_only": - [ "If non-empty, produce an object library, resulting in object files" - , "added to the linker line of all depending targets. Setting this option" - , "is mutually exclusive to the \"shared\" option." - ] + , "shared": ["If non-empty, produce a shared instead of a static library."] , "soversion": [ "The SOVERSION for shared libraries. Individual version components are" , "joined with \".\"." @@ -544,6 +544,18 @@ , "ENV": ["The environment for any action generated."] , "BUILD_POSITION_INDEPENDENT": ["Build with -fPIC."] , "DEBUG": ["Compute the debug-stage, needed for local debugging."] + , "BUILD_OBJECT_ONLY": + [ "If true, produce an object library, resulting in object files" + , "added to the linker line of all depending targets. If this" + , "configuration is set, the \"shared\" option is ignored. This" + , "variable is cleared for all dependencies." + ] + , "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING": + [ "If true, do not include the objects in the provided \"link-args\"." + , "This allows consuming libraries that pick on the objects themselves" + , "to still forward the \"link-args\" of that library, and thus getting" + , "correct linking instructions for the resulting library." + ] } , "artifacts_doc": ["The actual library (libname.a) staged in the specified directory"] @@ -584,10 +596,12 @@ } , "imports": { "artifacts": ["./", "..", "field_artifacts"] + , "runfiles": ["./", "..", "field_runfiles"] , "static result": "lib result" , "shared result": "shared result" , "object result": "object result" - , "fPIC transition": ["transitions", "with fPIC"] + , "fPIC transition": ["transitions", "with fPIC, not object-only"] + , "component transition": ["transitions", "with fPIC, object-only"] } , "config_transitions": { "deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}] @@ -596,6 +610,8 @@ , "private-proto-deps": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}] , "defaults": [{"type": "CALL_EXPRESSION", "name": "fPIC transition"}] + , "components": + [{"type": "CALL_EXPRESSION", "name": "component transition"}] } , "expression": { "type": "let*" @@ -654,6 +670,27 @@ } } ] + , [ "component transition" + , {"type": "CALL_EXPRESSION", "name": "component transition"} + ] + , [ "component hdrs" + , { "type": "let*" + , "bindings": + [ ["fieldname", "components"] + , ["transition", {"type": "var", "name": "component transition"}] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "runfiles"} + } + ] + , [ "hdrs" + , { "type": "disjoint_map_union" + , "msg": "Staging conflict between component and own header files" + , "$1": + [ {"type": "var", "name": "hdrs"} + , {"type": "var", "name": "component hdrs"} + ] + } + ] , [ "private-hdrs" , { "type": "to_subdir" , "subdir": {"type": "var", "name": "stage"} @@ -688,26 +725,34 @@ , "proto-deps" , "private-proto-deps" , "defaults" + , "components" ] ] + , ["component-fieldnames", ["components"]] + , [ "modified-transitions" + , { "type": "singleton_map" + , "key": "components" + , "value": {"type": "var", "name": "component transition"} + } + ] + , [ "shared" + , { "type": "and" + , "$1": + [ {"type": "FIELD", "name": "shared"} + , { "type": "not" + , "$1": {"type": "var", "name": "BUILD_OBJECT_ONLY"} + } + ] + } + ] ] , "body": { "type": "cond" , "cond": - [ [ { "type": "and" - , "$1": - [ {"type": "FIELD", "name": "shared"} - , {"type": "FIELD", "name": "object_only"} - ] - } - , { "type": "fail" - , "msg": "Fields \"shared\" and \"object_only\" are mutually exclusive." - } - ] - , [ {"type": "FIELD", "name": "shared"} + [ [ {"type": "var", "name": "shared"} , {"type": "CALL_EXPRESSION", "name": "shared result"} ] - , [ {"type": "FIELD", "name": "object_only"} + , [ {"type": "var", "name": "BUILD_OBJECT_ONLY"} , {"type": "CALL_EXPRESSION", "name": "object result"} ] ] diff --git a/rules/transitions/EXPRESSIONS b/rules/transitions/EXPRESSIONS index fef8542..d1ecefa 100644 --- a/rules/transitions/EXPRESSIONS +++ b/rules/transitions/EXPRESSIONS @@ -24,9 +24,16 @@ [ "Transition that enables BUILD_POSITION_INDEPENDENT if config_field" , "\"shared\" is not empty." ] + , "var": ["BUILD_OBJECT_ONLY"] , "expression": { "type": "if" - , "cond": {"type": "FIELD", "name": "shared"} + , "cond": + { "type": "and" + , "$1": + [ {"type": "FIELD", "name": "shared"} + , {"type": "not", "$1": {"type": "var", "name": "BUILD_OBJECT_ONLY"}} + ] + } , "then": { "type": "singleton_map" , "key": "BUILD_POSITION_INDEPENDENT" @@ -35,6 +42,39 @@ , "else": {"type": "empty_map"} } } +, "with fPIC, not object-only": + { "doc": ["Like \"with fPIC\", but also clearing BUILD_OBJECT_ONLY"] + , "var": ["BUILD_OBJECT_ONLY"] + , "imports": {"with fPIC": "with fPIC"} + , "expression": + { "type": "map_union" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "with fPIC"} + , {"type": "singleton_map", "key": "BUILD_OBJECT_ONLY", "value": null} + , { "type": "singleton_map" + , "key": "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" + , "value": null + } + ] + } + } +, "with fPIC, object-only": + { "doc": + ["Like \"with fPIC\", but also unconditionally setting BUILD_OBJECT_ONLY"] + , "var": ["BUILD_OBJECT_ONLY"] + , "imports": {"with fPIC": "with fPIC"} + , "expression": + { "type": "map_union" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "with fPIC"} + , {"type": "singleton_map", "key": "BUILD_OBJECT_ONLY", "value": true} + , { "type": "singleton_map" + , "key": "BUILD_OBJECT_ONLY_DROP_OBJECT_LINKING" + , "value": true + } + ] + } + } , "target properties": { "vars": ["ARCH", "TARGET_ARCH", "ARCH_DISPATCH"] , "expression": |