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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 sysroot = options.sysroot | 46 sysroot = options.sysroot |
47 if not sysroot: | 47 if not sysroot: |
48 sysroot = "" | 48 sysroot = "" |
49 | 49 |
50 # Compute the library path name based on the architecture. | 50 # Compute the library path name based on the architecture. |
51 arch = options.arch | 51 arch = options.arch |
52 if sysroot and not arch: | 52 if sysroot and not arch: |
53 print "You must specify an architecture via -a if using a sysroot." | 53 print "You must specify an architecture via -a if using a sysroot." |
54 sys.exit(1) | 54 sys.exit(1) |
55 if arch == 'x64': | 55 |
56 libpath = 'lib64' | 56 # In the gyp world this is configurable via the 'system_libdir' variable, |
57 else: | 57 # which doesn't seem to have an equivelent in gn yet. |
58 libpath = 'lib' | 58 # TOOD(sbc): Make this configurable like it is under gyp. |
| 59 libpath = 'lib' |
59 | 60 |
60 # Add the sysroot path to the environment's PKG_CONFIG_PATH | 61 # Add the sysroot path to the environment's PKG_CONFIG_PATH |
61 config_path = sysroot + '/usr/' + libpath + '/pkgconfig' | 62 config_path = sysroot + '/usr/' + libpath + '/pkgconfig' |
62 config_path += ':' + sysroot + '/usr/share/pkgconfig' | 63 config_path += ':' + sysroot + '/usr/share/pkgconfig' |
63 if 'PKG_CONFIG_PATH' in os.environ: | 64 if 'PKG_CONFIG_PATH' in os.environ: |
64 os.environ['PKG_CONFIG_PATH'] += ':' + config_path | 65 os.environ['PKG_CONFIG_PATH'] += ':' + config_path |
65 else: | 66 else: |
66 os.environ['PKG_CONFIG_PATH'] = config_path | 67 os.environ['PKG_CONFIG_PATH'] = config_path |
67 | 68 |
68 | 69 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 # this anyway. Removing it here prevents a bunch of duplicate inclusions on | 192 # this anyway. Removing it here prevents a bunch of duplicate inclusions on |
192 # the command line. | 193 # the command line. |
193 pass | 194 pass |
194 else: | 195 else: |
195 cflags.append(flag) | 196 cflags.append(flag) |
196 | 197 |
197 # Output a GN array, the first one is the cflags, the second are the libs. The | 198 # 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 | 199 # JSON formatter prints GN compatible lists when everything is a list of |
199 # strings. | 200 # strings. |
200 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) | 201 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) |
OLD | NEW |