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 12 matching lines...) Expand all Loading... |
23 # system path to the sysroot used for compiling. This script will attempt to | 23 # system path to the sysroot used for compiling. This script will attempt to |
24 # generate correct paths for the sysroot. | 24 # generate correct paths for the sysroot. |
25 # | 25 # |
26 # When using a sysroot, you must also specify the architecture via | 26 # When using a sysroot, you must also specify the architecture via |
27 # "-a <arch>" where arch is either "x86" or "x64". | 27 # "-a <arch>" where arch is either "x86" or "x64". |
28 | 28 |
29 # If this is run on non-Linux platforms, just return nothing and indicate | 29 # If this is run on non-Linux platforms, just return nothing and indicate |
30 # success. This allows us to "kind of emulate" a Linux build from other | 30 # success. This allows us to "kind of emulate" a Linux build from other |
31 # platforms. | 31 # platforms. |
32 if sys.platform.find("linux") == -1: | 32 if sys.platform.find("linux") == -1: |
33 print "[[],[],[]]" | 33 print "[[],[],[],[]]" |
34 sys.exit(0) | 34 sys.exit(0) |
35 | 35 |
36 | 36 |
37 def SetConfigPath(options): | 37 def SetConfigPath(options): |
38 """Set the PKG_CONFIG_PATH environment variable. | 38 """Set the PKG_CONFIG_PATH environment variable. |
39 This takes into account any sysroot and architecture specification from the | 39 This takes into account any sysroot and architecture specification from the |
40 options on the given command line.""" | 40 options on the given command line.""" |
41 | 41 |
42 sysroot = options.sysroot | 42 sysroot = options.sysroot |
43 if not sysroot: | 43 if not sysroot: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 lib_dirs.append(RewritePath(flag[2:], prefix, sysroot)) | 149 lib_dirs.append(RewritePath(flag[2:], prefix, sysroot)) |
150 elif flag[:2] == '-I': | 150 elif flag[:2] == '-I': |
151 includes.append(RewritePath(flag[2:], prefix, sysroot)) | 151 includes.append(RewritePath(flag[2:], prefix, sysroot)) |
152 else: | 152 else: |
153 cflags.append(flag) | 153 cflags.append(flag) |
154 | 154 |
155 # Output a GN array, the first one is the cflags, the second are the libs. The | 155 # Output a GN array, the first one is the cflags, the second are the libs. The |
156 # JSON formatter prints GN compatible lists when everything is a list of | 156 # JSON formatter prints GN compatible lists when everything is a list of |
157 # strings. | 157 # strings. |
158 print json.dumps([includes, cflags, libs, lib_dirs]) | 158 print json.dumps([includes, cflags, libs, lib_dirs]) |
OLD | NEW |