diff --git a/docs/README.md b/docs/README.md index 8c9e4066..07d995bc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -153,14 +153,14 @@ Rule for building external libraries with configure-make pattern. Some 'configur | additional_tools | Optional additional tools needed for the building. Not used by the shell script part in cc_external_rule_impl. | List of labels | optional | [] | | alwayslink | Optional. if true, link all the object files from the static library, even if they are not used. | Boolean | optional | False | | args | A list of arguments to pass to the call to make | List of strings | optional | [] | -| autoconf | Set to True if 'autoconf' should be invoked before 'configure', currently requires 'configure_in_place' to be True. | Boolean | optional | False | +| autoconf | Set to True if 'autoconf' should be invoked before 'configure', currently requires configure_in_place to be True. | Boolean | optional | False | | autoconf_env_vars | Environment variables to be set for 'autoconf' invocation. | Dictionary: String -> String | optional | {} | | autoconf_options | Any options to be put in the 'autoconf.sh' command line. | List of strings | optional | [] | -| autogen | Set to True if 'autogen.sh' should be invoked before 'configure', currently requires 'configure_in_place' to be True. | Boolean | optional | False | +| autogen | Set to True if 'autogen.sh' should be invoked before 'configure', currently requires configure_in_place to be True. | Boolean | optional | False | | 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" | | autogen_env_vars | Environment variables to be set for 'autogen' invocation. | Dictionary: String -> String | optional | {} | | autogen_options | Any options to be put in the 'autogen.sh' command line. | List of strings | optional | [] | -| autoreconf | Set to True if 'autoreconf' should be invoked before 'configure.', currently requires 'configure_in_place' to be True. | Boolean | optional | False | +| autoreconf | Set to True if 'autoreconf' should be invoked before 'configure.', currently requires configure_in_place to be True. | Boolean | optional | False | | autoreconf_env_vars | Environment variables to be set for 'autoreconf' invocation. | Dictionary: String -> String | optional | {} | | autoreconf_options | Any options to be put in the 'autoreconf.sh' command line. | List of strings | optional | [] | | 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" | diff --git a/foreign_cc/configure.bzl b/foreign_cc/configure.bzl index 9613227a..21a2b9d1 100644 --- a/foreign_cc/configure.bzl +++ b/foreign_cc/configure.bzl @@ -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, diff --git a/foreign_cc/private/configure_script.bzl b/foreign_cc/private/configure_script.bzl index 9e15cf6b..ff01d4a3 100644 --- a/foreign_cc/private/configure_script.bzl +++ b/foreign_cc/private/configure_script.bzl @@ -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),