Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: build/config/linux/pkg-config.py

Issue 549453004: GN: Fix compile errors with os==chromeos mojo/public build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@signed
Patch Set: Update description Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/arm.gni ('k') | build/config/linux/pkg_config.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if os.path.isabs(path) and not path.startswith(sysroot): 94 if os.path.isabs(path) and not path.startswith(sysroot):
95 if path.startswith(strip_prefix): 95 if path.startswith(strip_prefix):
96 path = path[len(strip_prefix):] 96 path = path[len(strip_prefix):]
97 path = path.lstrip('/') 97 path = path.lstrip('/')
98 return os.path.join(sysroot, path) 98 return os.path.join(sysroot, path)
99 else: 99 else:
100 return path 100 return path
101 101
102 102
103 parser = OptionParser() 103 parser = OptionParser()
104 parser.add_option('-p', action='store', dest='pkg_config', type='string',
105 default='pkg-config')
104 parser.add_option('-v', action='append', dest='strip_out', type='string') 106 parser.add_option('-v', action='append', dest='strip_out', type='string')
105 parser.add_option('-s', action='store', dest='sysroot', type='string') 107 parser.add_option('-s', action='store', dest='sysroot', type='string')
106 parser.add_option('-a', action='store', dest='arch', type='string') 108 parser.add_option('-a', action='store', dest='arch', type='string')
107 (options, args) = parser.parse_args() 109 (options, args) = parser.parse_args()
108 110
109 # Make a list of regular expressions to strip out. 111 # Make a list of regular expressions to strip out.
110 strip_out = [] 112 strip_out = []
111 if options.strip_out != None: 113 if options.strip_out != None:
112 for regexp in options.strip_out: 114 for regexp in options.strip_out:
113 strip_out.append(re.compile(regexp)) 115 strip_out.append(re.compile(regexp))
114 116
115 SetConfigPath(options) 117 SetConfigPath(options)
116 if options.sysroot: 118 if options.sysroot:
117 prefix = GetPkgConfigPrefixToStrip(args) 119 prefix = GetPkgConfigPrefixToStrip(args)
118 else: 120 else:
119 prefix = '' 121 prefix = ''
120 122
121 try: 123 try:
122 flag_string = subprocess.check_output( 124 flag_string = subprocess.check_output(
123 [ "pkg-config", "--cflags", "--libs-only-l", "--libs-only-L" ] + 125 [ options.pkg_config, "--cflags", "--libs-only-l", "--libs-only-L" ] +
124 args, env=os.environ) 126 args, env=os.environ)
125 # For now just split on spaces to get the args out. This will break if 127 # For now just split on spaces to get the args out. This will break if
126 # pkgconfig returns quoted things with spaces in them, but that doesn't seem 128 # pkgconfig returns quoted things with spaces in them, but that doesn't seem
127 # to happen in practice. 129 # to happen in practice.
128 all_flags = flag_string.strip().split(' ') 130 all_flags = flag_string.strip().split(' ')
129 except: 131 except:
130 print "Could not run pkg-config." 132 print "Could not run pkg-config."
131 sys.exit(1) 133 sys.exit(1)
132 134
133 135
(...skipping 24 matching lines...) Expand all
158 # this anyway. Removing it here prevents a bunch of duplicate inclusions on 160 # this anyway. Removing it here prevents a bunch of duplicate inclusions on
159 # the command line. 161 # the command line.
160 pass 162 pass
161 else: 163 else:
162 cflags.append(flag) 164 cflags.append(flag)
163 165
164 # Output a GN array, the first one is the cflags, the second are the libs. The 166 # Output a GN array, the first one is the cflags, the second are the libs. The
165 # JSON formatter prints GN compatible lists when everything is a list of 167 # JSON formatter prints GN compatible lists when everything is a list of
166 # strings. 168 # strings.
167 print json.dumps([includes, cflags, libs, lib_dirs, ldflags]) 169 print json.dumps([includes, cflags, libs, lib_dirs, ldflags])
OLDNEW
« no previous file with comments | « build/config/arm.gni ('k') | build/config/linux/pkg_config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698