15f9996aaSopenharmony_ci# Copyright 2014 The Chromium Authors. All rights reserved. 25f9996aaSopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 35f9996aaSopenharmony_ci# found in the LICENSE file. 45f9996aaSopenharmony_ci 55f9996aaSopenharmony_ciimport("//build/config/mac/mac_sdk_overrides.gni") 65f9996aaSopenharmony_ciimport("//build/toolchain/toolchain.gni") 75f9996aaSopenharmony_ci 85f9996aaSopenharmony_cideclare_args() { 95f9996aaSopenharmony_ci # The MACOSX_DEPLOYMENT_TARGET variable used when compiling. This partially 105f9996aaSopenharmony_ci # controls the minimum supported version of macOS for Chromium by 115f9996aaSopenharmony_ci # affecting the symbol availability rules. This may differ from 125f9996aaSopenharmony_ci # mac_min_system_version when dropping support for older macOSes but where 135f9996aaSopenharmony_ci # additional code changes are required to be compliant with the availability 145f9996aaSopenharmony_ci # rules. 155f9996aaSopenharmony_ci # Must be of the form x.x.x for Info.plist files. 165f9996aaSopenharmony_ci mac_deployment_target = "10.13.0" 175f9996aaSopenharmony_ci 185f9996aaSopenharmony_ci # The value of the LSMinimumSystemVersion in Info.plist files. This partially 195f9996aaSopenharmony_ci # controls the minimum supported version of macOS for Chromium by 205f9996aaSopenharmony_ci # affecting the Info.plist. This may differ from mac_deployment_target when 215f9996aaSopenharmony_ci # dropping support for older macOSes. This should be greater than or equal to 225f9996aaSopenharmony_ci # the mac_deployment_target version. 235f9996aaSopenharmony_ci # Must be of the form x.x.x for Info.plist files. 245f9996aaSopenharmony_ci mac_min_system_version = "10.13.0" 255f9996aaSopenharmony_ci 265f9996aaSopenharmony_ci # Path to a specific version of the Mac SDK, not including a slash at the end. 275f9996aaSopenharmony_ci # If empty, the path to the lowest version greater than or equal to 285f9996aaSopenharmony_ci # mac_sdk_min is used. 295f9996aaSopenharmony_ci mac_sdk_path = "" 305f9996aaSopenharmony_ci 315f9996aaSopenharmony_ci # The SDK name as accepted by xcodebuild. 325f9996aaSopenharmony_ci mac_sdk_name = "macosx" 335f9996aaSopenharmony_ci} 345f9996aaSopenharmony_ci 355f9996aaSopenharmony_ci# Check that the version of macOS SDK used is the one requested when building 365f9996aaSopenharmony_ci# a version of Chrome shipped to the users. Disable the check if building for 375f9996aaSopenharmony_ci# iOS as the version macOS SDK used is not relevant for the tool build for the 385f9996aaSopenharmony_ci# host (they are not shipped) --- this is required as Chrome on iOS is usually 395f9996aaSopenharmony_ci# build with the latest version of Xcode that may not ship with the version of 405f9996aaSopenharmony_ci# the macOS SDK used to build Chrome on mac. 415f9996aaSopenharmony_ci_verify_sdk = is_official_build && target_os != "ios" 425f9996aaSopenharmony_ci 435f9996aaSopenharmony_cifind_sdk_args = [ "--print_sdk_path" ] 445f9996aaSopenharmony_ciif (!use_system_xcode) { 455f9996aaSopenharmony_ci find_sdk_args += [ 465f9996aaSopenharmony_ci "--developer_dir", 475f9996aaSopenharmony_ci hermetic_xcode_path, 485f9996aaSopenharmony_ci ] 495f9996aaSopenharmony_ci} 505f9996aaSopenharmony_ciif (_verify_sdk) { 515f9996aaSopenharmony_ci find_sdk_args += [ 525f9996aaSopenharmony_ci "--verify", 535f9996aaSopenharmony_ci mac_sdk_min, 545f9996aaSopenharmony_ci "--sdk_path=" + mac_sdk_path, 555f9996aaSopenharmony_ci ] 565f9996aaSopenharmony_ci} else { 575f9996aaSopenharmony_ci find_sdk_args += [ mac_sdk_min ] 585f9996aaSopenharmony_ci} 595f9996aaSopenharmony_ci 605f9996aaSopenharmony_ci# The tool will print the SDK path on the first line, and the version on the 615f9996aaSopenharmony_ci# second line. 625f9996aaSopenharmony_cifind_sdk_lines = 635f9996aaSopenharmony_ci exec_script("//build/misc/mac/find_sdk.py", find_sdk_args, "list lines") 645f9996aaSopenharmony_ci 655f9996aaSopenharmony_cimac_sdk_version = find_sdk_lines[1] 665f9996aaSopenharmony_ciif (mac_sdk_path == "") { 675f9996aaSopenharmony_ci mac_sdk_path = find_sdk_lines[0] 685f9996aaSopenharmony_ci} 695f9996aaSopenharmony_ci 705f9996aaSopenharmony_ciscript_name = "//build/config/mac/sdk_info.py" 715f9996aaSopenharmony_cisdk_info_args = [] 725f9996aaSopenharmony_ciif (!use_system_xcode) { 735f9996aaSopenharmony_ci sdk_info_args += [ 745f9996aaSopenharmony_ci "--developer_dir", 755f9996aaSopenharmony_ci hermetic_xcode_path, 765f9996aaSopenharmony_ci ] 775f9996aaSopenharmony_ci} 785f9996aaSopenharmony_cisdk_info_args += [ mac_sdk_name ] 795f9996aaSopenharmony_ci 805f9996aaSopenharmony_ci_mac_sdk_result = exec_script(script_name, sdk_info_args, "scope") 815f9996aaSopenharmony_cixcode_version = _mac_sdk_result.xcode_version 825f9996aaSopenharmony_cixcode_build = _mac_sdk_result.xcode_build 835f9996aaSopenharmony_cimachine_os_build = _mac_sdk_result.machine_os_build 845f9996aaSopenharmony_cixcode_version_int = _mac_sdk_result.xcode_version_int 855f9996aaSopenharmony_ci 865f9996aaSopenharmony_ciif (mac_sdk_version != mac_sdk_min && 875f9996aaSopenharmony_ci exec_script("//build/misc/mac/check_return_value.py", 885f9996aaSopenharmony_ci [ 895f9996aaSopenharmony_ci "test", 905f9996aaSopenharmony_ci xcode_version, 915f9996aaSopenharmony_ci "-ge", 925f9996aaSopenharmony_ci "0730", 935f9996aaSopenharmony_ci ], 945f9996aaSopenharmony_ci "value") != 1) { 955f9996aaSopenharmony_ci print( 965f9996aaSopenharmony_ci "********************************************************************************") 975f9996aaSopenharmony_ci print( 985f9996aaSopenharmony_ci " WARNING: The Mac OS X SDK is incompatible with the version of Xcode. To fix,") 995f9996aaSopenharmony_ci print( 1005f9996aaSopenharmony_ci " either upgrade Xcode to the latest version or install the Mac OS X") 1015f9996aaSopenharmony_ci print( 1025f9996aaSopenharmony_ci " $mac_sdk_min SDK. For more information, see https://crbug.com/620127.") 1035f9996aaSopenharmony_ci print() 1045f9996aaSopenharmony_ci print(" Current SDK Version: $mac_sdk_version") 1055f9996aaSopenharmony_ci print(" Current Xcode Version: $xcode_version ($xcode_build)") 1065f9996aaSopenharmony_ci print( 1075f9996aaSopenharmony_ci "********************************************************************************") 1085f9996aaSopenharmony_ci assert(false, "SDK is incompatible with Xcode") 1095f9996aaSopenharmony_ci} 110