Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2095)

Unified Diff: build/config/linux/pkg-config.py

Issue 702903004: Add chrome perf tests and sniffer to GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/config/linux/pkg-config.py
diff --git a/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py
index 60304d47f841cefb230b967257e9956a7da63d72..a4f4703bd3814ed971845042c5eda0e8917f5913 100644
--- a/build/config/linux/pkg-config.py
+++ b/build/config/linux/pkg-config.py
@@ -25,6 +25,10 @@ from optparse import OptionParser
#
# When using a sysroot, you must also specify the architecture via
# "-a <arch>" where arch is either "x86" or "x64".
+#
+# Additionally, you can specify the option --atleast-version. This will skip
+# the normal outputting of a dictionary and instead print true or false,
+# depending on the return value of pkg-config for the given package.
# If this is run on non-Linux platforms, just return nothing and indicate
# success. This allows us to "kind of emulate" a Linux build from other
@@ -106,6 +110,8 @@ parser.add_option('-p', action='store', dest='pkg_config', type='string',
parser.add_option('-v', action='append', dest='strip_out', type='string')
parser.add_option('-s', action='store', dest='sysroot', type='string')
parser.add_option('-a', action='store', dest='arch', type='string')
+parser.add_option('--atleast-version', action='store',
+ dest='atleast_version', type='string')
(options, args) = parser.parse_args()
# Make a list of regular expressions to strip out.
@@ -120,6 +126,18 @@ if options.sysroot:
else:
prefix = ''
+if options.atleast_version:
+ # When asking for the return value, just run pkg-config and print the return
+ # value, no need to do other work.
+ if not subprocess.call([options.pkg_config,
+ "--atleast-version=" + options.atleast_version] +
+ args,
+ env=os.environ):
+ print "true"
+ else:
+ print "false"
+ sys.exit(0)
+
try:
flag_string = subprocess.check_output(
[ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] +
« no previous file with comments | « BUILD.gn ('k') | build/config/linux/pkg_config.gni » ('j') | third_party/harfbuzz-ng/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698