OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 argparse |
5 import os | 6 import os |
6 import subprocess | 7 import subprocess |
7 import sys | 8 import sys |
8 | 9 |
9 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) | |
10 import mac_toolchain | |
11 | |
12 # This script prints information about the build system, the operating | 10 # This script prints information about the build system, the operating |
13 # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", | 11 # system and the iOS or Mac SDK (depending on the platform "iphonesimulator", |
14 # "iphoneos" or "macosx" generally). | 12 # "iphoneos" or "macosx" generally). |
15 # | 13 # |
16 # In the GYP build, this is done inside GYP itself based on the SDKROOT | 14 # In the GYP build, this is done inside GYP itself based on the SDKROOT |
17 # variable. | 15 # variable. |
18 | 16 |
19 def FormatVersion(version): | 17 def FormatVersion(version): |
20 """Converts Xcode version to a format required for Info.plist.""" | 18 """Converts Xcode version to a format required for Info.plist.""" |
21 version = version.replace('.', '') | 19 version = version.replace('.', '') |
(...skipping 25 matching lines...) Expand all Loading... |
47 # TODO: unconditionally use --show-sdk-build-version once Xcode 7.2 or | 45 # TODO: unconditionally use --show-sdk-build-version once Xcode 7.2 or |
48 # higher is required to build Chrome for iOS or OS X. | 46 # higher is required to build Chrome for iOS or OS X. |
49 if xcode_version >= '0720': | 47 if xcode_version >= '0720': |
50 settings['sdk_build'] = subprocess.check_output([ | 48 settings['sdk_build'] = subprocess.check_output([ |
51 'xcrun', '-sdk', platform, '--show-sdk-build-version']).strip() | 49 'xcrun', '-sdk', platform, '--show-sdk-build-version']).strip() |
52 else: | 50 else: |
53 settings['sdk_build'] = settings['sdk_version'] | 51 settings['sdk_build'] = settings['sdk_version'] |
54 | 52 |
55 | 53 |
56 if __name__ == '__main__': | 54 if __name__ == '__main__': |
57 if len(sys.argv) != 2: | 55 parser = argparse.ArgumentParser() |
| 56 parser.add_argument("--developer_dir", required=False) |
| 57 args, unknownargs = parser.parse_known_args() |
| 58 if args.developer_dir: |
| 59 os.environ['DEVELOPER_DIR'] = args.developer_dir |
| 60 |
| 61 if len(unknownargs) != 1: |
58 sys.stderr.write( | 62 sys.stderr.write( |
59 'usage: %s [iphoneos|iphonesimulator|macosx]\n' % | 63 'usage: %s [iphoneos|iphonesimulator|macosx]\n' % |
60 os.path.basename(sys.argv[0])) | 64 os.path.basename(sys.argv[0])) |
61 sys.exit(1) | 65 sys.exit(1) |
62 | 66 |
63 # Try using the toolchain in mac_files. | |
64 mac_toolchain.SetToolchainEnvironment() | |
65 | |
66 settings = {} | 67 settings = {} |
67 FillMachineOSBuild(settings) | 68 FillMachineOSBuild(settings) |
68 FillXcodeVersion(settings) | 69 FillXcodeVersion(settings) |
69 FillSDKPathAndVersion(settings, sys.argv[1], settings['xcode_version']) | 70 FillSDKPathAndVersion(settings, unknownargs[0], settings['xcode_version']) |
70 | 71 |
71 for key in sorted(settings): | 72 for key in sorted(settings): |
72 print '%s="%s"' % (key, settings[key]) | 73 print '%s="%s"' % (key, settings[key]) |
OLD | NEW |