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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 for regexp in options.strip_out: | 112 for regexp in options.strip_out: |
113 strip_out.append(re.compile(regexp)) | 113 strip_out.append(re.compile(regexp)) |
114 | 114 |
115 SetConfigPath(options) | 115 SetConfigPath(options) |
116 if options.sysroot: | 116 if options.sysroot: |
117 prefix = GetPkgConfigPrefixToStrip(args) | 117 prefix = GetPkgConfigPrefixToStrip(args) |
118 else: | 118 else: |
119 prefix = '' | 119 prefix = '' |
120 | 120 |
121 try: | 121 try: |
122 flag_string = subprocess.check_output(["pkg-config", "--cflags", "--libs"] + | 122 flag_string = subprocess.check_output( |
| 123 [ "pkg-config", "--cflags", "--libs-only-l", "--libs-only-L" ] + |
123 args, env=os.environ) | 124 args, env=os.environ) |
124 # For now just split on spaces to get the args out. This will break if | 125 # For now just split on spaces to get the args out. This will break if |
125 # pkgconfig returns quoted things with spaces in them, but that doesn't seem | 126 # pkgconfig returns quoted things with spaces in them, but that doesn't seem |
126 # to happen in practice. | 127 # to happen in practice. |
127 all_flags = flag_string.strip().split(' ') | 128 all_flags = flag_string.strip().split(' ') |
128 except: | 129 except: |
129 print "Could not run pkg-config." | 130 print "Could not run pkg-config." |
130 sys.exit(1) | 131 sys.exit(1) |
131 | 132 |
132 | 133 |
(...skipping 24 matching lines...) Expand all Loading... |
157 # this anyway. Removing it here prevents a bunch of duplicate inclusions on | 158 # this anyway. Removing it here prevents a bunch of duplicate inclusions on |
158 # the command line. | 159 # the command line. |
159 pass | 160 pass |
160 else: | 161 else: |
161 cflags.append(flag) | 162 cflags.append(flag) |
162 | 163 |
163 # Output a GN array, the first one is the cflags, the second are the libs. The | 164 # Output a GN array, the first one is the cflags, the second are the libs. The |
164 # JSON formatter prints GN compatible lists when everything is a list of | 165 # JSON formatter prints GN compatible lists when everything is a list of |
165 # strings. | 166 # strings. |
166 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) | 167 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) |
OLD | NEW |