|
53 | 53 | os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'clang',
|
54 | 54 | 'scripts'))
|
55 | 55 |
|
56 |
| -from build import (AddCMakeToPath, AddOpenSSLToEnv, AddZlibToPath, |
57 |
| - CheckoutGitRepo, GetLibXml2Dirs, LLVM_BUILD_TOOLS_DIR, |
58 |
| - RunCommand) |
| 56 | +from build import (AddCMakeToPath, AddZlibToPath, CheckoutGitRepo, |
| 57 | + GetLibXml2Dirs, LLVM_BUILD_TOOLS_DIR, RunCommand) |
59 | 58 | from update import (CLANG_REVISION, CLANG_SUB_REVISION, DownloadAndUnpack,
|
60 | 59 | LLVM_BUILD_DIR, GetDefaultHostOs, RmTree, UpdatePackage)
|
61 | 60 | import build
|
|
100 | 99 | os.path.dirname(os.path.abspath(__file__)), 'cargo-config.toml.template')
|
101 | 100 | RUST_SRC_VENDOR_DIR = os.path.join(RUST_SRC_DIR, 'vendor')
|
102 | 101 |
|
| 102 | +# CIPD Versions from: |
| 103 | +# - List all platforms |
| 104 | +# cipd ls infra/3pp/static_libs/openssl/ |
| 105 | +# - Find all versions for a platform |
| 106 | +# cipd instances infra/3pp/static_libs/openssl/linux-amd64 |
| 107 | +# - Find the version tag for a version |
| 108 | +# cipd desc infra/3pp/static_libs/openssl/linux-amd64 --version <instance id> |
| 109 | +# - A version tag looks like: `version:[email protected]` and we |
| 110 | +# store the part after the `2@` here. |
| 111 | +CIPD_DOWNLOAD_URL = f'https://chrome-infra-packages.appspot.com/dl' |
| 112 | +OPENSSL_CIPD_LINUX_AMD_PATH = 'infra/3pp/static_libs/openssl/linux-amd64' |
| 113 | +OPENSSL_CIPD_LINUX_AMD_VERSION = '1.1.1j.chromium.2' |
| 114 | +OPENSSL_CIPD_MAC_AMD_PATH = 'infra/3pp/static_libs/openssl/mac-amd64' |
| 115 | +OPENSSL_CIPD_MAC_AMD_VERSION = '1.1.1j.chromium.2' |
| 116 | +OPENSSL_CIPD_MAC_ARM_PATH = 'infra/3pp/static_libs/openssl/mac-amd64' |
| 117 | +OPENSSL_CIPD_MAC_ARM_VERSION = '1.1.1j.chromium.2' |
| 118 | +# TODO(crbug.com/1271215): Pull Windows OpenSSL from 3pp when it exists. |
| 119 | + |
103 | 120 | if sys.platform == 'win32':
|
104 | 121 | LD_PATH_FLAG = '/LIBPATH:'
|
105 | 122 | else:
|
|
119 | 136 | ]
|
120 | 137 |
|
121 | 138 |
|
| 139 | +def AddOpenSSLToEnv(build_mac_arm): |
| 140 | + """Download OpenSSL, and add to OPENSSL_DIR.""" |
| 141 | + ssl_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'openssl') |
| 142 | + |
| 143 | + if sys.platform == 'darwin': |
| 144 | + if platform.machine() == 'arm64' or build_mac_arm: |
| 145 | + ssl_url = (f'{CIPD_DOWNLOAD_URL}/{OPENSSL_CIPD_MAC_ARM_PATH}' |
| 146 | + f'/+/version:2@{OPENSSL_CIPD_MAC_ARM_VERSION}') |
| 147 | + else: |
| 148 | + ssl_url = (f'{CIPD_DOWNLOAD_URL}/{OPENSSL_CIPD_MAC_AMD_PATH}' |
| 149 | + f'/+/version:2@{OPENSSL_CIPD_MAC_AMD_VERSION}') |
| 150 | + elif sys.platform == 'win32': |
| 151 | + ssl_url = (f'{CIPD_DOWNLOAD_URL}/{OPENSSL_CIPD_WIN_AMD_PATH}' |
| 152 | + f'/+/version:2@{OPENSSL_CIPD_WIN_AMD_VERSION}') |
| 153 | + else: |
| 154 | + ssl_url = (f'{CIPD_DOWNLOAD_URL}/{OPENSSL_CIPD_LINUX_AMD_PATH}' |
| 155 | + f'/+/version:2@{OPENSSL_CIPD_LINUX_AMD_VERSION}') |
| 156 | + |
| 157 | + if os.path.exists(ssl_dir): |
| 158 | + RmTree(ssl_dir) |
| 159 | + DownloadAndUnpack(ssl_url, ssl_dir, is_known_zip=True) |
| 160 | + os.environ['OPENSSL_DIR'] = ssl_dir |
| 161 | + return ssl_dir |
| 162 | + |
| 163 | + |
122 | 164 | def VerifyStage0JsonHash():
|
123 | 165 | hasher = hashlib.sha256()
|
124 | 166 | with open(STAGE0_JSON_PATH, 'rb') as input:
|
@@ -486,9 +528,11 @@ def main():
|
486 | 528 | else:
|
487 | 529 | libxml2_dirs = None
|
488 | 530 |
|
489 |
| - # Cargo requires OpenSSL to build, and it's not already present on Mac |
490 |
| - # builders. |
491 |
| - if sys.platform == 'darwin': |
| 531 | + # TODO(crbug.com/1271215): OpenSSL is somehow already present on the Windows |
| 532 | + # builder, but we should change to using a package from 3pp when it is |
| 533 | + # available. |
| 534 | + if sys.platform != 'win32': |
| 535 | + # Cargo depends on OpenSSL. |
492 | 536 | AddOpenSSLToEnv(args.build_mac_arm)
|
493 | 537 |
|
494 | 538 | if args.run_xpy:
|
|
0 commit comments