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