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

Side by Side Diff: build/config/linux/pkg-config.py

Issue 1005293002: Re-land: Resurrect Aura Linux accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import re 9 import re
10 from optparse import OptionParser 10 from optparse import OptionParser
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 106
107 parser = OptionParser() 107 parser = OptionParser()
108 parser.add_option('-p', action='store', dest='pkg_config', type='string', 108 parser.add_option('-p', action='store', dest='pkg_config', type='string',
109 default='pkg-config') 109 default='pkg-config')
110 parser.add_option('-v', action='append', dest='strip_out', type='string') 110 parser.add_option('-v', action='append', dest='strip_out', type='string')
111 parser.add_option('-s', action='store', dest='sysroot', type='string') 111 parser.add_option('-s', action='store', dest='sysroot', type='string')
112 parser.add_option('-a', action='store', dest='arch', type='string') 112 parser.add_option('-a', action='store', dest='arch', type='string')
113 parser.add_option('--atleast-version', action='store', 113 parser.add_option('--atleast-version', action='store',
114 dest='atleast_version', type='string') 114 dest='atleast_version', type='string')
115 parser.add_option('--libdir', action='store_true', dest='libdir')
115 (options, args) = parser.parse_args() 116 (options, args) = parser.parse_args()
116 117
117 # Make a list of regular expressions to strip out. 118 # Make a list of regular expressions to strip out.
118 strip_out = [] 119 strip_out = []
119 if options.strip_out != None: 120 if options.strip_out != None:
120 for regexp in options.strip_out: 121 for regexp in options.strip_out:
121 strip_out.append(re.compile(regexp)) 122 strip_out.append(re.compile(regexp))
122 123
123 SetConfigPath(options) 124 SetConfigPath(options)
124 if options.sysroot: 125 if options.sysroot:
125 prefix = GetPkgConfigPrefixToStrip(args) 126 prefix = GetPkgConfigPrefixToStrip(args)
126 else: 127 else:
127 prefix = '' 128 prefix = ''
128 129
129 if options.atleast_version: 130 if options.atleast_version:
130 # When asking for the return value, just run pkg-config and print the return 131 # When asking for the return value, just run pkg-config and print the return
131 # value, no need to do other work. 132 # value, no need to do other work.
132 if not subprocess.call([options.pkg_config, 133 if not subprocess.call([options.pkg_config,
133 "--atleast-version=" + options.atleast_version] + 134 "--atleast-version=" + options.atleast_version] +
134 args, 135 args,
135 env=os.environ): 136 env=os.environ):
136 print "true" 137 print "true"
137 else: 138 else:
138 print "false" 139 print "false"
139 sys.exit(0) 140 sys.exit(0)
140 141
142 if options.libdir:
143 try:
144 libdir = subprocess.check_output([options.pkg_config,
145 "--variable=libdir"] +
146 args,
147 env=os.environ)
148 except:
149 print "Error from pkg-config."
150 sys.exit(1)
151 sys.stdout.write(libdir.strip())
152 sys.exit(0)
153
141 try: 154 try:
142 flag_string = subprocess.check_output( 155 flag_string = subprocess.check_output(
143 [ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] + 156 [ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] +
144 args, env=os.environ) 157 args, env=os.environ)
145 # For now just split on spaces to get the args out. This will break if 158 # For now just split on spaces to get the args out. This will break if
146 # pkgconfig returns quoted things with spaces in them, but that doesn't seem 159 # pkgconfig returns quoted things with spaces in them, but that doesn't seem
147 # to happen in practice. 160 # to happen in practice.
148 all_flags = flag_string.strip().split(' ') 161 all_flags = flag_string.strip().split(' ')
149 except: 162 except:
150 print "Could not run pkg-config." 163 print "Could not run pkg-config."
(...skipping 27 matching lines...) Expand all
178 # this anyway. Removing it here prevents a bunch of duplicate inclusions on 191 # this anyway. Removing it here prevents a bunch of duplicate inclusions on
179 # the command line. 192 # the command line.
180 pass 193 pass
181 else: 194 else:
182 cflags.append(flag) 195 cflags.append(flag)
183 196
184 # Output a GN array, the first one is the cflags, the second are the libs. The 197 # Output a GN array, the first one is the cflags, the second are the libs. The
185 # JSON formatter prints GN compatible lists when everything is a list of 198 # JSON formatter prints GN compatible lists when everything is a list of
186 # strings. 199 # strings.
187 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) 200 print json.dumps([includes, cflags, libs, lib_dirs, ldflags])
OLDNEW
« no previous file with comments | « build/config/linux/BUILD.gn ('k') | build/linux/system.gyp » ('j') | ui/views/views.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698