| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 # this anyway. Removing it here prevents a bunch of duplicate inclusions on | 157 # this anyway. Removing it here prevents a bunch of duplicate inclusions on |
| 158 # the command line. | 158 # the command line. |
| 159 pass | 159 pass |
| 160 else: | 160 else: |
| 161 cflags.append(flag) | 161 cflags.append(flag) |
| 162 | 162 |
| 163 # Output a GN array, the first one is the cflags, the second are the libs. The | 163 # 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 | 164 # JSON formatter prints GN compatible lists when everything is a list of |
| 165 # strings. | 165 # strings. |
| 166 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) | 166 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) |
| OLD | NEW |