| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import os.path | 8 import os.path |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 the main compiler driver and the linker driver, then invokes all the | 45 the main compiler driver and the linker driver, then invokes all the |
| 46 required tools. | 46 required tools. |
| 47 | 47 |
| 48 Args: | 48 Args: |
| 49 args: list of string, Arguments to the script. | 49 args: list of string, Arguments to the script. |
| 50 """ | 50 """ |
| 51 | 51 |
| 52 if len(args) < 2: | 52 if len(args) < 2: |
| 53 raise RuntimeError("Usage: linker_driver.py [linker-invocation]") | 53 raise RuntimeError("Usage: linker_driver.py [linker-invocation]") |
| 54 | 54 |
| 55 for i in xrange(len(args)): |
| 56 if args[i] != '--developer_dir': |
| 57 continue |
| 58 os.environ['DEVELOPER_DIR'] = args[i + 1] |
| 59 del args[i:i+2] |
| 60 break |
| 61 |
| 55 # Collect arguments to the linker driver (this script) and remove them from | 62 # Collect arguments to the linker driver (this script) and remove them from |
| 56 # the arguments being passed to the compiler driver. | 63 # the arguments being passed to the compiler driver. |
| 57 linker_driver_actions = {} | 64 linker_driver_actions = {} |
| 58 compiler_driver_args = [] | 65 compiler_driver_args = [] |
| 59 for arg in args[1:]: | 66 for arg in args[1:]: |
| 60 if arg.startswith(_LINKER_DRIVER_ARG_PREFIX): | 67 if arg.startswith(_LINKER_DRIVER_ARG_PREFIX): |
| 61 # Convert driver actions into a map of name => lambda to invoke. | 68 # Convert driver actions into a map of name => lambda to invoke. |
| 62 driver_action = ProcessLinkerDriverArg(arg) | 69 driver_action = ProcessLinkerDriverArg(arg) |
| 63 assert driver_action[0] not in linker_driver_actions | 70 assert driver_action[0] not in linker_driver_actions |
| 64 linker_driver_actions[driver_action[0]] = driver_action[1] | 71 linker_driver_actions[driver_action[0]] = driver_action[1] |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 _LINKER_DRIVER_ACTIONS = [ | 221 _LINKER_DRIVER_ACTIONS = [ |
| 215 ('dsym,', RunDsymUtil), | 222 ('dsym,', RunDsymUtil), |
| 216 ('unstripped,', RunSaveUnstripped), | 223 ('unstripped,', RunSaveUnstripped), |
| 217 ('strip,', RunStrip), | 224 ('strip,', RunStrip), |
| 218 ] | 225 ] |
| 219 | 226 |
| 220 | 227 |
| 221 if __name__ == '__main__': | 228 if __name__ == '__main__': |
| 222 Main(sys.argv) | 229 Main(sys.argv) |
| 223 sys.exit(0) | 230 sys.exit(0) |
| OLD | NEW |