• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3# found in the LICENSE file.
4
5import("//build/config/mac/mac_sdk_overrides.gni")
6import("//build/toolchain/toolchain.gni")
7
8declare_args() {
9  # The MACOSX_DEPLOYMENT_TARGET variable used when compiling. This partially
10  # controls the minimum supported version of macOS for Chromium by
11  # affecting the symbol availability rules. This may differ from
12  # mac_min_system_version when dropping support for older macOSes but where
13  # additional code changes are required to be compliant with the availability
14  # rules.
15  # Must be of the form x.x.x for Info.plist files.
16  mac_deployment_target = "10.13.0"
17
18  # The value of the LSMinimumSystemVersion in Info.plist files. This partially
19  # controls the minimum supported version of macOS for Chromium by
20  # affecting the Info.plist. This may differ from mac_deployment_target when
21  # dropping support for older macOSes. This should be greater than or equal to
22  # the mac_deployment_target version.
23  # Must be of the form x.x.x for Info.plist files.
24  mac_min_system_version = "10.13.0"
25
26  # Path to a specific version of the Mac SDK, not including a slash at the end.
27  # If empty, the path to the lowest version greater than or equal to
28  # mac_sdk_min is used.
29  mac_sdk_path = ""
30
31  # The SDK name as accepted by xcodebuild.
32  mac_sdk_name = "macosx"
33}
34
35# Check that the version of macOS SDK used is the one requested when building
36# a version of Chrome shipped to the users. Disable the check if building for
37# iOS as the version macOS SDK used is not relevant for the tool build for the
38# host (they are not shipped) --- this is required as Chrome on iOS is usually
39# build with the latest version of Xcode that may not ship with the version of
40# the macOS SDK used to build Chrome on mac.
41_verify_sdk = is_official_build && target_os != "ios"
42
43find_sdk_args = [ "--print_sdk_path" ]
44if (!use_system_xcode) {
45  find_sdk_args += [
46    "--developer_dir",
47    hermetic_xcode_path,
48  ]
49}
50if (_verify_sdk) {
51  find_sdk_args += [
52    "--verify",
53    mac_sdk_min,
54    "--sdk_path=" + mac_sdk_path,
55  ]
56} else {
57  find_sdk_args += [ mac_sdk_min ]
58}
59
60# The tool will print the SDK path on the first line, and the version on the
61# second line.
62find_sdk_lines =
63    exec_script("//build/misc/mac/find_sdk.py", find_sdk_args, "list lines")
64
65mac_sdk_version = find_sdk_lines[1]
66if (mac_sdk_path == "") {
67  mac_sdk_path = find_sdk_lines[0]
68}
69
70script_name = "//build/config/mac/sdk_info.py"
71sdk_info_args = []
72if (!use_system_xcode) {
73  sdk_info_args += [
74    "--developer_dir",
75    hermetic_xcode_path,
76  ]
77}
78sdk_info_args += [ mac_sdk_name ]
79
80_mac_sdk_result = exec_script(script_name, sdk_info_args, "scope")
81xcode_version = _mac_sdk_result.xcode_version
82xcode_build = _mac_sdk_result.xcode_build
83machine_os_build = _mac_sdk_result.machine_os_build
84xcode_version_int = _mac_sdk_result.xcode_version_int
85
86if (mac_sdk_version != mac_sdk_min &&
87    exec_script("//build/misc/mac/check_return_value.py",
88                [
89                  "test",
90                  xcode_version,
91                  "-ge",
92                  "0730",
93                ],
94                "value") != 1) {
95  print(
96      "********************************************************************************")
97  print(
98      " WARNING: The Mac OS X SDK is incompatible with the version of Xcode. To fix,")
99  print(
100      "          either upgrade Xcode to the latest version or install the Mac OS X")
101  print(
102      "          $mac_sdk_min SDK. For more information, see https://crbug.com/620127.")
103  print()
104  print(" Current SDK Version:   $mac_sdk_version")
105  print(" Current Xcode Version: $xcode_version ($xcode_build)")
106  print(
107      "********************************************************************************")
108  assert(false, "SDK is incompatible with Xcode")
109}
110