configure_make hard requires `configure_in_place` for certain attributes (#633)

This commit is contained in:
UebelAndre 2021-05-08 22:24:30 -07:00 committed by GitHub
parent 62fcc5f143
commit 32b0c10972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 9 deletions

View File

@ -153,14 +153,14 @@ Rule for building external libraries with configure-make pattern. Some 'configur
| <a id="configure_make-additional_tools"></a>additional_tools | Optional additional tools needed for the building. Not used by the shell script part in cc_external_rule_impl. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="configure_make-alwayslink"></a>alwayslink | Optional. if true, link all the object files from the static library, even if they are not used. | Boolean | optional | False |
| <a id="configure_make-args"></a>args | A list of arguments to pass to the call to <code>make</code> | List of strings | optional | [] |
| <a id="configure_make-autoconf"></a>autoconf | Set to True if 'autoconf' should be invoked before 'configure', currently requires 'configure_in_place' to be True. | Boolean | optional | False |
| <a id="configure_make-autoconf"></a>autoconf | Set to True if 'autoconf' should be invoked before 'configure', currently requires <code>configure_in_place</code> to be True. | Boolean | optional | False |
| <a id="configure_make-autoconf_env_vars"></a>autoconf_env_vars | Environment variables to be set for 'autoconf' invocation. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="configure_make-autoconf_options"></a>autoconf_options | Any options to be put in the 'autoconf.sh' command line. | List of strings | optional | [] |
| <a id="configure_make-autogen"></a>autogen | Set to True if 'autogen.sh' should be invoked before 'configure', currently requires 'configure_in_place' to be True. | Boolean | optional | False |
| <a id="configure_make-autogen"></a>autogen | Set to True if 'autogen.sh' should be invoked before 'configure', currently requires <code>configure_in_place</code> to be True. | Boolean | optional | False |
| <a id="configure_make-autogen_command"></a>autogen_command | The name of the autogen script file, default: autogen.sh. Many projects use autogen.sh however the Autotools FAQ recommends bootstrap so we provide this option to support that. | String | optional | "autogen.sh" |
| <a id="configure_make-autogen_env_vars"></a>autogen_env_vars | Environment variables to be set for 'autogen' invocation. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="configure_make-autogen_options"></a>autogen_options | Any options to be put in the 'autogen.sh' command line. | List of strings | optional | [] |
| <a id="configure_make-autoreconf"></a>autoreconf | Set to True if 'autoreconf' should be invoked before 'configure.', currently requires 'configure_in_place' to be True. | Boolean | optional | False |
| <a id="configure_make-autoreconf"></a>autoreconf | Set to True if 'autoreconf' should be invoked before 'configure.', currently requires <code>configure_in_place</code> to be True. | Boolean | optional | False |
| <a id="configure_make-autoreconf_env_vars"></a>autoreconf_env_vars | Environment variables to be set for 'autoreconf' invocation. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="configure_make-autoreconf_options"></a>autoreconf_options | Any options to be put in the 'autoreconf.sh' command line. | List of strings | optional | [] |
| <a id="configure_make-configure_command"></a>configure_command | The name of the configuration script file, default: configure. The file must be in the root of the source directory. | String | optional | "configure" |

View File

@ -22,6 +22,21 @@ def _configure_make(ctx):
tools_deps = ctx.attr.tools_deps + make_data.deps
if ctx.attr.autogen and not ctx.attr.configure_in_place:
fail("`autogen` requires `configure_in_place = True`. Please update {}".format(
ctx.label,
))
if ctx.attr.autoconf and not ctx.attr.configure_in_place:
fail("`autoconf` requires `configure_in_place = True`. Please update {}".format(
ctx.label,
))
if ctx.attr.autoreconf and not ctx.attr.configure_in_place:
fail("`autoreconf` requires `configure_in_place = True`. Please update {}".format(
ctx.label,
))
copy_results = "##copy_dir_contents_to_dir## $$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$ $$INSTALLDIR$$\n"
attrs = create_attrs(
@ -112,7 +127,7 @@ def _attrs():
default = False,
doc = (
"Set to True if 'autoconf' should be invoked before 'configure', " +
"currently requires 'configure_in_place' to be True."
"currently requires `configure_in_place` to be True."
),
),
"autoconf_env_vars": attr.string_dict(
@ -124,7 +139,7 @@ def _attrs():
"autogen": attr.bool(
doc = (
"Set to True if 'autogen.sh' should be invoked before 'configure', " +
"currently requires 'configure_in_place' to be True."
"currently requires `configure_in_place` to be True."
),
mandatory = False,
default = False,
@ -146,7 +161,7 @@ def _attrs():
"autoreconf": attr.bool(
doc = (
"Set to True if 'autoreconf' should be invoked before 'configure.', " +
"currently requires 'configure_in_place' to be True."
"currently requires `configure_in_place` to be True."
),
mandatory = False,
default = False,

View File

@ -41,7 +41,7 @@ def create_configure_script(
root_path = "$$BUILD_TMPDIR$$"
configure_path = "{}/{}".format(root_path, configure_command)
if autogen and configure_in_place:
if autogen:
# NOCONFIGURE is pseudo standard and tells the script to not invoke configure.
# We explicitly invoke configure later.
autogen_env_vars = _get_autogen_env_vars(autogen_env_vars)
@ -52,13 +52,13 @@ def create_configure_script(
" ".join(autogen_options),
).lstrip())
if autoconf and configure_in_place:
if autoconf:
script.append("{} autoconf {}".format(
" ".join(["{}=\"{}\"".format(key, autoconf_env_vars[key]) for key in autoconf_env_vars]),
" ".join(autoconf_options),
).lstrip())
if autoreconf and configure_in_place:
if autoreconf:
script.append("{} autoreconf {}".format(
" ".join(['{}="{}"'.format(key, autoreconf_env_vars[key]) for key in autoreconf_env_vars]),
" ".join(autoreconf_options),