diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-02-16 12:58:33 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-30 15:33:18 +0200 |
commit | e881a7945c501c1b328cd8012f81687621a5954b (patch) | |
tree | 540ce8d7766ed1e3e80ad27685e0ca577a56e72d | |
parent | f092ccd2ddd1eff0e9956838aadca8b1b7d5b52b (diff) | |
download | rules-cc-e881a7945c501c1b328cd8012f81687621a5954b.tar.gz |
rules-cc/foreign/make: Support configure step
-rw-r--r-- | CC/foreign/make/EXPRESSIONS | 62 | ||||
-rw-r--r-- | CC/foreign/make/RULES | 18 |
2 files changed, 65 insertions, 15 deletions
diff --git a/CC/foreign/make/EXPRESSIONS b/CC/foreign/make/EXPRESSIONS index be468e7..e175528 100644 --- a/CC/foreign/make/EXPRESSIONS +++ b/CC/foreign/make/EXPRESSIONS @@ -2,6 +2,8 @@ { "vars": [ "source_dir" , "subdir" + , "configure" + , "configure_options" , "make_targets" , "make_prefix" , "make_options" @@ -108,6 +110,20 @@ } } ] + , [ "PREFIX" + , { "type": "if" + , "cond": {"type": "var", "name": "make_prefix"} + , "then": + { "type": "join" + , "separator": "/" + , "$1": + { "type": "++" + , "$1": [[""], {"type": "var", "name": "make_prefix"}] + } + } + , "else": {"type": "var", "name": "PREFIX", "default": "/"} + } + ] , [ "ENV" , { "type": "map_union" , "$1": @@ -187,19 +203,7 @@ {"type": "join", "$1": {"type": "var", "name": "var_prefix"}} , "else": "PREFIX" } - , "value": - { "type": "if" - , "cond": {"type": "var", "name": "make_prefix"} - , "then": - { "type": "join" - , "separator": "/" - , "$1": - { "type": "++" - , "$1": [[""], {"type": "var", "name": "make_prefix"}] - } - } - , "else": {"type": "var", "name": "PREFIX", "default": "/"} - } + , "value": {"type": "var", "name": "PREFIX"} } ] } @@ -210,6 +214,21 @@ , "$1": {"type": "var", "name": "subdir", "default": []} } ] + , [ "configure_args" + , { "type": "if" + , "cond": {"type": "var", "name": "configure"} + , "then": + { "type": "++" + , "$1": + [ {"type": "var", "name": "configure_options", "default": []} + , [ { "type": "join" + , "$1": ["--prefix=", {"type": "var", "name": "PREFIX"}] + } + ] + ] + } + } + ] , [ "make_targets" , { "type": "if" , "cond": {"type": "var", "name": "make_targets"} @@ -247,6 +266,23 @@ , "readonly VAR_DESTDIR=$2" , "shift 2" ] + , { "type": "if" + , "cond": {"type": "var", "name": "configure_args"} + , "then": + [ "( readonly ROOT=\"$(pwd)\"" + , " cd \"source/${SUBDIR}\"" + , { "type": "join" + , "$1": + [ "./configure " + , { "type": "join_cmd" + , "$1": {"type": "var", "name": "configure_args"} + } + , " >\"${ROOT}/configure.log\" || (cat \"${ROOT}/configure.log\" && exit 1)" + ] + } + , ")" + ] + } , { "type": "foreach" , "range": {"type": "var", "name": "make_targets"} , "var": "target" diff --git a/CC/foreign/make/RULES b/CC/foreign/make/RULES index b982946..2a6b2da 100644 --- a/CC/foreign/make/RULES +++ b/CC/foreign/make/RULES @@ -1,8 +1,10 @@ { "data": - { "doc": ["Data produced by Make build and install."] + { "doc": ["Data produced by Configure and Make build and install."] , "target_fields": ["project"] , "string_fields": [ "subdir" + , "configure" + , "configure_options" , "targets" , "prefix" , "options" @@ -42,6 +44,9 @@ [ "The subdirectory that contains the configure and Makefile. Individual" , "directory components are joined with \"/\"." ] + , "configure": ["Run ./configure if non-empty."] + , "configure_options": + ["The configure options (the \"--prefix\" option is automatically set."] , "targets": [ "The Make targets to build in the specified order" , "(default: [\"install\"])." @@ -204,6 +209,8 @@ } ] , ["subdir", {"type": "FIELD", "name": "subdir"}] + , ["configure", {"type": "FIELD", "name": "configure"}] + , ["configure_options", {"type": "FIELD", "name": "configure_options"}] , ["make_targets", {"type": "FIELD", "name": "targets"}] , ["make_prefix", {"type": "FIELD", "name": "prefix"}] , ["make_options", {"type": "FIELD", "name": "options"}] @@ -264,13 +271,15 @@ } } , "library": - { "doc": ["Library produced by Make build and install."] + { "doc": ["Library produced by Configure and Make build and install."] , "target_fields": ["project", "deps"] , "string_fields": [ "subdir" , "name" , "version" , "stage" + , "configure" + , "configure_options" , "targets" , "prefix" , "options" @@ -328,6 +337,9 @@ [ "The library version, used for pkg-config files. Individual version" , "components are joined with \".\"." ] + , "configure": ["Run ./configure if non-empty."] + , "configure_options": + ["The configure options (the \"--prefix\" option is automatically set."] , "targets": [ "The Make targets to build in the specified order" , "(default: [\"install\"])." @@ -599,6 +611,8 @@ } ] , ["subdir", {"type": "FIELD", "name": "subdir"}] + , ["configure", {"type": "FIELD", "name": "configure"}] + , ["configure_options", {"type": "FIELD", "name": "configure_options"}] , ["make_targets", {"type": "FIELD", "name": "targets"}] , ["make_prefix", {"type": "FIELD", "name": "prefix"}] , ["make_options", {"type": "FIELD", "name": "options"}] |