OLD | NEW |
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 args, | 146 args, |
147 env=os.environ) | 147 env=os.environ) |
148 except: | 148 except: |
149 print "Error from pkg-config." | 149 print "Error from pkg-config." |
150 sys.exit(1) | 150 sys.exit(1) |
151 sys.stdout.write(libdir.strip()) | 151 sys.stdout.write(libdir.strip()) |
152 sys.exit(0) | 152 sys.exit(0) |
153 | 153 |
154 try: | 154 try: |
155 flag_string = subprocess.check_output( | 155 flag_string = subprocess.check_output( |
156 [ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] + | 156 [ options.pkg_config, "--cflags", "--libs" ] + |
157 args, env=os.environ) | 157 args, env=os.environ) |
158 # 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 |
159 # 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 |
160 # to happen in practice. | 160 # to happen in practice. |
161 all_flags = flag_string.strip().split(' ') | 161 all_flags = flag_string.strip().split(' ') |
162 except: | 162 except: |
163 print "Could not run pkg-config." | 163 print "Could not run pkg-config." |
164 sys.exit(1) | 164 sys.exit(1) |
165 | 165 |
166 | 166 |
(...skipping 24 matching lines...) Expand all Loading... |
191 # 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 |
192 # the command line. | 192 # the command line. |
193 pass | 193 pass |
194 else: | 194 else: |
195 cflags.append(flag) | 195 cflags.append(flag) |
196 | 196 |
197 # 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 |
198 # 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 |
199 # strings. | 199 # strings. |
200 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) | 200 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) |
OLD | NEW |