Removed legacy `*env_vars` attributes from `cmake` and `configure_make` rule (#675)
* Removed legacy `*env_vars` attributes from `cmake` and `configure_make` rule. Use `env` instead. * Updated examples * Improved variable expansion * Fixed missing `build_data` attribute for `configure_make` * Fix environment variable quotes * Attempt to address quoted environment variables. * Updated documentation
This commit is contained in:
parent
0887dc8044
commit
3dbe409720
|
@ -137,10 +137,10 @@ cmake(
|
|||
|
||||
<pre>
|
||||
cmake(<a href="#cmake-name">name</a>, <a href="#cmake-additional_inputs">additional_inputs</a>, <a href="#cmake-additional_tools">additional_tools</a>, <a href="#cmake-alwayslink">alwayslink</a>, <a href="#cmake-build_args">build_args</a>, <a href="#cmake-build_data">build_data</a>, <a href="#cmake-cache_entries">cache_entries</a>,
|
||||
<a href="#cmake-data">data</a>, <a href="#cmake-defines">defines</a>, <a href="#cmake-deps">deps</a>, <a href="#cmake-env">env</a>, <a href="#cmake-env_vars">env_vars</a>, <a href="#cmake-generate_args">generate_args</a>, <a href="#cmake-generate_crosstool_file">generate_crosstool_file</a>, <a href="#cmake-install">install</a>,
|
||||
<a href="#cmake-install_args">install_args</a>, <a href="#cmake-lib_name">lib_name</a>, <a href="#cmake-lib_source">lib_source</a>, <a href="#cmake-linkopts">linkopts</a>, <a href="#cmake-out_bin_dir">out_bin_dir</a>, <a href="#cmake-out_binaries">out_binaries</a>, <a href="#cmake-out_headers_only">out_headers_only</a>,
|
||||
<a href="#cmake-out_include_dir">out_include_dir</a>, <a href="#cmake-out_interface_libs">out_interface_libs</a>, <a href="#cmake-out_lib_dir">out_lib_dir</a>, <a href="#cmake-out_shared_libs">out_shared_libs</a>, <a href="#cmake-out_static_libs">out_static_libs</a>,
|
||||
<a href="#cmake-postfix_script">postfix_script</a>, <a href="#cmake-targets">targets</a>, <a href="#cmake-tool_prefix">tool_prefix</a>, <a href="#cmake-tools_deps">tools_deps</a>, <a href="#cmake-working_directory">working_directory</a>)
|
||||
<a href="#cmake-data">data</a>, <a href="#cmake-defines">defines</a>, <a href="#cmake-deps">deps</a>, <a href="#cmake-env">env</a>, <a href="#cmake-generate_args">generate_args</a>, <a href="#cmake-generate_crosstool_file">generate_crosstool_file</a>, <a href="#cmake-install">install</a>, <a href="#cmake-install_args">install_args</a>,
|
||||
<a href="#cmake-lib_name">lib_name</a>, <a href="#cmake-lib_source">lib_source</a>, <a href="#cmake-linkopts">linkopts</a>, <a href="#cmake-out_bin_dir">out_bin_dir</a>, <a href="#cmake-out_binaries">out_binaries</a>, <a href="#cmake-out_headers_only">out_headers_only</a>, <a href="#cmake-out_include_dir">out_include_dir</a>,
|
||||
<a href="#cmake-out_interface_libs">out_interface_libs</a>, <a href="#cmake-out_lib_dir">out_lib_dir</a>, <a href="#cmake-out_shared_libs">out_shared_libs</a>, <a href="#cmake-out_static_libs">out_static_libs</a>, <a href="#cmake-postfix_script">postfix_script</a>, <a href="#cmake-targets">targets</a>,
|
||||
<a href="#cmake-tool_prefix">tool_prefix</a>, <a href="#cmake-tools_deps">tools_deps</a>, <a href="#cmake-working_directory">working_directory</a>)
|
||||
</pre>
|
||||
|
||||
Rule for building external library with CMake.
|
||||
|
@ -161,7 +161,6 @@ Rule for building external library with CMake.
|
|||
| <a id="cmake-defines"></a>defines | Optional compilation definitions to be passed to the dependencies of this library. They are NOT passed to the compiler, you should duplicate them in the configuration options. | List of strings | optional | [] |
|
||||
| <a id="cmake-deps"></a>deps | Optional dependencies to be copied into the directory structure. Typically those directly required for the external building of the library/binaries. (i.e. those that the external buidl system will be looking for and paths to which are provided by the calling rule) | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
|
||||
| <a id="cmake-env"></a>env | Environment variables to set during the build. <code>$(execpath)</code> macros may be used to point at files which are listed as <code>data</code>, <code>deps</code>, or <code>build_data</code>, but unlike with other rules, these will be replaced with absolute paths to those files, because the build does not run in the exec root. No other macros are supported. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="cmake-env_vars"></a>env_vars | CMake environment variable values to join with toolchain-defined. For example, additional <code>CXXFLAGS</code>. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="cmake-generate_args"></a>generate_args | Arguments for CMake's generate command. Arguments should be passed as key/value pairs. eg: <code>["-G Ninja", "--debug-output", "-DFOO=bar"]</code>. Note that unless a generator (<code>-G</code>) argument is provided, the default generators are [Unix Makefiles](https://cmake.org/cmake/help/latest/generator/Unix%20Makefiles.html) for Linux and MacOS and [Ninja](https://cmake.org/cmake/help/latest/generator/Ninja.html) for Windows. | List of strings | optional | [] |
|
||||
| <a id="cmake-generate_crosstool_file"></a>generate_crosstool_file | When True, CMake crosstool file will be generated from the toolchain values, provided cache-entries and env_vars (some values will still be passed as <code>-Dkey=value</code> and environment variables). If <code>CMAKE_TOOLCHAIN_FILE</code> cache entry is passed, specified crosstool file will be used When using this option to cross-compile, it is required to specify <code>CMAKE_SYSTEM_NAME</code> in the cache_entries | Boolean | optional | True |
|
||||
| <a id="cmake-install"></a>install | If True, the <code>cmake --install</code> comand will be performed after a build | Boolean | optional | True |
|
||||
|
|
|
@ -10,13 +10,12 @@ A rule for building projects using the[Configure+Make][cm] build tool
|
|||
|
||||
<pre>
|
||||
configure_make(<a href="#configure_make-name">name</a>, <a href="#configure_make-additional_inputs">additional_inputs</a>, <a href="#configure_make-additional_tools">additional_tools</a>, <a href="#configure_make-alwayslink">alwayslink</a>, <a href="#configure_make-args">args</a>, <a href="#configure_make-autoconf">autoconf</a>,
|
||||
<a href="#configure_make-autoconf_env_vars">autoconf_env_vars</a>, <a href="#configure_make-autoconf_options">autoconf_options</a>, <a href="#configure_make-autogen">autogen</a>, <a href="#configure_make-autogen_command">autogen_command</a>, <a href="#configure_make-autogen_env_vars">autogen_env_vars</a>,
|
||||
<a href="#configure_make-autogen_options">autogen_options</a>, <a href="#configure_make-autoreconf">autoreconf</a>, <a href="#configure_make-autoreconf_env_vars">autoreconf_env_vars</a>, <a href="#configure_make-autoreconf_options">autoreconf_options</a>, <a href="#configure_make-build_data">build_data</a>,
|
||||
<a href="#configure_make-configure_command">configure_command</a>, <a href="#configure_make-configure_env_vars">configure_env_vars</a>, <a href="#configure_make-configure_in_place">configure_in_place</a>, <a href="#configure_make-configure_options">configure_options</a>,
|
||||
<a href="#configure_make-configure_prefix">configure_prefix</a>, <a href="#configure_make-data">data</a>, <a href="#configure_make-defines">defines</a>, <a href="#configure_make-deps">deps</a>, <a href="#configure_make-env">env</a>, <a href="#configure_make-install_prefix">install_prefix</a>, <a href="#configure_make-lib_name">lib_name</a>, <a href="#configure_make-lib_source">lib_source</a>,
|
||||
<a href="#configure_make-linkopts">linkopts</a>, <a href="#configure_make-out_bin_dir">out_bin_dir</a>, <a href="#configure_make-out_binaries">out_binaries</a>, <a href="#configure_make-out_headers_only">out_headers_only</a>, <a href="#configure_make-out_include_dir">out_include_dir</a>,
|
||||
<a href="#configure_make-out_interface_libs">out_interface_libs</a>, <a href="#configure_make-out_lib_dir">out_lib_dir</a>, <a href="#configure_make-out_shared_libs">out_shared_libs</a>, <a href="#configure_make-out_static_libs">out_static_libs</a>, <a href="#configure_make-postfix_script">postfix_script</a>,
|
||||
<a href="#configure_make-targets">targets</a>, <a href="#configure_make-tool_prefix">tool_prefix</a>, <a href="#configure_make-tools_deps">tools_deps</a>)
|
||||
<a href="#configure_make-autoconf_options">autoconf_options</a>, <a href="#configure_make-autogen">autogen</a>, <a href="#configure_make-autogen_command">autogen_command</a>, <a href="#configure_make-autogen_options">autogen_options</a>, <a href="#configure_make-autoreconf">autoreconf</a>,
|
||||
<a href="#configure_make-autoreconf_options">autoreconf_options</a>, <a href="#configure_make-build_data">build_data</a>, <a href="#configure_make-configure_command">configure_command</a>, <a href="#configure_make-configure_in_place">configure_in_place</a>,
|
||||
<a href="#configure_make-configure_options">configure_options</a>, <a href="#configure_make-configure_prefix">configure_prefix</a>, <a href="#configure_make-data">data</a>, <a href="#configure_make-defines">defines</a>, <a href="#configure_make-deps">deps</a>, <a href="#configure_make-env">env</a>, <a href="#configure_make-install_prefix">install_prefix</a>,
|
||||
<a href="#configure_make-lib_name">lib_name</a>, <a href="#configure_make-lib_source">lib_source</a>, <a href="#configure_make-linkopts">linkopts</a>, <a href="#configure_make-out_bin_dir">out_bin_dir</a>, <a href="#configure_make-out_binaries">out_binaries</a>, <a href="#configure_make-out_headers_only">out_headers_only</a>,
|
||||
<a href="#configure_make-out_include_dir">out_include_dir</a>, <a href="#configure_make-out_interface_libs">out_interface_libs</a>, <a href="#configure_make-out_lib_dir">out_lib_dir</a>, <a href="#configure_make-out_shared_libs">out_shared_libs</a>, <a href="#configure_make-out_static_libs">out_static_libs</a>,
|
||||
<a href="#configure_make-postfix_script">postfix_script</a>, <a href="#configure_make-targets">targets</a>, <a href="#configure_make-tool_prefix">tool_prefix</a>, <a href="#configure_make-tools_deps">tools_deps</a>)
|
||||
</pre>
|
||||
|
||||
Rule for building external libraries with configure-make pattern. Some 'configure' script is invoked with --prefix=install (by default), and other parameters for compilation and linking, taken from Bazel C/C++ toolchain and passed dependencies. After configuration, GNU Make is called.
|
||||
|
@ -32,18 +31,14 @@ Rule for building external libraries with configure-make pattern. Some 'configur
|
|||
| <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 <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 <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 <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-build_data"></a>build_data | Files needed by this rule only during build/compile time. May list file or rule targets. Generally allows any target. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | 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" |
|
||||
| <a id="configure_make-configure_env_vars"></a>configure_env_vars | Environment variables to be set for the 'configure' invocation. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="configure_make-configure_in_place"></a>configure_in_place | Set to True if 'configure' should be invoked in place, i.e. from its enclosing directory. | Boolean | optional | False |
|
||||
| <a id="configure_make-configure_options"></a>configure_options | Any options to be put on the 'configure' command line. | List of strings | optional | [] |
|
||||
| <a id="configure_make-configure_prefix"></a>configure_prefix | A prefix for the call to the <code>configure_command</code>. | String | optional | "" |
|
||||
|
|
|
@ -66,10 +66,10 @@ Rule for building Boost. Invokes bootstrap.sh and then b2 install.
|
|||
|
||||
<pre>
|
||||
cmake(<a href="#cmake-name">name</a>, <a href="#cmake-additional_inputs">additional_inputs</a>, <a href="#cmake-additional_tools">additional_tools</a>, <a href="#cmake-alwayslink">alwayslink</a>, <a href="#cmake-build_args">build_args</a>, <a href="#cmake-build_data">build_data</a>, <a href="#cmake-cache_entries">cache_entries</a>,
|
||||
<a href="#cmake-data">data</a>, <a href="#cmake-defines">defines</a>, <a href="#cmake-deps">deps</a>, <a href="#cmake-env">env</a>, <a href="#cmake-env_vars">env_vars</a>, <a href="#cmake-generate_args">generate_args</a>, <a href="#cmake-generate_crosstool_file">generate_crosstool_file</a>, <a href="#cmake-install">install</a>,
|
||||
<a href="#cmake-install_args">install_args</a>, <a href="#cmake-lib_name">lib_name</a>, <a href="#cmake-lib_source">lib_source</a>, <a href="#cmake-linkopts">linkopts</a>, <a href="#cmake-out_bin_dir">out_bin_dir</a>, <a href="#cmake-out_binaries">out_binaries</a>, <a href="#cmake-out_headers_only">out_headers_only</a>,
|
||||
<a href="#cmake-out_include_dir">out_include_dir</a>, <a href="#cmake-out_interface_libs">out_interface_libs</a>, <a href="#cmake-out_lib_dir">out_lib_dir</a>, <a href="#cmake-out_shared_libs">out_shared_libs</a>, <a href="#cmake-out_static_libs">out_static_libs</a>,
|
||||
<a href="#cmake-postfix_script">postfix_script</a>, <a href="#cmake-targets">targets</a>, <a href="#cmake-tool_prefix">tool_prefix</a>, <a href="#cmake-tools_deps">tools_deps</a>, <a href="#cmake-working_directory">working_directory</a>)
|
||||
<a href="#cmake-data">data</a>, <a href="#cmake-defines">defines</a>, <a href="#cmake-deps">deps</a>, <a href="#cmake-env">env</a>, <a href="#cmake-generate_args">generate_args</a>, <a href="#cmake-generate_crosstool_file">generate_crosstool_file</a>, <a href="#cmake-install">install</a>, <a href="#cmake-install_args">install_args</a>,
|
||||
<a href="#cmake-lib_name">lib_name</a>, <a href="#cmake-lib_source">lib_source</a>, <a href="#cmake-linkopts">linkopts</a>, <a href="#cmake-out_bin_dir">out_bin_dir</a>, <a href="#cmake-out_binaries">out_binaries</a>, <a href="#cmake-out_headers_only">out_headers_only</a>, <a href="#cmake-out_include_dir">out_include_dir</a>,
|
||||
<a href="#cmake-out_interface_libs">out_interface_libs</a>, <a href="#cmake-out_lib_dir">out_lib_dir</a>, <a href="#cmake-out_shared_libs">out_shared_libs</a>, <a href="#cmake-out_static_libs">out_static_libs</a>, <a href="#cmake-postfix_script">postfix_script</a>, <a href="#cmake-targets">targets</a>,
|
||||
<a href="#cmake-tool_prefix">tool_prefix</a>, <a href="#cmake-tools_deps">tools_deps</a>, <a href="#cmake-working_directory">working_directory</a>)
|
||||
</pre>
|
||||
|
||||
Rule for building external library with CMake.
|
||||
|
@ -90,7 +90,6 @@ Rule for building external library with CMake.
|
|||
| <a id="cmake-defines"></a>defines | Optional compilation definitions to be passed to the dependencies of this library. They are NOT passed to the compiler, you should duplicate them in the configuration options. | List of strings | optional | [] |
|
||||
| <a id="cmake-deps"></a>deps | Optional dependencies to be copied into the directory structure. Typically those directly required for the external building of the library/binaries. (i.e. those that the external buidl system will be looking for and paths to which are provided by the calling rule) | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
|
||||
| <a id="cmake-env"></a>env | Environment variables to set during the build. <code>$(execpath)</code> macros may be used to point at files which are listed as <code>data</code>, <code>deps</code>, or <code>build_data</code>, but unlike with other rules, these will be replaced with absolute paths to those files, because the build does not run in the exec root. No other macros are supported. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="cmake-env_vars"></a>env_vars | CMake environment variable values to join with toolchain-defined. For example, additional <code>CXXFLAGS</code>. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="cmake-generate_args"></a>generate_args | Arguments for CMake's generate command. Arguments should be passed as key/value pairs. eg: <code>["-G Ninja", "--debug-output", "-DFOO=bar"]</code>. Note that unless a generator (<code>-G</code>) argument is provided, the default generators are [Unix Makefiles](https://cmake.org/cmake/help/latest/generator/Unix%20Makefiles.html) for Linux and MacOS and [Ninja](https://cmake.org/cmake/help/latest/generator/Ninja.html) for Windows. | List of strings | optional | [] |
|
||||
| <a id="cmake-generate_crosstool_file"></a>generate_crosstool_file | When True, CMake crosstool file will be generated from the toolchain values, provided cache-entries and env_vars (some values will still be passed as <code>-Dkey=value</code> and environment variables). If <code>CMAKE_TOOLCHAIN_FILE</code> cache entry is passed, specified crosstool file will be used When using this option to cross-compile, it is required to specify <code>CMAKE_SYSTEM_NAME</code> in the cache_entries | Boolean | optional | True |
|
||||
| <a id="cmake-install"></a>install | If True, the <code>cmake --install</code> comand will be performed after a build | Boolean | optional | True |
|
||||
|
@ -138,13 +137,12 @@ Rule for building CMake. Invokes bootstrap script and make install.
|
|||
|
||||
<pre>
|
||||
configure_make(<a href="#configure_make-name">name</a>, <a href="#configure_make-additional_inputs">additional_inputs</a>, <a href="#configure_make-additional_tools">additional_tools</a>, <a href="#configure_make-alwayslink">alwayslink</a>, <a href="#configure_make-args">args</a>, <a href="#configure_make-autoconf">autoconf</a>,
|
||||
<a href="#configure_make-autoconf_env_vars">autoconf_env_vars</a>, <a href="#configure_make-autoconf_options">autoconf_options</a>, <a href="#configure_make-autogen">autogen</a>, <a href="#configure_make-autogen_command">autogen_command</a>, <a href="#configure_make-autogen_env_vars">autogen_env_vars</a>,
|
||||
<a href="#configure_make-autogen_options">autogen_options</a>, <a href="#configure_make-autoreconf">autoreconf</a>, <a href="#configure_make-autoreconf_env_vars">autoreconf_env_vars</a>, <a href="#configure_make-autoreconf_options">autoreconf_options</a>, <a href="#configure_make-build_data">build_data</a>,
|
||||
<a href="#configure_make-configure_command">configure_command</a>, <a href="#configure_make-configure_env_vars">configure_env_vars</a>, <a href="#configure_make-configure_in_place">configure_in_place</a>, <a href="#configure_make-configure_options">configure_options</a>,
|
||||
<a href="#configure_make-configure_prefix">configure_prefix</a>, <a href="#configure_make-data">data</a>, <a href="#configure_make-defines">defines</a>, <a href="#configure_make-deps">deps</a>, <a href="#configure_make-env">env</a>, <a href="#configure_make-install_prefix">install_prefix</a>, <a href="#configure_make-lib_name">lib_name</a>, <a href="#configure_make-lib_source">lib_source</a>,
|
||||
<a href="#configure_make-linkopts">linkopts</a>, <a href="#configure_make-out_bin_dir">out_bin_dir</a>, <a href="#configure_make-out_binaries">out_binaries</a>, <a href="#configure_make-out_headers_only">out_headers_only</a>, <a href="#configure_make-out_include_dir">out_include_dir</a>,
|
||||
<a href="#configure_make-out_interface_libs">out_interface_libs</a>, <a href="#configure_make-out_lib_dir">out_lib_dir</a>, <a href="#configure_make-out_shared_libs">out_shared_libs</a>, <a href="#configure_make-out_static_libs">out_static_libs</a>, <a href="#configure_make-postfix_script">postfix_script</a>,
|
||||
<a href="#configure_make-targets">targets</a>, <a href="#configure_make-tool_prefix">tool_prefix</a>, <a href="#configure_make-tools_deps">tools_deps</a>)
|
||||
<a href="#configure_make-autoconf_options">autoconf_options</a>, <a href="#configure_make-autogen">autogen</a>, <a href="#configure_make-autogen_command">autogen_command</a>, <a href="#configure_make-autogen_options">autogen_options</a>, <a href="#configure_make-autoreconf">autoreconf</a>,
|
||||
<a href="#configure_make-autoreconf_options">autoreconf_options</a>, <a href="#configure_make-build_data">build_data</a>, <a href="#configure_make-configure_command">configure_command</a>, <a href="#configure_make-configure_in_place">configure_in_place</a>,
|
||||
<a href="#configure_make-configure_options">configure_options</a>, <a href="#configure_make-configure_prefix">configure_prefix</a>, <a href="#configure_make-data">data</a>, <a href="#configure_make-defines">defines</a>, <a href="#configure_make-deps">deps</a>, <a href="#configure_make-env">env</a>, <a href="#configure_make-install_prefix">install_prefix</a>,
|
||||
<a href="#configure_make-lib_name">lib_name</a>, <a href="#configure_make-lib_source">lib_source</a>, <a href="#configure_make-linkopts">linkopts</a>, <a href="#configure_make-out_bin_dir">out_bin_dir</a>, <a href="#configure_make-out_binaries">out_binaries</a>, <a href="#configure_make-out_headers_only">out_headers_only</a>,
|
||||
<a href="#configure_make-out_include_dir">out_include_dir</a>, <a href="#configure_make-out_interface_libs">out_interface_libs</a>, <a href="#configure_make-out_lib_dir">out_lib_dir</a>, <a href="#configure_make-out_shared_libs">out_shared_libs</a>, <a href="#configure_make-out_static_libs">out_static_libs</a>,
|
||||
<a href="#configure_make-postfix_script">postfix_script</a>, <a href="#configure_make-targets">targets</a>, <a href="#configure_make-tool_prefix">tool_prefix</a>, <a href="#configure_make-tools_deps">tools_deps</a>)
|
||||
</pre>
|
||||
|
||||
Rule for building external libraries with configure-make pattern. Some 'configure' script is invoked with --prefix=install (by default), and other parameters for compilation and linking, taken from Bazel C/C++ toolchain and passed dependencies. After configuration, GNU Make is called.
|
||||
|
@ -160,18 +158,14 @@ Rule for building external libraries with configure-make pattern. Some 'configur
|
|||
| <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 <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 <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 <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-build_data"></a>build_data | Files needed by this rule only during build/compile time. May list file or rule targets. Generally allows any target. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | 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" |
|
||||
| <a id="configure_make-configure_env_vars"></a>configure_env_vars | Environment variables to be set for the 'configure' invocation. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
|
||||
| <a id="configure_make-configure_in_place"></a>configure_in_place | Set to True if 'configure' should be invoked in place, i.e. from its enclosing directory. | Boolean | optional | False |
|
||||
| <a id="configure_make-configure_options"></a>configure_options | Any options to be put on the 'configure' command line. | List of strings | optional | [] |
|
||||
| <a id="configure_make-configure_prefix"></a>configure_prefix | A prefix for the call to the <code>configure_command</code>. | String | optional | "" |
|
||||
|
|
|
@ -7,14 +7,14 @@ filegroup(
|
|||
|
||||
configure_make(
|
||||
name = "apr",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
configure_in_place = True,
|
||||
configure_options = [
|
||||
"--disable-shared",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_static_libs = ["libapr-1.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
|
@ -7,14 +7,14 @@ filegroup(
|
|||
|
||||
configure_make(
|
||||
name = "apr_util",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
configure_in_place = True,
|
||||
configure_options = [
|
||||
"--with-apr=$EXT_BUILD_DEPS/apr",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_static_libs = ["libaprutil-1.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
|
@ -7,15 +7,15 @@ filegroup(
|
|||
|
||||
configure_make(
|
||||
name = "gperftools_build",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
configure_options = [
|
||||
"--enable-shared=no",
|
||||
"--enable-frame-pointers",
|
||||
"--disable-libunwind",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_static_libs = ["libtcmalloc_and_profiler.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
|
@ -9,16 +9,16 @@ filegroup(
|
|||
|
||||
configure_make(
|
||||
name = "iconv",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
configure_in_place = True,
|
||||
configure_options = [
|
||||
"--enable-relocatable",
|
||||
"--enable-shared=no",
|
||||
"--enable-static=yes",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = "@iconv//:all",
|
||||
out_static_libs = [
|
||||
"libiconv.a",
|
||||
|
|
|
@ -20,10 +20,6 @@ CONFIGURE_OPTIONS = [
|
|||
configure_make(
|
||||
name = "openssl",
|
||||
configure_command = "config",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
configure_in_place = True,
|
||||
configure_options = select({
|
||||
"@platforms//os:macos": [
|
||||
|
@ -36,6 +32,10 @@ configure_make(
|
|||
"no-shared",
|
||||
] + CONFIGURE_OPTIONS,
|
||||
}),
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_static_libs = [
|
||||
"libcrypto.a",
|
||||
|
|
|
@ -7,7 +7,7 @@ filegroup(
|
|||
|
||||
configure_make(
|
||||
name = "sqlite",
|
||||
configure_env_vars = select({
|
||||
env = select({
|
||||
"@platforms//os:macos": {"AR": ""},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
|
|
|
@ -13,13 +13,6 @@ CONFIGURE_ENV_VARS = {
|
|||
|
||||
configure_make(
|
||||
name = "subversion",
|
||||
configure_env_vars = select({
|
||||
"@platforms//os:macos": dicts.add(
|
||||
{"AR": ""},
|
||||
CONFIGURE_ENV_VARS,
|
||||
),
|
||||
"//conditions:default": CONFIGURE_ENV_VARS,
|
||||
}),
|
||||
configure_options = [
|
||||
"--enable-all-static",
|
||||
"--without-boost",
|
||||
|
@ -31,6 +24,13 @@ configure_make(
|
|||
"--enable-optimize",
|
||||
"--disable-nls",
|
||||
],
|
||||
env = select({
|
||||
"@platforms//os:macos": dicts.add(
|
||||
{"AR": ""},
|
||||
CONFIGURE_ENV_VARS,
|
||||
),
|
||||
"//conditions:default": CONFIGURE_ENV_VARS,
|
||||
}),
|
||||
lib_source = ":all_srcs",
|
||||
out_binaries = [
|
||||
"svn",
|
||||
|
|
|
@ -143,6 +143,7 @@ load(
|
|||
"CC_EXTERNAL_RULE_FRAGMENTS",
|
||||
"cc_external_rule_impl",
|
||||
"create_attrs",
|
||||
"expand_locations",
|
||||
)
|
||||
load(
|
||||
"//foreign_cc/private/framework:platform.bzl",
|
||||
|
@ -249,6 +250,8 @@ def _create_configure_script(configureParameters):
|
|||
config = configuration,
|
||||
))
|
||||
|
||||
prefix = expand_locations(ctx, {"prefix": attrs.tool_prefix}, data)["prefix"] if attrs.tool_prefix else ""
|
||||
|
||||
configure_script = create_cmake_script(
|
||||
workspace_name = ctx.workspace_name,
|
||||
generator = attrs.generator,
|
||||
|
@ -259,10 +262,10 @@ def _create_configure_script(configureParameters):
|
|||
root = root,
|
||||
no_toolchain_file = no_toolchain_file,
|
||||
user_cache = dict(ctx.attr.cache_entries),
|
||||
user_env = getattr(ctx.attr, "env_vars", {}),
|
||||
user_env = expand_locations(ctx, ctx.attr.env, data),
|
||||
options = attrs.generate_args,
|
||||
cmake_commands = cmake_commands,
|
||||
cmake_prefix = ctx.expand_location(attrs.tool_prefix, data) if attrs.tool_prefix else "",
|
||||
cmake_prefix = prefix,
|
||||
include_dirs = inputs.include_dirs,
|
||||
is_debug_mode = is_debug_mode(ctx),
|
||||
)
|
||||
|
@ -356,14 +359,6 @@ def _attrs():
|
|||
mandatory = False,
|
||||
default = {},
|
||||
),
|
||||
"env_vars": attr.string_dict(
|
||||
doc = (
|
||||
"CMake environment variable values to join with toolchain-defined. " +
|
||||
"For example, additional `CXXFLAGS`."
|
||||
),
|
||||
mandatory = False,
|
||||
default = {},
|
||||
),
|
||||
"generate_args": attr.string_list(
|
||||
doc = (
|
||||
"Arguments for CMake's generate command. Arguments should be passed as key/value pairs. eg: " +
|
||||
|
|
|
@ -16,6 +16,7 @@ load(
|
|||
"CC_EXTERNAL_RULE_FRAGMENTS",
|
||||
"cc_external_rule_impl",
|
||||
"create_attrs",
|
||||
"expand_locations",
|
||||
)
|
||||
load("//foreign_cc/private/framework:platform.bzl", "os_name")
|
||||
load("//toolchains/native_tools:tool_access.bzl", "get_make_data")
|
||||
|
@ -64,7 +65,7 @@ def _create_configure_script(configureParameters):
|
|||
|
||||
define_install_prefix = ["export INSTALL_PREFIX=\"" + _get_install_prefix(ctx) + "\""]
|
||||
|
||||
data = ctx.attr.data or list()
|
||||
data = ctx.attr.data + ctx.attr.build_data
|
||||
|
||||
# Generate a list of arguments for make
|
||||
args = " ".join([
|
||||
|
@ -72,6 +73,8 @@ def _create_configure_script(configureParameters):
|
|||
for arg in ctx.attr.args
|
||||
])
|
||||
|
||||
user_env = expand_locations(ctx, ctx.attr.env, data)
|
||||
|
||||
make_commands = []
|
||||
prefix = "{} ".format(ctx.expand_location(attrs.tool_prefix, data)) if attrs.tool_prefix else ""
|
||||
configure_prefix = "{} ".format(ctx.expand_location(ctx.attr.configure_prefix, data)) if ctx.attr.configure_prefix else ""
|
||||
|
@ -93,23 +96,20 @@ def _create_configure_script(configureParameters):
|
|||
flags = flags,
|
||||
root = detect_root(ctx.attr.lib_source),
|
||||
user_options = ctx.attr.configure_options,
|
||||
user_vars = dict(ctx.attr.configure_env_vars),
|
||||
is_debug = is_debug_mode(ctx),
|
||||
configure_prefix = configure_prefix,
|
||||
configure_command = ctx.attr.configure_command,
|
||||
deps = ctx.attr.deps,
|
||||
inputs = inputs,
|
||||
env_vars = user_env,
|
||||
configure_in_place = ctx.attr.configure_in_place,
|
||||
autoconf = ctx.attr.autoconf,
|
||||
autoconf_options = ctx.attr.autoconf_options,
|
||||
autoconf_env_vars = ctx.attr.autoconf_env_vars,
|
||||
autoreconf = ctx.attr.autoreconf,
|
||||
autoreconf_options = ctx.attr.autoreconf_options,
|
||||
autoreconf_env_vars = ctx.attr.autoreconf_env_vars,
|
||||
autogen = ctx.attr.autogen,
|
||||
autogen_command = ctx.attr.autogen_command,
|
||||
autogen_options = ctx.attr.autogen_options,
|
||||
autogen_env_vars = ctx.attr.autogen_env_vars,
|
||||
make_commands = make_commands,
|
||||
make_path = attrs.make_path,
|
||||
)
|
||||
|
@ -136,9 +136,6 @@ def _attrs():
|
|||
"currently requires `configure_in_place` to be True."
|
||||
),
|
||||
),
|
||||
"autoconf_env_vars": attr.string_dict(
|
||||
doc = "Environment variables to be set for 'autoconf' invocation.",
|
||||
),
|
||||
"autoconf_options": attr.string_list(
|
||||
doc = "Any options to be put in the 'autoconf.sh' command line.",
|
||||
),
|
||||
|
@ -158,9 +155,6 @@ def _attrs():
|
|||
),
|
||||
default = "autogen.sh",
|
||||
),
|
||||
"autogen_env_vars": attr.string_dict(
|
||||
doc = "Environment variables to be set for 'autogen' invocation.",
|
||||
),
|
||||
"autogen_options": attr.string_list(
|
||||
doc = "Any options to be put in the 'autogen.sh' command line.",
|
||||
),
|
||||
|
@ -172,9 +166,6 @@ def _attrs():
|
|||
mandatory = False,
|
||||
default = False,
|
||||
),
|
||||
"autoreconf_env_vars": attr.string_dict(
|
||||
doc = "Environment variables to be set for 'autoreconf' invocation.",
|
||||
),
|
||||
"autoreconf_options": attr.string_list(
|
||||
doc = "Any options to be put in the 'autoreconf.sh' command line.",
|
||||
),
|
||||
|
@ -185,9 +176,6 @@ def _attrs():
|
|||
),
|
||||
default = "configure",
|
||||
),
|
||||
"configure_env_vars": attr.string_dict(
|
||||
doc = "Environment variables to be set for the 'configure' invocation.",
|
||||
),
|
||||
"configure_in_place": attr.bool(
|
||||
doc = (
|
||||
"Set to True if 'configure' should be invoked in place, i.e. from its enclosing " +
|
||||
|
|
|
@ -11,27 +11,22 @@ def create_configure_script(
|
|||
flags,
|
||||
root,
|
||||
user_options,
|
||||
user_vars,
|
||||
is_debug,
|
||||
configure_prefix,
|
||||
configure_command,
|
||||
deps,
|
||||
inputs,
|
||||
env_vars,
|
||||
configure_in_place,
|
||||
autoconf,
|
||||
autoconf_options,
|
||||
autoconf_env_vars,
|
||||
autoreconf,
|
||||
autoreconf_options,
|
||||
autoreconf_env_vars,
|
||||
autogen,
|
||||
autogen_command,
|
||||
autogen_options,
|
||||
autogen_env_vars,
|
||||
make_path,
|
||||
make_commands):
|
||||
env_vars_string = _get_env_vars(workspace_name, tools, flags, user_vars, deps, inputs)
|
||||
|
||||
ext_build_dirs = inputs.ext_build_dirs
|
||||
|
||||
script = pkgconfig_script(ext_build_dirs)
|
||||
|
@ -44,38 +39,44 @@ def create_configure_script(
|
|||
configure_path = "{}/{}".format(root_path, configure_command)
|
||||
|
||||
script.append("##export_var## MAKE {}".format(make_path))
|
||||
script.append("##enable_tracing##")
|
||||
|
||||
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)
|
||||
script.append('{} "{}/{}" {}'.format(
|
||||
" ".join(['{}="{}"'.format(key, autogen_env_vars[key]) for key in autogen_env_vars]),
|
||||
root_path,
|
||||
autogen_command,
|
||||
" ".join(autogen_options),
|
||||
autogen_env_vars = _get_autogen_env_vars(env_vars)
|
||||
script.append("{env_vars} \"{root_dir}/{autogen}\" {options}".format(
|
||||
env_vars = " ".join(["{}=\"{}\"".format(key, value) for (key, value) in autogen_env_vars.items()]),
|
||||
root_dir = root_path,
|
||||
autogen = autogen_command,
|
||||
options = " ".join(autogen_options),
|
||||
).lstrip())
|
||||
|
||||
env_vars_string = " ".join(["{}=\"{}\"".format(key, value) for (key, value) in env_vars.items()])
|
||||
|
||||
if autoconf:
|
||||
script.append("{} autoconf {}".format(
|
||||
" ".join(["{}=\"{}\"".format(key, autoconf_env_vars[key]) for key in autoconf_env_vars]),
|
||||
" ".join(autoconf_options),
|
||||
script.append("{env_vars} {autoconf} {options}".format(
|
||||
env_vars = env_vars_string,
|
||||
# TODO: Pass autoconf via a toolchain
|
||||
autoconf = "autoconf",
|
||||
options = " ".join(autoconf_options),
|
||||
).lstrip())
|
||||
|
||||
if autoreconf:
|
||||
script.append("{} autoreconf {}".format(
|
||||
" ".join(['{}="{}"'.format(key, autoreconf_env_vars[key]) for key in autoreconf_env_vars]),
|
||||
" ".join(autoreconf_options),
|
||||
script.append("{env_vars} {autoreconf} {options}".format(
|
||||
env_vars = env_vars_string,
|
||||
# TODO: Pass autoreconf via a toolchain
|
||||
autoreconf = "autoreconf",
|
||||
options = " ".join(autoreconf_options),
|
||||
).lstrip())
|
||||
|
||||
script.append('{env_vars} {prefix}"{configure}" --prefix=$$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$ {user_options}'.format(
|
||||
env_vars = env_vars_string,
|
||||
script.append("{env_vars} {prefix}\"{configure}\" --prefix=$$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$ {user_options}".format(
|
||||
env_vars = _get_env_vars(workspace_name, tools, flags, env_vars, deps, inputs),
|
||||
prefix = configure_prefix,
|
||||
configure = configure_path,
|
||||
user_options = " ".join(user_options),
|
||||
))
|
||||
|
||||
script.append("##enable_tracing##")
|
||||
script.extend(make_commands)
|
||||
script.append("##disable_tracing##")
|
||||
|
||||
|
|
|
@ -249,6 +249,17 @@ dependencies.""",
|
|||
),
|
||||
)
|
||||
|
||||
def _escape_dquote(text):
|
||||
"""Escape double quotes for use in bash variable definitions
|
||||
|
||||
Args:
|
||||
text (str): The text to escape
|
||||
|
||||
Returns:
|
||||
str: text with escaped `"` characters.
|
||||
"""
|
||||
return text.replace('"', r'\"\\\\\\"')
|
||||
|
||||
def _env_prelude(ctx, lib_name, data_dependencies, target_root):
|
||||
"""Generate a bash snippet containing environment variable definitions
|
||||
|
||||
|
@ -285,11 +296,8 @@ def _env_prelude(ctx, lib_name, data_dependencies, target_root):
|
|||
env.update(ctx.configuration.default_shell_env)
|
||||
|
||||
# Add all user defined variables
|
||||
attr_env = dict()
|
||||
for key, value in getattr(ctx.attr, "env", {}).items():
|
||||
# Ensure the values of the environment variables have absolute paths
|
||||
attr_env.update({key: ctx.expand_location(value.replace("$(execpath ", "$EXT_BUILD_ROOT/$(execpath "), data_dependencies)})
|
||||
env_snippet.extend(["export {}={}".format(key, val) for key, val in attr_env.items()])
|
||||
attr_env = expand_locations(ctx, ctx.attr.env, data_dependencies)
|
||||
env_snippet.extend(["export {}=\"{}\"".format(key, _escape_dquote(val)) for key, val in attr_env.items()])
|
||||
|
||||
return env_snippet, env
|
||||
|
||||
|
@ -877,3 +885,26 @@ def _expand_command_path(binary, path, command):
|
|||
return command.replace(binary, path, 1)
|
||||
else:
|
||||
return command
|
||||
|
||||
def expand_locations(ctx, environ, data):
|
||||
"""Expand locations on a dictionary while ensuring `execpath` is always set to an absolute path
|
||||
|
||||
This function is not expected to be passed to any action.env argument but instead rendered into
|
||||
build scripts.
|
||||
|
||||
Args:
|
||||
ctx (ctx): The rule's context object
|
||||
environ (dict): A dictionary of environment variables
|
||||
data (list): A list of targets
|
||||
|
||||
Returns:
|
||||
dict: An expanded dict of environment variables
|
||||
"""
|
||||
expanded_env = dict()
|
||||
for key, value in environ.items():
|
||||
# If `EXT_BUILD_ROOT` exists in the string, we assume the user has added it themselves
|
||||
if "EXT_BUILD_ROOT" in value:
|
||||
expanded_env.update({key: ctx.expand_location(value, data)})
|
||||
else:
|
||||
expanded_env.update({key: ctx.expand_location(value.replace("$(execpath ", "$EXT_BUILD_ROOT/$(execpath "), data)})
|
||||
return expanded_env
|
||||
|
|
Loading…
Reference in New Issue