Skip to content

Commit

Permalink
Fix pkgconfig for configure_make and make (#447)
Browse files Browse the repository at this point in the history
* Fix pkgconfig for configure_make

* Extract pkgconfig script

* Fix pkgconfig for make

Co-authored-by: James Sharpe <james.sharpe@zenotech.com>
  • Loading branch information
whs-dot-hk and jsharpe authored Jan 25, 2021
1 parent 898bed4 commit 4d4acaa
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tools/build_defs/configure_script.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
load(":cc_toolchain_util.bzl", "absolutize_path_in_str")
load(":framework.bzl", "get_foreign_cc_dep")

def _pkgconfig_script(ext_build_dirs):
"""Create a script fragment to configure pkg-config"""
script = []
for ext_dir in ext_build_dirs:
script.append("##increment_pkg_config_path## $$EXT_BUILD_DEPS$$/" + ext_dir.basename)

script.append("echo \"PKG_CONFIG_PATH=$$PKG_CONFIG_PATH$$\"")

script.append("##define_absolute_paths## $$EXT_BUILD_DEPS$$ $$EXT_BUILD_DEPS$$")

return script

# buildifier: disable=function-docstring
def create_configure_script(
workspace_name,
Expand All @@ -28,11 +40,9 @@ def create_configure_script(
autogen_env_vars):
env_vars_string = get_env_vars(workspace_name, tools, flags, user_vars, deps, inputs)

script = []
for ext_dir in inputs.ext_build_dirs:
script.append("##increment_pkg_config_path## $$EXT_BUILD_ROOT$$/" + ext_dir.path)
ext_build_dirs = inputs.ext_build_dirs

script.append("echo \"PKG_CONFIG_PATH=$$PKG_CONFIG_PATH$$\"")
script = _pkgconfig_script(ext_build_dirs)

root_path = "$$EXT_BUILD_ROOT$$/{}".format(root)
configure_path = "{}/{}".format(root_path, configure_command)
Expand Down Expand Up @@ -83,11 +93,10 @@ def create_make_script(
make_commands,
prefix):
env_vars_string = get_env_vars(workspace_name, tools, flags, user_vars, deps, inputs)
script = []
for ext_dir in inputs.ext_build_dirs:
script.append("##increment_pkg_config_path## $$EXT_BUILD_ROOT$$/" + ext_dir.path)

script.append("echo \"PKG_CONFIG_PATH=$$PKG_CONFIG_PATH$$\"")
ext_build_dirs = inputs.ext_build_dirs

script = _pkgconfig_script(ext_build_dirs)

script.append("##symlink_contents_to_dir## $$EXT_BUILD_ROOT$$/{} $$BUILD_TMPDIR$$".format(root))
script.append("" + " && ".join(make_commands))
Expand Down

0 comments on commit 4d4acaa

Please sign in to comment.