Index: build/config/linux/pkg_config.gni |
diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni |
index 004405854b436b67f981a58809633eed2a439483..a96bc6489aa44d9c76319acce0982e9cb3187b73 100644 |
--- a/build/config/linux/pkg_config.gni |
+++ b/build/config/linux/pkg_config.gni |
@@ -32,6 +32,9 @@ declare_args() { |
# the sysroot mechanism to find the right .pc files. |
pkg_config = "" |
+ # A optional pkg-config wrapper to use for tools built on the host. |
+ host_pkg_config = "" |
+ |
# CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig |
# and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfig |
# depending on whether the systemroot is for a 32 or 64 bit architecture. |
@@ -65,7 +68,6 @@ if (sysroot != "") { |
pkg_config_args = [] |
} |
-# Only use the custom libdir when building with the target sysroot. |
if (target_sysroot != "" && sysroot == target_sysroot) { |
pkg_config_args += [ |
"--system_libdir", |
@@ -73,11 +75,26 @@ if (target_sysroot != "" && sysroot == target_sysroot) { |
] |
} |
+if (host_pkg_config != "") { |
+ host_pkg_config_args = [ |
+ "-p", |
+ host_pkg_config, |
+ ] |
+} else { |
+ host_pkg_config_args = pkg_config_args |
+} |
+ |
template("pkg_config") { |
+ # Only use the custom libdir when building with the target sysroot. |
Dirk Pranke
2017/04/21 00:25:25
Why did this comment move?
richard.townsend
2017/04/21 17:08:03
Done.
|
+ if (host_toolchain == current_toolchain) { |
+ active_pkg_config_args = host_pkg_config_args |
+ } else { |
+ active_pkg_config_args = pkg_config_args |
+ } |
Dirk Pranke
2017/04/21 00:25:25
I'd probably move this if down to line 97 and just
richard.townsend
2017/04/21 17:08:03
Done.
|
assert(defined(invoker.packages), |
"Variable |packages| must be defined to be a list in pkg_config.") |
config(target_name) { |
- args = pkg_config_args + invoker.packages |
+ args = active_pkg_config_args + invoker.packages |
if (defined(invoker.extra_args)) { |
args += invoker.extra_args |
} |