Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 1 | # coding=utf8 |
| 2 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 3 | # Copyright (c) 2015, Google Inc. |
| 4 | # |
| 5 | # Permission to use, copy, modify, and/or distribute this software for any |
| 6 | # purpose with or without fee is hereby granted, provided that the above |
| 7 | # copyright notice and this permission notice appear in all copies. |
| 8 | # |
| 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 12 | # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 14 | # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 15 | # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 17 | """Enumerates source files for consumption by various build systems.""" |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 18 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 19 | import optparse |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 20 | import os |
| 21 | import subprocess |
| 22 | import sys |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 23 | import json |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 24 | |
| 25 | |
| 26 | # OS_ARCH_COMBOS maps from OS and platform to the OpenSSL assembly "style" for |
| 27 | # that platform and the extension used by asm files. |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 28 | # |
| 29 | # TODO(https://crbug.com/boringssl/524): This probably should be a map, but some |
| 30 | # downstream scripts import this to find what folders to add/remove from git. |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 31 | OS_ARCH_COMBOS = [ |
David Benjamin | 351b2f8 | 2022-02-06 12:57:17 -0500 | [diff] [blame] | 32 | ('apple', 'arm', 'ios32', [], 'S'), |
| 33 | ('apple', 'aarch64', 'ios64', [], 'S'), |
| 34 | ('apple', 'x86', 'macosx', ['-fPIC', '-DOPENSSL_IA32_SSE2'], 'S'), |
| 35 | ('apple', 'x86_64', 'macosx', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 36 | ('linux', 'arm', 'linux32', [], 'S'), |
| 37 | ('linux', 'aarch64', 'linux64', [], 'S'), |
| 38 | ('linux', 'x86', 'elf', ['-fPIC', '-DOPENSSL_IA32_SSE2'], 'S'), |
| 39 | ('linux', 'x86_64', 'elf', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 40 | ('win', 'x86', 'win32n', ['-DOPENSSL_IA32_SSE2'], 'asm'), |
| 41 | ('win', 'x86_64', 'nasm', [], 'asm'), |
Anthony Roberts | afd5dba | 2020-10-19 12:27:51 +0100 | [diff] [blame] | 42 | ('win', 'aarch64', 'win64', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 43 | ] |
| 44 | |
| 45 | # NON_PERL_FILES enumerates assembly files that are not processed by the |
| 46 | # perlasm system. |
| 47 | NON_PERL_FILES = { |
| 48 | ('linux', 'arm'): [ |
Adam Langley | 7b8b9c1 | 2016-01-04 07:13:00 -0800 | [diff] [blame] | 49 | 'src/crypto/curve25519/asm/x25519-asm-arm.S', |
David Benjamin | 3c4a5cb | 2016-03-29 17:43:31 -0400 | [diff] [blame] | 50 | 'src/crypto/poly1305/poly1305_arm_asm.S', |
Adam Langley | 7b93593 | 2018-11-12 13:53:42 -0800 | [diff] [blame] | 51 | ], |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 54 | PREFIX = None |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 55 | EMBED_TEST_DATA = True |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 56 | |
| 57 | |
| 58 | def PathOf(x): |
| 59 | return x if not PREFIX else os.path.join(PREFIX, x) |
| 60 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 61 | |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 62 | LICENSE_TEMPLATE = """Copyright (c) 2015, Google Inc. |
| 63 | |
| 64 | Permission to use, copy, modify, and/or distribute this software for any |
| 65 | purpose with or without fee is hereby granted, provided that the above |
| 66 | copyright notice and this permission notice appear in all copies. |
| 67 | |
| 68 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 69 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 70 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 71 | SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 72 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 73 | OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 74 | CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.""".split("\n") |
| 75 | |
| 76 | def LicenseHeader(comment): |
| 77 | lines = [] |
| 78 | for line in LICENSE_TEMPLATE: |
| 79 | if not line: |
| 80 | lines.append(comment) |
| 81 | else: |
| 82 | lines.append("%s %s" % (comment, line)) |
| 83 | lines.append("") |
| 84 | return "\n".join(lines) |
| 85 | |
| 86 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 87 | class Android(object): |
| 88 | |
| 89 | def __init__(self): |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 90 | self.header = LicenseHeader("#") + """ |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 91 | # This file is created by generate_build_files.py. Do not edit manually. |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 92 | """ |
| 93 | |
| 94 | def PrintVariableSection(self, out, name, files): |
| 95 | out.write('%s := \\\n' % name) |
| 96 | for f in sorted(files): |
| 97 | out.write(' %s\\\n' % f) |
| 98 | out.write('\n') |
| 99 | |
| 100 | def WriteFiles(self, files, asm_outputs): |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 101 | # New Android.bp format |
| 102 | with open('sources.bp', 'w+') as blueprint: |
| 103 | blueprint.write(self.header.replace('#', '//')) |
| 104 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 105 | # Separate out BCM files to allow different compilation rules (specific to Android FIPS) |
| 106 | bcm_c_files = files['bcm_crypto'] |
| 107 | non_bcm_c_files = [file for file in files['crypto'] if file not in bcm_c_files] |
| 108 | non_bcm_asm = self.FilterBcmAsm(asm_outputs, False) |
| 109 | bcm_asm = self.FilterBcmAsm(asm_outputs, True) |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 110 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 111 | self.PrintDefaults(blueprint, 'libcrypto_sources', non_bcm_c_files, non_bcm_asm) |
| 112 | self.PrintDefaults(blueprint, 'libcrypto_bcm_sources', bcm_c_files, bcm_asm) |
| 113 | self.PrintDefaults(blueprint, 'libssl_sources', files['ssl']) |
| 114 | self.PrintDefaults(blueprint, 'bssl_sources', files['tool']) |
| 115 | self.PrintDefaults(blueprint, 'boringssl_test_support_sources', files['test_support']) |
| 116 | self.PrintDefaults(blueprint, 'boringssl_crypto_test_sources', files['crypto_test']) |
| 117 | self.PrintDefaults(blueprint, 'boringssl_ssl_test_sources', files['ssl_test']) |
| 118 | |
| 119 | # Legacy Android.mk format, only used by Trusty in new branches |
| 120 | with open('sources.mk', 'w+') as makefile: |
| 121 | makefile.write(self.header) |
| 122 | makefile.write('\n') |
| 123 | self.PrintVariableSection(makefile, 'crypto_sources', files['crypto']) |
| 124 | |
| 125 | for ((osname, arch), asm_files) in asm_outputs: |
| 126 | if osname != 'linux': |
| 127 | continue |
| 128 | self.PrintVariableSection( |
| 129 | makefile, '%s_%s_sources' % (osname, arch), asm_files) |
| 130 | |
| 131 | def PrintDefaults(self, blueprint, name, files, asm_outputs={}): |
| 132 | """Print a cc_defaults section from a list of C files and optionally assembly outputs""" |
| 133 | blueprint.write('\n') |
| 134 | blueprint.write('cc_defaults {\n') |
| 135 | blueprint.write(' name: "%s",\n' % name) |
| 136 | blueprint.write(' srcs: [\n') |
| 137 | for f in sorted(files): |
| 138 | blueprint.write(' "%s",\n' % f) |
| 139 | blueprint.write(' ],\n') |
| 140 | |
| 141 | if asm_outputs: |
| 142 | blueprint.write(' target: {\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 143 | for ((osname, arch), asm_files) in asm_outputs: |
David Benjamin | 5fdc03f | 2023-01-26 18:55:32 -0500 | [diff] [blame] | 144 | if osname != 'linux': |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 145 | continue |
| 146 | if arch == 'aarch64': |
| 147 | arch = 'arm64' |
| 148 | |
Dan Willemsen | 2eb4bc5 | 2017-10-16 14:37:00 -0700 | [diff] [blame] | 149 | blueprint.write(' linux_%s: {\n' % arch) |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 150 | blueprint.write(' srcs: [\n') |
| 151 | for f in sorted(asm_files): |
| 152 | blueprint.write(' "%s",\n' % f) |
| 153 | blueprint.write(' ],\n') |
| 154 | blueprint.write(' },\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 155 | blueprint.write(' },\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 156 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 157 | blueprint.write('}\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 158 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 159 | def FilterBcmAsm(self, asm, want_bcm): |
| 160 | """Filter a list of assembly outputs based on whether they belong in BCM |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 161 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 162 | Args: |
| 163 | asm: Assembly file lists to filter |
| 164 | want_bcm: If true then include BCM files, otherwise do not |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 165 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 166 | Returns: |
| 167 | A copy of |asm| with files filtered according to |want_bcm| |
| 168 | """ |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 169 | # TODO(https://crbug.com/boringssl/542): Rather than filtering by filename, |
| 170 | # use the variable listed in the CMake perlasm line, available in |
| 171 | # ExtractPerlAsmFromCMakeFile. |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 172 | return [(archinfo, filter(lambda p: ("/crypto/fipsmodule/" in p) == want_bcm, files)) |
| 173 | for (archinfo, files) in asm] |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 174 | |
| 175 | |
David Benjamin | eca48e5 | 2019-08-13 11:51:53 -0400 | [diff] [blame] | 176 | class AndroidCMake(object): |
| 177 | |
| 178 | def __init__(self): |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 179 | self.header = LicenseHeader("#") + """ |
David Benjamin | eca48e5 | 2019-08-13 11:51:53 -0400 | [diff] [blame] | 180 | # This file is created by generate_build_files.py. Do not edit manually. |
| 181 | # To specify a custom path prefix, set BORINGSSL_ROOT before including this |
| 182 | # file, or use list(TRANSFORM ... PREPEND) from CMake 3.12. |
| 183 | |
| 184 | """ |
| 185 | |
| 186 | def PrintVariableSection(self, out, name, files): |
| 187 | out.write('set(%s\n' % name) |
| 188 | for f in sorted(files): |
| 189 | # Ideally adding the prefix would be the caller's job, but |
| 190 | # list(TRANSFORM ... PREPEND) is only available starting CMake 3.12. When |
| 191 | # sources.cmake is the source of truth, we can ask Android to either write |
| 192 | # a CMake function or update to 3.12. |
| 193 | out.write(' ${BORINGSSL_ROOT}%s\n' % f) |
| 194 | out.write(')\n') |
| 195 | |
| 196 | def WriteFiles(self, files, asm_outputs): |
| 197 | # The Android emulator uses a custom CMake buildsystem. |
| 198 | # |
| 199 | # TODO(davidben): Move our various source lists into sources.cmake and have |
| 200 | # Android consume that directly. |
| 201 | with open('android-sources.cmake', 'w+') as out: |
| 202 | out.write(self.header) |
| 203 | |
| 204 | self.PrintVariableSection(out, 'crypto_sources', files['crypto']) |
| 205 | self.PrintVariableSection(out, 'ssl_sources', files['ssl']) |
| 206 | self.PrintVariableSection(out, 'tool_sources', files['tool']) |
| 207 | self.PrintVariableSection(out, 'test_support_sources', |
| 208 | files['test_support']) |
| 209 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 210 | files['crypto_test']) |
| 211 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
| 212 | |
| 213 | for ((osname, arch), asm_files) in asm_outputs: |
| 214 | self.PrintVariableSection( |
| 215 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
| 216 | |
| 217 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 218 | class Bazel(object): |
| 219 | """Bazel outputs files suitable for including in Bazel files.""" |
| 220 | |
| 221 | def __init__(self): |
| 222 | self.firstSection = True |
| 223 | self.header = \ |
| 224 | """# This file is created by generate_build_files.py. Do not edit manually. |
| 225 | |
| 226 | """ |
| 227 | |
| 228 | def PrintVariableSection(self, out, name, files): |
| 229 | if not self.firstSection: |
| 230 | out.write('\n') |
| 231 | self.firstSection = False |
| 232 | |
| 233 | out.write('%s = [\n' % name) |
| 234 | for f in sorted(files): |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 235 | out.write(' "%s",\n' % PathOf(f)) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 236 | out.write(']\n') |
| 237 | |
| 238 | def WriteFiles(self, files, asm_outputs): |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 239 | with open('BUILD.generated.bzl', 'w+') as out: |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 240 | out.write(self.header) |
| 241 | |
| 242 | self.PrintVariableSection(out, 'ssl_headers', files['ssl_headers']) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 243 | self.PrintVariableSection(out, 'fips_fragments', files['fips_fragments']) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 244 | self.PrintVariableSection( |
| 245 | out, 'ssl_internal_headers', files['ssl_internal_headers']) |
| 246 | self.PrintVariableSection(out, 'ssl_sources', files['ssl']) |
| 247 | self.PrintVariableSection(out, 'crypto_headers', files['crypto_headers']) |
| 248 | self.PrintVariableSection( |
| 249 | out, 'crypto_internal_headers', files['crypto_internal_headers']) |
| 250 | self.PrintVariableSection(out, 'crypto_sources', files['crypto']) |
| 251 | self.PrintVariableSection(out, 'tool_sources', files['tool']) |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 252 | self.PrintVariableSection(out, 'tool_headers', files['tool_headers']) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 253 | |
| 254 | for ((osname, arch), asm_files) in asm_outputs: |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 255 | self.PrintVariableSection( |
Piotr Sikora | 3f5fe60 | 2015-10-28 12:24:35 -0700 | [diff] [blame] | 256 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 257 | |
David Benjamin | 23776d0 | 2022-12-09 11:33:17 -0500 | [diff] [blame] | 258 | # Generate combined source lists for gas and nasm. Consumers have a choice |
| 259 | # of using the per-platform ones or the combined ones. In the combined |
| 260 | # mode, Windows x86 and Windows x86_64 must still be special-cased, but |
| 261 | # otherwise all assembly files can be linked together. |
| 262 | out.write('\n') |
| 263 | out.write('crypto_sources_asm = []\n') |
| 264 | for (osname, arch, _, _, asm_ext) in OS_ARCH_COMBOS: |
| 265 | if asm_ext == 'S': |
| 266 | out.write('crypto_sources_asm.extend(crypto_sources_%s_%s)\n' % |
| 267 | (osname, arch)) |
| 268 | out.write('\n') |
| 269 | out.write('crypto_sources_nasm = []\n') |
| 270 | for (osname, arch, _, _, asm_ext) in OS_ARCH_COMBOS: |
| 271 | if asm_ext == 'asm': |
| 272 | out.write('crypto_sources_nasm.extend(crypto_sources_%s_%s)\n' % |
| 273 | (osname, arch)) |
| 274 | |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 275 | with open('BUILD.generated_tests.bzl', 'w+') as out: |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 276 | out.write(self.header) |
| 277 | |
| 278 | out.write('test_support_sources = [\n') |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 279 | for filename in sorted(files['test_support'] + |
| 280 | files['test_support_headers'] + |
| 281 | files['crypto_internal_headers'] + |
| 282 | files['ssl_internal_headers']): |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 283 | if os.path.basename(filename) == 'malloc.cc': |
| 284 | continue |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 285 | out.write(' "%s",\n' % PathOf(filename)) |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 286 | |
Adam Langley | 7b6acc5 | 2017-07-27 16:33:27 -0700 | [diff] [blame] | 287 | out.write(']\n') |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 288 | |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 289 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 290 | files['crypto_test']) |
| 291 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 292 | self.PrintVariableSection(out, 'crypto_test_data', |
| 293 | files['crypto_test_data']) |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 294 | self.PrintVariableSection(out, 'urandom_test_sources', |
| 295 | files['urandom_test']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 296 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 297 | |
Robert Sloan | e091af4 | 2017-10-09 12:47:17 -0700 | [diff] [blame] | 298 | class Eureka(object): |
| 299 | |
| 300 | def __init__(self): |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 301 | self.header = LicenseHeader("#") + """ |
Robert Sloan | e091af4 | 2017-10-09 12:47:17 -0700 | [diff] [blame] | 302 | # This file is created by generate_build_files.py. Do not edit manually. |
| 303 | |
| 304 | """ |
| 305 | |
| 306 | def PrintVariableSection(self, out, name, files): |
| 307 | out.write('%s := \\\n' % name) |
| 308 | for f in sorted(files): |
| 309 | out.write(' %s\\\n' % f) |
| 310 | out.write('\n') |
| 311 | |
| 312 | def WriteFiles(self, files, asm_outputs): |
| 313 | # Legacy Android.mk format |
| 314 | with open('eureka.mk', 'w+') as makefile: |
| 315 | makefile.write(self.header) |
| 316 | |
| 317 | self.PrintVariableSection(makefile, 'crypto_sources', files['crypto']) |
| 318 | self.PrintVariableSection(makefile, 'ssl_sources', files['ssl']) |
| 319 | self.PrintVariableSection(makefile, 'tool_sources', files['tool']) |
| 320 | |
| 321 | for ((osname, arch), asm_files) in asm_outputs: |
| 322 | if osname != 'linux': |
| 323 | continue |
| 324 | self.PrintVariableSection( |
| 325 | makefile, '%s_%s_sources' % (osname, arch), asm_files) |
| 326 | |
| 327 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 328 | class GN(object): |
| 329 | |
| 330 | def __init__(self): |
| 331 | self.firstSection = True |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 332 | self.header = LicenseHeader("#") + """ |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 333 | # This file is created by generate_build_files.py. Do not edit manually. |
| 334 | |
| 335 | """ |
| 336 | |
| 337 | def PrintVariableSection(self, out, name, files): |
| 338 | if not self.firstSection: |
| 339 | out.write('\n') |
| 340 | self.firstSection = False |
| 341 | |
| 342 | out.write('%s = [\n' % name) |
| 343 | for f in sorted(files): |
| 344 | out.write(' "%s",\n' % f) |
| 345 | out.write(']\n') |
| 346 | |
| 347 | def WriteFiles(self, files, asm_outputs): |
| 348 | with open('BUILD.generated.gni', 'w+') as out: |
| 349 | out.write(self.header) |
| 350 | |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 351 | self.PrintVariableSection(out, 'crypto_sources', |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 352 | files['crypto'] + |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 353 | files['crypto_internal_headers']) |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 354 | self.PrintVariableSection(out, 'crypto_headers', |
| 355 | files['crypto_headers']) |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 356 | self.PrintVariableSection(out, 'ssl_sources', |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 357 | files['ssl'] + files['ssl_internal_headers']) |
| 358 | self.PrintVariableSection(out, 'ssl_headers', files['ssl_headers']) |
David Benjamin | bb0cb95 | 2020-12-17 16:35:39 -0500 | [diff] [blame] | 359 | self.PrintVariableSection(out, 'tool_sources', |
| 360 | files['tool'] + files['tool_headers']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 361 | |
| 362 | for ((osname, arch), asm_files) in asm_outputs: |
| 363 | self.PrintVariableSection( |
| 364 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
| 365 | |
| 366 | fuzzers = [os.path.splitext(os.path.basename(fuzzer))[0] |
| 367 | for fuzzer in files['fuzz']] |
| 368 | self.PrintVariableSection(out, 'fuzzers', fuzzers) |
| 369 | |
| 370 | with open('BUILD.generated_tests.gni', 'w+') as out: |
| 371 | self.firstSection = True |
| 372 | out.write(self.header) |
| 373 | |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 374 | self.PrintVariableSection(out, 'test_support_sources', |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 375 | files['test_support'] + |
| 376 | files['test_support_headers']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 377 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 378 | files['crypto_test']) |
David Benjamin | f014d60 | 2019-05-07 18:58:06 -0500 | [diff] [blame] | 379 | self.PrintVariableSection(out, 'crypto_test_data', |
| 380 | files['crypto_test_data']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 381 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 382 | |
| 383 | |
| 384 | class GYP(object): |
| 385 | |
| 386 | def __init__(self): |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 387 | self.header = LicenseHeader("#") + """ |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 388 | # This file is created by generate_build_files.py. Do not edit manually. |
| 389 | |
| 390 | """ |
| 391 | |
| 392 | def PrintVariableSection(self, out, name, files): |
| 393 | out.write(' \'%s\': [\n' % name) |
| 394 | for f in sorted(files): |
| 395 | out.write(' \'%s\',\n' % f) |
| 396 | out.write(' ],\n') |
| 397 | |
| 398 | def WriteFiles(self, files, asm_outputs): |
| 399 | with open('boringssl.gypi', 'w+') as gypi: |
| 400 | gypi.write(self.header + '{\n \'variables\': {\n') |
| 401 | |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 402 | self.PrintVariableSection(gypi, 'boringssl_ssl_sources', |
| 403 | files['ssl'] + files['ssl_headers'] + |
| 404 | files['ssl_internal_headers']) |
| 405 | self.PrintVariableSection(gypi, 'boringssl_crypto_sources', |
| 406 | files['crypto'] + files['crypto_headers'] + |
| 407 | files['crypto_internal_headers']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 408 | |
| 409 | for ((osname, arch), asm_files) in asm_outputs: |
| 410 | self.PrintVariableSection(gypi, 'boringssl_%s_%s_sources' % |
| 411 | (osname, arch), asm_files) |
| 412 | |
| 413 | gypi.write(' }\n}\n') |
| 414 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 415 | class CMake(object): |
| 416 | |
| 417 | def __init__(self): |
David Benjamin | 70690f7 | 2023-01-25 09:56:43 -0500 | [diff] [blame] | 418 | self.header = LicenseHeader("#") + R''' |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 419 | # This file is created by generate_build_files.py. Do not edit manually. |
| 420 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 421 | cmake_minimum_required(VERSION 3.10) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 422 | |
| 423 | project(BoringSSL LANGUAGES C CXX) |
| 424 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 425 | set(CMAKE_CXX_STANDARD 14) |
| 426 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 427 | set(CMAKE_C_STANDARD 11) |
| 428 | set(CMAKE_C_STANDARD_REQUIRED ON) |
| 429 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 430 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fno-common -fno-exceptions -fno-rtti") |
| 431 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fno-common") |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 432 | endif() |
| 433 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 434 | # pthread_rwlock_t requires a feature flag on glibc. |
| 435 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 436 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700") |
| 437 | endif() |
| 438 | |
| 439 | if(WIN32) |
| 440 | add_definitions(-D_HAS_EXCEPTIONS=0) |
| 441 | add_definitions(-DWIN32_LEAN_AND_MEAN) |
| 442 | add_definitions(-DNOMINMAX) |
| 443 | # Allow use of fopen. |
| 444 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 445 | endif() |
| 446 | |
| 447 | add_definitions(-DBORINGSSL_IMPLEMENTATION) |
| 448 | |
David Benjamin | 67bb28c | 2023-02-01 14:40:03 -0500 | [diff] [blame] | 449 | if(OPENSSL_NO_ASM) |
| 450 | add_definitions(-DOPENSSL_NO_ASM) |
| 451 | else() |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 452 | # On x86 and x86_64 Windows, we use the NASM output. |
| 453 | if(WIN32 AND CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|x86_64|amd64|x86|i[3-6]86") |
| 454 | enable_language(ASM_NASM) |
| 455 | set(OPENSSL_NASM TRUE) |
| 456 | set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -gcv8") |
| 457 | else() |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 458 | enable_language(ASM) |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 459 | set(OPENSSL_ASM TRUE) |
David Benjamin | 61266e4 | 2023-01-29 15:53:30 -0500 | [diff] [blame^] | 460 | # Work around https://gitlab.kitware.com/cmake/cmake/-/issues/20771 in older |
| 461 | # CMake versions. |
| 462 | if(APPLE AND CMAKE_VERSION VERSION_LESS 3.19) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 463 | if(CMAKE_OSX_SYSROOT) |
| 464 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"") |
| 465 | endif() |
| 466 | foreach(arch ${CMAKE_OSX_ARCHITECTURES}) |
| 467 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}") |
| 468 | endforeach() |
| 469 | endif() |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 470 | if(NOT WIN32) |
| 471 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") |
| 472 | endif() |
| 473 | # Clang's integerated assembler does not support debug symbols. |
| 474 | if(NOT CMAKE_ASM_COMPILER_ID MATCHES "Clang") |
| 475 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-g") |
| 476 | endif() |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 477 | endif() |
| 478 | endif() |
| 479 | |
Adam Langley | a0cdbf9 | 2020-01-21 09:07:46 -0800 | [diff] [blame] | 480 | if(BUILD_SHARED_LIBS) |
| 481 | add_definitions(-DBORINGSSL_SHARED_LIBRARY) |
| 482 | # Enable position-independent code globally. This is needed because |
| 483 | # some library targets are OBJECT libraries. |
| 484 | set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
| 485 | endif() |
| 486 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 487 | include_directories(src/include) |
| 488 | |
| 489 | ''' |
| 490 | |
| 491 | def PrintLibrary(self, out, name, files): |
| 492 | out.write('add_library(\n') |
| 493 | out.write(' %s\n\n' % name) |
| 494 | |
| 495 | for f in sorted(files): |
| 496 | out.write(' %s\n' % PathOf(f)) |
| 497 | |
| 498 | out.write(')\n\n') |
| 499 | |
| 500 | def PrintExe(self, out, name, files, libs): |
| 501 | out.write('add_executable(\n') |
| 502 | out.write(' %s\n\n' % name) |
| 503 | |
| 504 | for f in sorted(files): |
| 505 | out.write(' %s\n' % PathOf(f)) |
| 506 | |
| 507 | out.write(')\n\n') |
| 508 | out.write('target_link_libraries(%s %s)\n\n' % (name, ' '.join(libs))) |
| 509 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 510 | def PrintVariable(self, out, name, files): |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 511 | out.write('set(\n') |
| 512 | out.write(' %s\n\n' % name) |
| 513 | for f in sorted(files): |
| 514 | out.write(' %s\n' % PathOf(f)) |
| 515 | out.write(')\n\n') |
| 516 | |
| 517 | def WriteFiles(self, files, asm_outputs): |
| 518 | with open('CMakeLists.txt', 'w+') as cmake: |
| 519 | cmake.write(self.header) |
| 520 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 521 | asm_sources = [] |
| 522 | nasm_sources = [] |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 523 | for ((osname, arch), asm_files) in asm_outputs: |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 524 | if (osname, arch) in (('win', 'x86'), ('win', 'x86_64')): |
| 525 | nasm_sources.extend(asm_files) |
| 526 | else: |
| 527 | asm_sources.extend(asm_files) |
| 528 | self.PrintVariable(cmake, 'CRYPTO_SOURCES_ASM', sorted(asm_sources)) |
| 529 | self.PrintVariable(cmake, 'CRYPTO_SOURCES_NASM', sorted(nasm_sources)) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 530 | |
| 531 | cmake.write( |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 532 | R'''if(OPENSSL_ASM) |
| 533 | list(APPEND CRYPTO_SOURCES_ASM_USED ${CRYPTO_SOURCES_ASM}) |
| 534 | endif() |
| 535 | if(OPENSSL_NASM) |
| 536 | list(APPEND CRYPTO_SOURCES_ASM_USED ${CRYPTO_SOURCES_NASM}) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 537 | endif() |
| 538 | |
| 539 | ''') |
| 540 | |
| 541 | self.PrintLibrary(cmake, 'crypto', |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 542 | files['crypto'] + ['${CRYPTO_SOURCES_ASM_USED}']) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 543 | self.PrintLibrary(cmake, 'ssl', files['ssl']) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 544 | self.PrintExe(cmake, 'bssl', files['tool'], ['ssl', 'crypto']) |
| 545 | |
| 546 | cmake.write( |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 547 | R'''if(NOT ANDROID) |
| 548 | find_package(Threads REQUIRED) |
| 549 | target_link_libraries(crypto Threads::Threads) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 550 | endif() |
| 551 | |
David Benjamin | 8f88b27 | 2020-07-09 13:35:01 -0400 | [diff] [blame] | 552 | if(WIN32) |
| 553 | target_link_libraries(bssl ws2_32) |
| 554 | endif() |
| 555 | |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 556 | ''') |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 557 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 558 | class JSON(object): |
| 559 | def WriteFiles(self, files, asm_outputs): |
| 560 | sources = dict(files) |
| 561 | for ((osname, arch), asm_files) in asm_outputs: |
| 562 | sources['crypto_%s_%s' % (osname, arch)] = asm_files |
| 563 | with open('sources.json', 'w+') as f: |
| 564 | json.dump(sources, f, sort_keys=True, indent=2) |
| 565 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 566 | def FindCMakeFiles(directory): |
| 567 | """Returns list of all CMakeLists.txt files recursively in directory.""" |
| 568 | cmakefiles = [] |
| 569 | |
| 570 | for (path, _, filenames) in os.walk(directory): |
| 571 | for filename in filenames: |
| 572 | if filename == 'CMakeLists.txt': |
| 573 | cmakefiles.append(os.path.join(path, filename)) |
| 574 | |
| 575 | return cmakefiles |
| 576 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 577 | def OnlyFIPSFragments(path, dent, is_dir): |
Matthew Braithwaite | 95511e9 | 2017-05-08 16:38:03 -0700 | [diff] [blame] | 578 | return is_dir or (path.startswith( |
| 579 | os.path.join('src', 'crypto', 'fipsmodule', '')) and |
| 580 | NoTests(path, dent, is_dir)) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 581 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 582 | def NoTestsNorFIPSFragments(path, dent, is_dir): |
Adam Langley | 323f1eb | 2017-04-06 17:29:10 -0700 | [diff] [blame] | 583 | return (NoTests(path, dent, is_dir) and |
| 584 | (is_dir or not OnlyFIPSFragments(path, dent, is_dir))) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 585 | |
| 586 | def NoTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 587 | """Filter function that can be passed to FindCFiles in order to remove test |
| 588 | sources.""" |
| 589 | if is_dir: |
| 590 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 591 | return 'test.' not in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 592 | |
| 593 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 594 | def OnlyTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 595 | """Filter function that can be passed to FindCFiles in order to remove |
| 596 | non-test sources.""" |
| 597 | if is_dir: |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 598 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 599 | return '_test.' in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 600 | |
| 601 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 602 | def AllFiles(path, dent, is_dir): |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 603 | """Filter function that can be passed to FindCFiles in order to include all |
| 604 | sources.""" |
| 605 | return True |
| 606 | |
| 607 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 608 | def NoTestRunnerFiles(path, dent, is_dir): |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 609 | """Filter function that can be passed to FindCFiles or FindHeaderFiles in |
| 610 | order to exclude test runner files.""" |
| 611 | # NOTE(martinkr): This prevents .h/.cc files in src/ssl/test/runner, which |
| 612 | # are in their own subpackage, from being included in boringssl/BUILD files. |
| 613 | return not is_dir or dent != 'runner' |
| 614 | |
| 615 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 616 | def NotGTestSupport(path, dent, is_dir): |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 617 | return 'gtest' not in dent and 'abi_test' not in dent |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 618 | |
| 619 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 620 | def SSLHeaderFiles(path, dent, is_dir): |
Aaron Green | 0e15002 | 2018-10-16 12:05:29 -0700 | [diff] [blame] | 621 | return dent in ['ssl.h', 'tls1.h', 'ssl23.h', 'ssl3.h', 'dtls1.h', 'srtp.h'] |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 622 | |
| 623 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 624 | def FindCFiles(directory, filter_func): |
| 625 | """Recurses through directory and returns a list of paths to all the C source |
| 626 | files that pass filter_func.""" |
| 627 | cfiles = [] |
| 628 | |
| 629 | for (path, dirnames, filenames) in os.walk(directory): |
| 630 | for filename in filenames: |
| 631 | if not filename.endswith('.c') and not filename.endswith('.cc'): |
| 632 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 633 | if not filter_func(path, filename, False): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 634 | continue |
| 635 | cfiles.append(os.path.join(path, filename)) |
| 636 | |
| 637 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 638 | if not filter_func(path, dirname, True): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 639 | del dirnames[i] |
| 640 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 641 | cfiles.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 642 | return cfiles |
| 643 | |
| 644 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 645 | def FindHeaderFiles(directory, filter_func): |
| 646 | """Recurses through directory and returns a list of paths to all the header files that pass filter_func.""" |
| 647 | hfiles = [] |
| 648 | |
| 649 | for (path, dirnames, filenames) in os.walk(directory): |
| 650 | for filename in filenames: |
| 651 | if not filename.endswith('.h'): |
| 652 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 653 | if not filter_func(path, filename, False): |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 654 | continue |
| 655 | hfiles.append(os.path.join(path, filename)) |
| 656 | |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 657 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 658 | if not filter_func(path, dirname, True): |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 659 | del dirnames[i] |
| 660 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 661 | hfiles.sort() |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 662 | return hfiles |
| 663 | |
| 664 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 665 | def ExtractPerlAsmFromCMakeFile(cmakefile): |
| 666 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 667 | returns a list of all the perlasm() directives found in the file.""" |
| 668 | perlasms = [] |
| 669 | with open(cmakefile) as f: |
| 670 | for line in f: |
| 671 | line = line.strip() |
| 672 | if not line.startswith('perlasm('): |
| 673 | continue |
| 674 | if not line.endswith(')'): |
| 675 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 676 | # Remove "perlasm(" from start and ")" from end |
| 677 | params = line[8:-1].split() |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 678 | if len(params) != 4: |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 679 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 680 | perlasms.append({ |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 681 | 'arch': params[1], |
| 682 | 'output': os.path.join(os.path.dirname(cmakefile), params[2]), |
| 683 | 'input': os.path.join(os.path.dirname(cmakefile), params[3]), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 684 | }) |
| 685 | |
| 686 | return perlasms |
| 687 | |
| 688 | |
| 689 | def ReadPerlAsmOperations(): |
| 690 | """Returns a list of all perlasm() directives found in CMake config files in |
| 691 | src/.""" |
| 692 | perlasms = [] |
| 693 | cmakefiles = FindCMakeFiles('src') |
| 694 | |
| 695 | for cmakefile in cmakefiles: |
| 696 | perlasms.extend(ExtractPerlAsmFromCMakeFile(cmakefile)) |
| 697 | |
| 698 | return perlasms |
| 699 | |
| 700 | |
| 701 | def PerlAsm(output_filename, input_filename, perlasm_style, extra_args): |
| 702 | """Runs the a perlasm script and puts the output into output_filename.""" |
| 703 | base_dir = os.path.dirname(output_filename) |
| 704 | if not os.path.isdir(base_dir): |
| 705 | os.makedirs(base_dir) |
David Benjamin | fdd8e9c | 2016-06-26 13:18:50 -0400 | [diff] [blame] | 706 | subprocess.check_call( |
| 707 | ['perl', input_filename, perlasm_style] + extra_args + [output_filename]) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 708 | |
| 709 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 710 | def WriteAsmFiles(perlasms): |
| 711 | """Generates asm files from perlasm directives for each supported OS x |
| 712 | platform combination.""" |
| 713 | asmfiles = {} |
| 714 | |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 715 | for perlasm in perlasms: |
| 716 | for (osname, arch, perlasm_style, extra_args, asm_ext) in OS_ARCH_COMBOS: |
| 717 | if arch != perlasm['arch']: |
| 718 | continue |
| 719 | # TODO(https://crbug.com/boringssl/524): Now that we incorporate osname in |
| 720 | # the output filename, the asm files can just go in a single directory. |
| 721 | # For now, we keep them in target-specific directories to avoid breaking |
| 722 | # downstream scripts. |
| 723 | key = (osname, arch) |
| 724 | outDir = '%s-%s' % key |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 725 | output = perlasm['output'] |
| 726 | if not output.startswith('src'): |
| 727 | raise ValueError('output missing src: %s' % output) |
| 728 | output = os.path.join(outDir, output[4:]) |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 729 | output = '%s-%s.%s' % (output, osname, asm_ext) |
| 730 | PerlAsm(output, perlasm['input'], perlasm_style, extra_args) |
| 731 | asmfiles.setdefault(key, []).append(output) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 732 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 733 | for (key, non_perl_asm_files) in NON_PERL_FILES.items(): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 734 | asmfiles.setdefault(key, []).extend(non_perl_asm_files) |
| 735 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 736 | for files in asmfiles.values(): |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 737 | files.sort() |
| 738 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 739 | return asmfiles |
| 740 | |
| 741 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 742 | def ExtractVariablesFromCMakeFile(cmakefile): |
| 743 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 744 | returns a dictionary of exported source lists.""" |
| 745 | variables = {} |
| 746 | in_set_command = False |
| 747 | set_command = [] |
| 748 | with open(cmakefile) as f: |
| 749 | for line in f: |
| 750 | if '#' in line: |
| 751 | line = line[:line.index('#')] |
| 752 | line = line.strip() |
| 753 | |
| 754 | if not in_set_command: |
| 755 | if line.startswith('set('): |
| 756 | in_set_command = True |
| 757 | set_command = [] |
| 758 | elif line == ')': |
| 759 | in_set_command = False |
| 760 | if not set_command: |
| 761 | raise ValueError('Empty set command') |
| 762 | variables[set_command[0]] = set_command[1:] |
| 763 | else: |
| 764 | set_command.extend([c for c in line.split(' ') if c]) |
| 765 | |
| 766 | if in_set_command: |
| 767 | raise ValueError('Unfinished set command') |
| 768 | return variables |
| 769 | |
| 770 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 771 | def main(platforms): |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 772 | cmake = ExtractVariablesFromCMakeFile(os.path.join('src', 'sources.cmake')) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 773 | crypto_c_files = (FindCFiles(os.path.join('src', 'crypto'), NoTestsNorFIPSFragments) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 774 | FindCFiles(os.path.join('src', 'third_party', 'fiat'), NoTestsNorFIPSFragments)) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 775 | fips_fragments = FindCFiles(os.path.join('src', 'crypto', 'fipsmodule'), OnlyFIPSFragments) |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 776 | ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 777 | tool_c_files = FindCFiles(os.path.join('src', 'tool'), NoTests) |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 778 | tool_h_files = FindHeaderFiles(os.path.join('src', 'tool'), AllFiles) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 779 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 780 | # BCM shared library C files |
| 781 | bcm_crypto_c_files = [ |
| 782 | os.path.join('src', 'crypto', 'fipsmodule', 'bcm.c') |
| 783 | ] |
| 784 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 785 | # Generate err_data.c |
| 786 | with open('err_data.c', 'w+') as err_data: |
| 787 | subprocess.check_call(['go', 'run', 'err_data_generate.go'], |
| 788 | cwd=os.path.join('src', 'crypto', 'err'), |
| 789 | stdout=err_data) |
| 790 | crypto_c_files.append('err_data.c') |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 791 | crypto_c_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 792 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 793 | test_support_c_files = FindCFiles(os.path.join('src', 'crypto', 'test'), |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 794 | NotGTestSupport) |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 795 | test_support_h_files = ( |
| 796 | FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) + |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 797 | FindHeaderFiles(os.path.join('src', 'ssl', 'test'), NoTestRunnerFiles)) |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 798 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 799 | crypto_test_files = [] |
| 800 | if EMBED_TEST_DATA: |
| 801 | # Generate crypto_test_data.cc |
| 802 | with open('crypto_test_data.cc', 'w+') as out: |
| 803 | subprocess.check_call( |
| 804 | ['go', 'run', 'util/embed_test_data.go'] + cmake['CRYPTO_TEST_DATA'], |
| 805 | cwd='src', |
| 806 | stdout=out) |
| 807 | crypto_test_files += ['crypto_test_data.cc'] |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 808 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 809 | crypto_test_files += FindCFiles(os.path.join('src', 'crypto'), OnlyTests) |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 810 | crypto_test_files += [ |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 811 | 'src/crypto/test/abi_test.cc', |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 812 | 'src/crypto/test/file_test_gtest.cc', |
| 813 | 'src/crypto/test/gtest_main.cc', |
| 814 | ] |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 815 | # urandom_test.cc is in a separate binary so that it can be test PRNG |
| 816 | # initialisation. |
| 817 | crypto_test_files = [ |
| 818 | file for file in crypto_test_files |
| 819 | if not file.endswith('/urandom_test.cc') |
| 820 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 821 | crypto_test_files.sort() |
David Benjamin | 1d5a570 | 2017-02-13 22:11:49 -0500 | [diff] [blame] | 822 | |
| 823 | ssl_test_files = FindCFiles(os.path.join('src', 'ssl'), OnlyTests) |
Robert Sloan | ae1e087 | 2019-03-01 16:01:30 -0800 | [diff] [blame] | 824 | ssl_test_files += [ |
| 825 | 'src/crypto/test/abi_test.cc', |
| 826 | 'src/crypto/test/gtest_main.cc', |
| 827 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 828 | ssl_test_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 829 | |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 830 | urandom_test_files = [ |
| 831 | 'src/crypto/fipsmodule/rand/urandom_test.cc', |
| 832 | ] |
| 833 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 834 | fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests) |
| 835 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 836 | ssl_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 837 | SSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 838 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 839 | def NotSSLHeaderFiles(path, filename, is_dir): |
| 840 | return not SSLHeaderFiles(path, filename, is_dir) |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 841 | crypto_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 842 | NotSSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 843 | |
| 844 | ssl_internal_h_files = FindHeaderFiles(os.path.join('src', 'ssl'), NoTests) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 845 | crypto_internal_h_files = ( |
| 846 | FindHeaderFiles(os.path.join('src', 'crypto'), NoTests) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 847 | FindHeaderFiles(os.path.join('src', 'third_party', 'fiat'), NoTests)) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 848 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 849 | files = { |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 850 | 'bcm_crypto': bcm_crypto_c_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 851 | 'crypto': crypto_c_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 852 | 'crypto_headers': crypto_h_files, |
| 853 | 'crypto_internal_headers': crypto_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 854 | 'crypto_test': crypto_test_files, |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 855 | 'crypto_test_data': sorted('src/' + x for x in cmake['CRYPTO_TEST_DATA']), |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 856 | 'fips_fragments': fips_fragments, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 857 | 'fuzz': fuzz_c_files, |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 858 | 'ssl': ssl_source_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 859 | 'ssl_headers': ssl_h_files, |
| 860 | 'ssl_internal_headers': ssl_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 861 | 'ssl_test': ssl_test_files, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 862 | 'tool': tool_c_files, |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 863 | 'tool_headers': tool_h_files, |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 864 | 'test_support': test_support_c_files, |
| 865 | 'test_support_headers': test_support_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 866 | 'urandom_test': urandom_test_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 867 | } |
| 868 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 869 | asm_outputs = sorted(WriteAsmFiles(ReadPerlAsmOperations()).items()) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 870 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 871 | for platform in platforms: |
| 872 | platform.WriteFiles(files, asm_outputs) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 873 | |
| 874 | return 0 |
| 875 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 876 | ALL_PLATFORMS = { |
| 877 | 'android': Android, |
| 878 | 'android-cmake': AndroidCMake, |
| 879 | 'bazel': Bazel, |
| 880 | 'cmake': CMake, |
| 881 | 'eureka': Eureka, |
| 882 | 'gn': GN, |
| 883 | 'gyp': GYP, |
| 884 | 'json': JSON, |
| 885 | } |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 886 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 887 | if __name__ == '__main__': |
David Benjamin | 4acc7dd | 2022-11-19 10:13:49 -0500 | [diff] [blame] | 888 | parser = optparse.OptionParser( |
| 889 | usage='Usage: %%prog [--prefix=<path>] [all|%s]' % |
| 890 | '|'.join(sorted(ALL_PLATFORMS.keys()))) |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 891 | parser.add_option('--prefix', dest='prefix', |
| 892 | help='For Bazel, prepend argument to all source files') |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 893 | parser.add_option( |
| 894 | '--embed_test_data', type='choice', dest='embed_test_data', |
| 895 | action='store', default="true", choices=["true", "false"], |
David Benjamin | f014d60 | 2019-05-07 18:58:06 -0500 | [diff] [blame] | 896 | help='For Bazel or GN, don\'t embed data files in crypto_test_data.cc') |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 897 | options, args = parser.parse_args(sys.argv[1:]) |
| 898 | PREFIX = options.prefix |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 899 | EMBED_TEST_DATA = (options.embed_test_data == "true") |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 900 | |
| 901 | if not args: |
| 902 | parser.print_help() |
| 903 | sys.exit(1) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 904 | |
David Benjamin | 4acc7dd | 2022-11-19 10:13:49 -0500 | [diff] [blame] | 905 | if 'all' in args: |
| 906 | platforms = [platform() for platform in ALL_PLATFORMS.values()] |
| 907 | else: |
| 908 | platforms = [] |
| 909 | for s in args: |
| 910 | platform = ALL_PLATFORMS.get(s) |
| 911 | if platform is None: |
| 912 | parser.print_help() |
| 913 | sys.exit(1) |
| 914 | platforms.append(platform()) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 915 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 916 | sys.exit(main(platforms)) |