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 timezone. |
| 231 env['ZERO_AR_DATE'] = '1' |
| 232 libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) |
227 _, err = libtoolout.communicate() | 233 _, err = libtoolout.communicate() |
228 for line in err.splitlines(): | 234 for line in err.splitlines(): |
229 if not libtool_re.match(line) and not libtool_re5.match(line): | 235 if not libtool_re.match(line) and not libtool_re5.match(line): |
230 print >>sys.stderr, line | 236 print >>sys.stderr, line |
| 237 # Unconditionally touch any file .a file on the command line if present if |
| 238 # succeeded. A bit hacky. |
| 239 if not libtoolout.returncode: |
| 240 archives = [ |
| 241 cmd for cmd in cmd_list if cmd.endswith('.a') and os.path.isfile(cmd) |
| 242 ] |
| 243 if len(archives) == 1: |
| 244 os.utime(archives[0], None) |
231 return libtoolout.returncode | 245 return libtoolout.returncode |
232 | 246 |
233 def ExecPackageFramework(self, framework, version): | 247 def ExecPackageFramework(self, framework, version): |
234 """Takes a path to Something.framework and the Current version of that and | 248 """Takes a path to Something.framework and the Current version of that and |
235 sets up all the symlinks.""" | 249 sets up all the symlinks.""" |
236 # Find the name of the binary based on the part before the ".framework". | 250 # Find the name of the binary based on the part before the ".framework". |
237 binary = os.path.basename(framework).split('.')[0] | 251 binary = os.path.basename(framework).split('.')[0] |
238 | 252 |
239 CURRENT = 'Current' | 253 CURRENT = 'Current' |
240 RESOURCES = 'Resources' | 254 RESOURCES = 'Resources' |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 data = data.replace('$(%s)' % key, value) | 592 data = data.replace('$(%s)' % key, value) |
579 return data | 593 return data |
580 if isinstance(data, list): | 594 if isinstance(data, list): |
581 return [self._ExpandVariables(v, substitutions) for v in data] | 595 return [self._ExpandVariables(v, substitutions) for v in data] |
582 if isinstance(data, dict): | 596 if isinstance(data, dict): |
583 return {k: self._ExpandVariables(data[k], substitutions) for k in data} | 597 return {k: self._ExpandVariables(data[k], substitutions) for k in data} |
584 return data | 598 return data |
585 | 599 |
586 if __name__ == '__main__': | 600 if __name__ == '__main__': |
587 sys.exit(main(sys.argv[1:])) | 601 sys.exit(main(sys.argv[1:])) |
OLD | NEW |