Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Utility functions to perform Xcode-style build steps. | 6 """Utility functions to perform Xcode-style build steps. |
| 7 | 7 |
| 8 These functions are executed via gyp-mac-tool when using the Makefile generator. | 8 These functions are executed via gyp-mac-tool when using the Makefile generator. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 return subprocess.call(cmd_list) | 216 return subprocess.call(cmd_list) |
| 217 | 217 |
| 218 def ExecFilterLibtool(self, *cmd_list): | 218 def ExecFilterLibtool(self, *cmd_list): |
| 219 """Calls libtool and filters out '/path/to/libtool: file: foo.o has no | 219 """Calls libtool and filters out '/path/to/libtool: file: foo.o has no |
| 220 symbols'.""" | 220 symbols'.""" |
| 221 libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') | 221 libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') |
| 222 libtool_re5 = re.compile( | 222 libtool_re5 = re.compile( |
| 223 r'^.*libtool: warning for library: ' + | 223 r'^.*libtool: warning for library: ' + |
| 224 r'.* the table of contents is empty ' + | 224 r'.* the table of contents is empty ' + |
| 225 r'\(no object file members in the library define global symbols\)$') | 225 r'\(no object file members in the library define global symbols\)$') |
| 226 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) | 226 env = os.environ.copy() |
| 227 # Ref: | |
| 228 # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c | |
| 229 # The problem with this flag is that it resets the file mtime on the file to | |
| 230 # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on daylight saving. | |
|
M-A Ruel
2014/12/11 00:41:35
actually, s/daylight saving/timezone/
Sébastien Marchand
2014/12/11 18:37:45
Done.
| |
| 231 # | |
| 232 # We disable this for iOS as this cause a rebuild of all the library files. | |
| 233 is_ios_target = 'IPHONEOS_DEPLOYMENT_TARGET' in os.environ | |
| 234 if not is_ios_target: | |
| 235 env['ZERO_AR_DATE'] = '1' | |
| 236 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) | |
| 227 _, err = libtoolout.communicate() | 237 _, err = libtoolout.communicate() |
| 228 for line in err.splitlines(): | 238 for line in err.splitlines(): |
| 229 if not libtool_re.match(line) and not libtool_re5.match(line): | 239 if not libtool_re.match(line) and not libtool_re5.match(line): |
| 230 print >>sys.stderr, line | 240 print >>sys.stderr, line |
| 241 # Unconditionally touch any file .a file on the command line if present if | |
| 242 # succeeded. A bit hacky. | |
| 243 if not is_ios_target and not libtoolout.returncode: | |
| 244 archives = [ | |
| 245 cmd for cmd in cmd_list if cmd.endswith('.a') and os.path.isfile(cmd) | |
| 246 ] | |
| 247 if len(archives) == 1: | |
| 248 os.utime(archives[0], None) | |
| 231 return libtoolout.returncode | 249 return libtoolout.returncode |
| 232 | 250 |
| 233 def ExecPackageFramework(self, framework, version): | 251 def ExecPackageFramework(self, framework, version): |
| 234 """Takes a path to Something.framework and the Current version of that and | 252 """Takes a path to Something.framework and the Current version of that and |
| 235 sets up all the symlinks.""" | 253 sets up all the symlinks.""" |
| 236 # Find the name of the binary based on the part before the ".framework". | 254 # Find the name of the binary based on the part before the ".framework". |
| 237 binary = os.path.basename(framework).split('.')[0] | 255 binary = os.path.basename(framework).split('.')[0] |
| 238 | 256 |
| 239 CURRENT = 'Current' | 257 CURRENT = 'Current' |
| 240 RESOURCES = 'Resources' | 258 RESOURCES = 'Resources' |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 data = data.replace('$(%s)' % key, value) | 596 data = data.replace('$(%s)' % key, value) |
| 579 return data | 597 return data |
| 580 if isinstance(data, list): | 598 if isinstance(data, list): |
| 581 return [self._ExpandVariables(v, substitutions) for v in data] | 599 return [self._ExpandVariables(v, substitutions) for v in data] |
| 582 if isinstance(data, dict): | 600 if isinstance(data, dict): |
| 583 return {k: self._ExpandVariables(data[k], substitutions) for k in data} | 601 return {k: self._ExpandVariables(data[k], substitutions) for k in data} |
| 584 return data | 602 return data |
| 585 | 603 |
| 586 if __name__ == '__main__': | 604 if __name__ == '__main__': |
| 587 sys.exit(main(sys.argv[1:])) | 605 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |