Index: build/config/linux/pkg_config.gni |
diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni |
index 378863e95510d08244dcebb27ccb4b9e527a84c7..687afc51c853ddf40dfb5390c1da19819eb894e7 100644 |
--- a/build/config/linux/pkg_config.gni |
+++ b/build/config/linux/pkg_config.gni |
@@ -33,25 +33,29 @@ declare_args() { |
pkg_config = "" |
} |
+pkg_config_script = "//build/config/linux/pkg-config.py" |
+ |
+# Define the args we pass to the pkg-config script for other build files that |
+# need to invoke it manually. |
+if (sysroot != "") { |
+ # Pass the sysroot if we're using one (it requires the CPU arch also). |
+ pkg_config_args = ["-s", sysroot, "-a", cpu_arch] |
+} else if (pkg_config != "") { |
+ pkg_config_args = ["-p", pkg_config] |
+} else { |
+ pkg_config_args = [] |
+} |
+ |
template("pkg_config") { |
assert(defined(invoker.packages), |
"Variable |packages| must be defined to be a list in pkg_config.") |
config(target_name) { |
- if (sysroot != "") { |
- # Pass the sysroot if we're using one (it requires the CPU arch also). |
- args = ["-s", sysroot, "-a", cpu_arch] + invoker.packages |
- } else if (pkg_config != "") { |
- args = ["-p", pkg_config] + invoker.packages |
- } else { |
- args = invoker.packages |
- } |
- |
+ args = pkg_config_args + invoker.packages |
if (defined(invoker.extra_args)) { |
args += invoker.extra_args |
} |
- pkgresult = exec_script("//build/config/linux/pkg-config.py", |
- args, "value") |
+ pkgresult = exec_script(pkg_config_script, args, "value") |
include_dirs = pkgresult[0] |
cflags = pkgresult[1] |