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) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 460 | # CMake does not add -isysroot and -arch flags to assembly. |
| 461 | if(APPLE) |
| 462 | if(CMAKE_OSX_SYSROOT) |
| 463 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"") |
| 464 | endif() |
| 465 | foreach(arch ${CMAKE_OSX_ARCHITECTURES}) |
| 466 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}") |
| 467 | endforeach() |
| 468 | endif() |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 469 | if(NOT WIN32) |
| 470 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") |
| 471 | endif() |
| 472 | # Clang's integerated assembler does not support debug symbols. |
| 473 | if(NOT CMAKE_ASM_COMPILER_ID MATCHES "Clang") |
| 474 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-g") |
| 475 | endif() |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 476 | endif() |
| 477 | endif() |
| 478 | |
Adam Langley | a0cdbf9 | 2020-01-21 09:07:46 -0800 | [diff] [blame] | 479 | if(BUILD_SHARED_LIBS) |
| 480 | add_definitions(-DBORINGSSL_SHARED_LIBRARY) |
| 481 | # Enable position-independent code globally. This is needed because |
| 482 | # some library targets are OBJECT libraries. |
| 483 | set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
| 484 | endif() |
| 485 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 486 | include_directories(src/include) |
| 487 | |
| 488 | ''' |
| 489 | |
| 490 | def PrintLibrary(self, out, name, files): |
| 491 | out.write('add_library(\n') |
| 492 | out.write(' %s\n\n' % name) |
| 493 | |
| 494 | for f in sorted(files): |
| 495 | out.write(' %s\n' % PathOf(f)) |
| 496 | |
| 497 | out.write(')\n\n') |
| 498 | |
| 499 | def PrintExe(self, out, name, files, libs): |
| 500 | out.write('add_executable(\n') |
| 501 | out.write(' %s\n\n' % name) |
| 502 | |
| 503 | for f in sorted(files): |
| 504 | out.write(' %s\n' % PathOf(f)) |
| 505 | |
| 506 | out.write(')\n\n') |
| 507 | out.write('target_link_libraries(%s %s)\n\n' % (name, ' '.join(libs))) |
| 508 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 509 | def PrintVariable(self, out, name, files): |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 510 | out.write('set(\n') |
| 511 | out.write(' %s\n\n' % name) |
| 512 | for f in sorted(files): |
| 513 | out.write(' %s\n' % PathOf(f)) |
| 514 | out.write(')\n\n') |
| 515 | |
| 516 | def WriteFiles(self, files, asm_outputs): |
| 517 | with open('CMakeLists.txt', 'w+') as cmake: |
| 518 | cmake.write(self.header) |
| 519 | |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 520 | asm_sources = [] |
| 521 | nasm_sources = [] |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 522 | for ((osname, arch), asm_files) in asm_outputs: |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 523 | if (osname, arch) in (('win', 'x86'), ('win', 'x86_64')): |
| 524 | nasm_sources.extend(asm_files) |
| 525 | else: |
| 526 | asm_sources.extend(asm_files) |
| 527 | self.PrintVariable(cmake, 'CRYPTO_SOURCES_ASM', sorted(asm_sources)) |
| 528 | self.PrintVariable(cmake, 'CRYPTO_SOURCES_NASM', sorted(nasm_sources)) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 529 | |
| 530 | cmake.write( |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 531 | R'''if(OPENSSL_ASM) |
| 532 | list(APPEND CRYPTO_SOURCES_ASM_USED ${CRYPTO_SOURCES_ASM}) |
| 533 | endif() |
| 534 | if(OPENSSL_NASM) |
| 535 | list(APPEND CRYPTO_SOURCES_ASM_USED ${CRYPTO_SOURCES_NASM}) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 536 | endif() |
| 537 | |
| 538 | ''') |
| 539 | |
| 540 | self.PrintLibrary(cmake, 'crypto', |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 541 | files['crypto'] + ['${CRYPTO_SOURCES_ASM_USED}']) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 542 | self.PrintLibrary(cmake, 'ssl', files['ssl']) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 543 | self.PrintExe(cmake, 'bssl', files['tool'], ['ssl', 'crypto']) |
| 544 | |
| 545 | cmake.write( |
David Benjamin | 741c153 | 2023-01-25 17:37:16 -0500 | [diff] [blame] | 546 | R'''if(NOT ANDROID) |
| 547 | find_package(Threads REQUIRED) |
| 548 | target_link_libraries(crypto Threads::Threads) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 549 | endif() |
| 550 | |
David Benjamin | 8f88b27 | 2020-07-09 13:35:01 -0400 | [diff] [blame] | 551 | if(WIN32) |
| 552 | target_link_libraries(bssl ws2_32) |
| 553 | endif() |
| 554 | |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 555 | ''') |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 556 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 557 | class JSON(object): |
| 558 | def WriteFiles(self, files, asm_outputs): |
| 559 | sources = dict(files) |
| 560 | for ((osname, arch), asm_files) in asm_outputs: |
| 561 | sources['crypto_%s_%s' % (osname, arch)] = asm_files |
| 562 | with open('sources.json', 'w+') as f: |
| 563 | json.dump(sources, f, sort_keys=True, indent=2) |
| 564 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 565 | def FindCMakeFiles(directory): |
| 566 | """Returns list of all CMakeLists.txt files recursively in directory.""" |
| 567 | cmakefiles = [] |
| 568 | |
| 569 | for (path, _, filenames) in os.walk(directory): |
| 570 | for filename in filenames: |
| 571 | if filename == 'CMakeLists.txt': |
| 572 | cmakefiles.append(os.path.join(path, filename)) |
| 573 | |
| 574 | return cmakefiles |
| 575 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 576 | def OnlyFIPSFragments(path, dent, is_dir): |
Matthew Braithwaite | 95511e9 | 2017-05-08 16:38:03 -0700 | [diff] [blame] | 577 | return is_dir or (path.startswith( |
| 578 | os.path.join('src', 'crypto', 'fipsmodule', '')) and |
| 579 | NoTests(path, dent, is_dir)) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 580 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 581 | def NoTestsNorFIPSFragments(path, dent, is_dir): |
Adam Langley | 323f1eb | 2017-04-06 17:29:10 -0700 | [diff] [blame] | 582 | return (NoTests(path, dent, is_dir) and |
| 583 | (is_dir or not OnlyFIPSFragments(path, dent, is_dir))) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 584 | |
| 585 | def NoTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 586 | """Filter function that can be passed to FindCFiles in order to remove test |
| 587 | sources.""" |
| 588 | if is_dir: |
| 589 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 590 | return 'test.' not in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 591 | |
| 592 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 593 | def OnlyTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 594 | """Filter function that can be passed to FindCFiles in order to remove |
| 595 | non-test sources.""" |
| 596 | if is_dir: |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 597 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 598 | return '_test.' in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 599 | |
| 600 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 601 | def AllFiles(path, dent, is_dir): |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 602 | """Filter function that can be passed to FindCFiles in order to include all |
| 603 | sources.""" |
| 604 | return True |
| 605 | |
| 606 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 607 | def NoTestRunnerFiles(path, dent, is_dir): |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 608 | """Filter function that can be passed to FindCFiles or FindHeaderFiles in |
| 609 | order to exclude test runner files.""" |
| 610 | # NOTE(martinkr): This prevents .h/.cc files in src/ssl/test/runner, which |
| 611 | # are in their own subpackage, from being included in boringssl/BUILD files. |
| 612 | return not is_dir or dent != 'runner' |
| 613 | |
| 614 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 615 | def NotGTestSupport(path, dent, is_dir): |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 616 | return 'gtest' not in dent and 'abi_test' not in dent |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 617 | |
| 618 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 619 | def SSLHeaderFiles(path, dent, is_dir): |
Aaron Green | 0e15002 | 2018-10-16 12:05:29 -0700 | [diff] [blame] | 620 | 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] | 621 | |
| 622 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 623 | def FindCFiles(directory, filter_func): |
| 624 | """Recurses through directory and returns a list of paths to all the C source |
| 625 | files that pass filter_func.""" |
| 626 | cfiles = [] |
| 627 | |
| 628 | for (path, dirnames, filenames) in os.walk(directory): |
| 629 | for filename in filenames: |
| 630 | if not filename.endswith('.c') and not filename.endswith('.cc'): |
| 631 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 632 | if not filter_func(path, filename, False): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 633 | continue |
| 634 | cfiles.append(os.path.join(path, filename)) |
| 635 | |
| 636 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 637 | if not filter_func(path, dirname, True): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 638 | del dirnames[i] |
| 639 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 640 | cfiles.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 641 | return cfiles |
| 642 | |
| 643 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 644 | def FindHeaderFiles(directory, filter_func): |
| 645 | """Recurses through directory and returns a list of paths to all the header files that pass filter_func.""" |
| 646 | hfiles = [] |
| 647 | |
| 648 | for (path, dirnames, filenames) in os.walk(directory): |
| 649 | for filename in filenames: |
| 650 | if not filename.endswith('.h'): |
| 651 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 652 | if not filter_func(path, filename, False): |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 653 | continue |
| 654 | hfiles.append(os.path.join(path, filename)) |
| 655 | |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 656 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 657 | if not filter_func(path, dirname, True): |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 658 | del dirnames[i] |
| 659 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 660 | hfiles.sort() |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 661 | return hfiles |
| 662 | |
| 663 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 664 | def ExtractPerlAsmFromCMakeFile(cmakefile): |
| 665 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 666 | returns a list of all the perlasm() directives found in the file.""" |
| 667 | perlasms = [] |
| 668 | with open(cmakefile) as f: |
| 669 | for line in f: |
| 670 | line = line.strip() |
| 671 | if not line.startswith('perlasm('): |
| 672 | continue |
| 673 | if not line.endswith(')'): |
| 674 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 675 | # Remove "perlasm(" from start and ")" from end |
| 676 | params = line[8:-1].split() |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 677 | if len(params) != 4: |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 678 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 679 | perlasms.append({ |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 680 | 'arch': params[1], |
| 681 | 'output': os.path.join(os.path.dirname(cmakefile), params[2]), |
| 682 | 'input': os.path.join(os.path.dirname(cmakefile), params[3]), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 683 | }) |
| 684 | |
| 685 | return perlasms |
| 686 | |
| 687 | |
| 688 | def ReadPerlAsmOperations(): |
| 689 | """Returns a list of all perlasm() directives found in CMake config files in |
| 690 | src/.""" |
| 691 | perlasms = [] |
| 692 | cmakefiles = FindCMakeFiles('src') |
| 693 | |
| 694 | for cmakefile in cmakefiles: |
| 695 | perlasms.extend(ExtractPerlAsmFromCMakeFile(cmakefile)) |
| 696 | |
| 697 | return perlasms |
| 698 | |
| 699 | |
| 700 | def PerlAsm(output_filename, input_filename, perlasm_style, extra_args): |
| 701 | """Runs the a perlasm script and puts the output into output_filename.""" |
| 702 | base_dir = os.path.dirname(output_filename) |
| 703 | if not os.path.isdir(base_dir): |
| 704 | os.makedirs(base_dir) |
David Benjamin | fdd8e9c | 2016-06-26 13:18:50 -0400 | [diff] [blame] | 705 | subprocess.check_call( |
| 706 | ['perl', input_filename, perlasm_style] + extra_args + [output_filename]) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 707 | |
| 708 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 709 | def WriteAsmFiles(perlasms): |
| 710 | """Generates asm files from perlasm directives for each supported OS x |
| 711 | platform combination.""" |
| 712 | asmfiles = {} |
| 713 | |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 714 | for perlasm in perlasms: |
| 715 | for (osname, arch, perlasm_style, extra_args, asm_ext) in OS_ARCH_COMBOS: |
| 716 | if arch != perlasm['arch']: |
| 717 | continue |
| 718 | # TODO(https://crbug.com/boringssl/524): Now that we incorporate osname in |
| 719 | # the output filename, the asm files can just go in a single directory. |
| 720 | # For now, we keep them in target-specific directories to avoid breaking |
| 721 | # downstream scripts. |
| 722 | key = (osname, arch) |
| 723 | outDir = '%s-%s' % key |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 724 | output = perlasm['output'] |
| 725 | if not output.startswith('src'): |
| 726 | raise ValueError('output missing src: %s' % output) |
| 727 | output = os.path.join(outDir, output[4:]) |
David Benjamin | 1967621 | 2023-01-25 10:03:53 -0500 | [diff] [blame] | 728 | output = '%s-%s.%s' % (output, osname, asm_ext) |
| 729 | PerlAsm(output, perlasm['input'], perlasm_style, extra_args) |
| 730 | asmfiles.setdefault(key, []).append(output) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 731 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 732 | for (key, non_perl_asm_files) in NON_PERL_FILES.items(): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 733 | asmfiles.setdefault(key, []).extend(non_perl_asm_files) |
| 734 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 735 | for files in asmfiles.values(): |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 736 | files.sort() |
| 737 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 738 | return asmfiles |
| 739 | |
| 740 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 741 | def ExtractVariablesFromCMakeFile(cmakefile): |
| 742 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 743 | returns a dictionary of exported source lists.""" |
| 744 | variables = {} |
| 745 | in_set_command = False |
| 746 | set_command = [] |
| 747 | with open(cmakefile) as f: |
| 748 | for line in f: |
| 749 | if '#' in line: |
| 750 | line = line[:line.index('#')] |
| 751 | line = line.strip() |
| 752 | |
| 753 | if not in_set_command: |
| 754 | if line.startswith('set('): |
| 755 | in_set_command = True |
| 756 | set_command = [] |
| 757 | elif line == ')': |
| 758 | in_set_command = False |
| 759 | if not set_command: |
| 760 | raise ValueError('Empty set command') |
| 761 | variables[set_command[0]] = set_command[1:] |
| 762 | else: |
| 763 | set_command.extend([c for c in line.split(' ') if c]) |
| 764 | |
| 765 | if in_set_command: |
| 766 | raise ValueError('Unfinished set command') |
| 767 | return variables |
| 768 | |
| 769 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 770 | def main(platforms): |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 771 | cmake = ExtractVariablesFromCMakeFile(os.path.join('src', 'sources.cmake')) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 772 | crypto_c_files = (FindCFiles(os.path.join('src', 'crypto'), NoTestsNorFIPSFragments) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 773 | FindCFiles(os.path.join('src', 'third_party', 'fiat'), NoTestsNorFIPSFragments)) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 774 | fips_fragments = FindCFiles(os.path.join('src', 'crypto', 'fipsmodule'), OnlyFIPSFragments) |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 775 | ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 776 | tool_c_files = FindCFiles(os.path.join('src', 'tool'), NoTests) |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 777 | tool_h_files = FindHeaderFiles(os.path.join('src', 'tool'), AllFiles) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 778 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 779 | # BCM shared library C files |
| 780 | bcm_crypto_c_files = [ |
| 781 | os.path.join('src', 'crypto', 'fipsmodule', 'bcm.c') |
| 782 | ] |
| 783 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 784 | # Generate err_data.c |
| 785 | with open('err_data.c', 'w+') as err_data: |
| 786 | subprocess.check_call(['go', 'run', 'err_data_generate.go'], |
| 787 | cwd=os.path.join('src', 'crypto', 'err'), |
| 788 | stdout=err_data) |
| 789 | crypto_c_files.append('err_data.c') |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 790 | crypto_c_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 791 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 792 | test_support_c_files = FindCFiles(os.path.join('src', 'crypto', 'test'), |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 793 | NotGTestSupport) |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 794 | test_support_h_files = ( |
| 795 | FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) + |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 796 | FindHeaderFiles(os.path.join('src', 'ssl', 'test'), NoTestRunnerFiles)) |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 797 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 798 | crypto_test_files = [] |
| 799 | if EMBED_TEST_DATA: |
| 800 | # Generate crypto_test_data.cc |
| 801 | with open('crypto_test_data.cc', 'w+') as out: |
| 802 | subprocess.check_call( |
| 803 | ['go', 'run', 'util/embed_test_data.go'] + cmake['CRYPTO_TEST_DATA'], |
| 804 | cwd='src', |
| 805 | stdout=out) |
| 806 | crypto_test_files += ['crypto_test_data.cc'] |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 807 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 808 | crypto_test_files += FindCFiles(os.path.join('src', 'crypto'), OnlyTests) |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 809 | crypto_test_files += [ |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 810 | 'src/crypto/test/abi_test.cc', |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 811 | 'src/crypto/test/file_test_gtest.cc', |
| 812 | 'src/crypto/test/gtest_main.cc', |
| 813 | ] |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 814 | # urandom_test.cc is in a separate binary so that it can be test PRNG |
| 815 | # initialisation. |
| 816 | crypto_test_files = [ |
| 817 | file for file in crypto_test_files |
| 818 | if not file.endswith('/urandom_test.cc') |
| 819 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 820 | crypto_test_files.sort() |
David Benjamin | 1d5a570 | 2017-02-13 22:11:49 -0500 | [diff] [blame] | 821 | |
| 822 | ssl_test_files = FindCFiles(os.path.join('src', 'ssl'), OnlyTests) |
Robert Sloan | ae1e087 | 2019-03-01 16:01:30 -0800 | [diff] [blame] | 823 | ssl_test_files += [ |
| 824 | 'src/crypto/test/abi_test.cc', |
| 825 | 'src/crypto/test/gtest_main.cc', |
| 826 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 827 | ssl_test_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 828 | |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 829 | urandom_test_files = [ |
| 830 | 'src/crypto/fipsmodule/rand/urandom_test.cc', |
| 831 | ] |
| 832 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 833 | fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests) |
| 834 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 835 | ssl_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 836 | SSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 837 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 838 | def NotSSLHeaderFiles(path, filename, is_dir): |
| 839 | return not SSLHeaderFiles(path, filename, is_dir) |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 840 | crypto_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 841 | NotSSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 842 | |
| 843 | ssl_internal_h_files = FindHeaderFiles(os.path.join('src', 'ssl'), NoTests) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 844 | crypto_internal_h_files = ( |
| 845 | FindHeaderFiles(os.path.join('src', 'crypto'), NoTests) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 846 | FindHeaderFiles(os.path.join('src', 'third_party', 'fiat'), NoTests)) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 847 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 848 | files = { |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 849 | 'bcm_crypto': bcm_crypto_c_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 850 | 'crypto': crypto_c_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 851 | 'crypto_headers': crypto_h_files, |
| 852 | 'crypto_internal_headers': crypto_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 853 | 'crypto_test': crypto_test_files, |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 854 | '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] | 855 | 'fips_fragments': fips_fragments, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 856 | 'fuzz': fuzz_c_files, |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 857 | 'ssl': ssl_source_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 858 | 'ssl_headers': ssl_h_files, |
| 859 | 'ssl_internal_headers': ssl_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 860 | 'ssl_test': ssl_test_files, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 861 | 'tool': tool_c_files, |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 862 | 'tool_headers': tool_h_files, |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 863 | 'test_support': test_support_c_files, |
| 864 | 'test_support_headers': test_support_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 865 | 'urandom_test': urandom_test_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 866 | } |
| 867 | |
Yoshisato Yanagisawa | 5650816 | 2021-03-23 05:34:47 +0000 | [diff] [blame] | 868 | asm_outputs = sorted(WriteAsmFiles(ReadPerlAsmOperations()).items()) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 869 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 870 | for platform in platforms: |
| 871 | platform.WriteFiles(files, asm_outputs) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 872 | |
| 873 | return 0 |
| 874 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 875 | ALL_PLATFORMS = { |
| 876 | 'android': Android, |
| 877 | 'android-cmake': AndroidCMake, |
| 878 | 'bazel': Bazel, |
| 879 | 'cmake': CMake, |
| 880 | 'eureka': Eureka, |
| 881 | 'gn': GN, |
| 882 | 'gyp': GYP, |
| 883 | 'json': JSON, |
| 884 | } |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 885 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 886 | if __name__ == '__main__': |
David Benjamin | 4acc7dd | 2022-11-19 10:13:49 -0500 | [diff] [blame] | 887 | parser = optparse.OptionParser( |
| 888 | usage='Usage: %%prog [--prefix=<path>] [all|%s]' % |
| 889 | '|'.join(sorted(ALL_PLATFORMS.keys()))) |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 890 | parser.add_option('--prefix', dest='prefix', |
| 891 | help='For Bazel, prepend argument to all source files') |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 892 | parser.add_option( |
| 893 | '--embed_test_data', type='choice', dest='embed_test_data', |
| 894 | action='store', default="true", choices=["true", "false"], |
David Benjamin | f014d60 | 2019-05-07 18:58:06 -0500 | [diff] [blame] | 895 | 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] | 896 | options, args = parser.parse_args(sys.argv[1:]) |
| 897 | PREFIX = options.prefix |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 898 | EMBED_TEST_DATA = (options.embed_test_data == "true") |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 899 | |
| 900 | if not args: |
| 901 | parser.print_help() |
| 902 | sys.exit(1) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 903 | |
David Benjamin | 4acc7dd | 2022-11-19 10:13:49 -0500 | [diff] [blame] | 904 | if 'all' in args: |
| 905 | platforms = [platform() for platform in ALL_PLATFORMS.values()] |
| 906 | else: |
| 907 | platforms = [] |
| 908 | for s in args: |
| 909 | platform = ALL_PLATFORMS.get(s) |
| 910 | if platform is None: |
| 911 | parser.print_help() |
| 912 | sys.exit(1) |
| 913 | platforms.append(platform()) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 914 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 915 | sys.exit(main(platforms)) |