|
| 1 | +# Copyright 2014 The Chromium Authors |
| 2 | +# Use of this source code is governed by a BSD-style license that can be |
| 3 | +# found in the LICENSE file. |
| 4 | + |
| 5 | +import("//build/config/android/config.gni") |
| 6 | +import("//build/config/arm.gni") |
| 7 | +import("//build/config/compiler/compiler.gni") |
| 8 | +import("//build/config/sanitizers/sanitizers.gni") |
| 9 | +import("//build_overrides/build.gni") |
| 10 | +import("src/gen/sources.gni") |
| 11 | + |
| 12 | +# Config for us and everybody else depending on BoringSSL. |
| 13 | +config("external_config") { |
| 14 | + include_dirs = [ "src/include" ] |
| 15 | + if (is_component_build) { |
| 16 | + defines = [ "BORINGSSL_SHARED_LIBRARY" ] |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +# The config used by the :boringssl component itself, and the fuzzer copies. |
| 21 | +config("component_config") { |
| 22 | + visibility = [ ":*" ] |
| 23 | + configs = [ ":internal_config" ] |
| 24 | + defines = [ "BORINGSSL_IMPLEMENTATION" ] |
| 25 | +} |
| 26 | + |
| 27 | +# This config is used by anything that consumes internal headers. Tests consume |
| 28 | +# this rather than :component_config. |
| 29 | +config("internal_config") { |
| 30 | + visibility = [ ":*" ] |
| 31 | + defines = [ |
| 32 | + "OPENSSL_SMALL", |
| 33 | + "OPENSSL_STATIC_ARMCAP", |
| 34 | + ] |
| 35 | + if (is_posix) { |
| 36 | + defines += [ "_XOPEN_SOURCE=700" ] |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +config("no_asm_config") { |
| 41 | + visibility = [ ":*" ] |
| 42 | + defines = [ "OPENSSL_NO_ASM" ] |
| 43 | +} |
| 44 | + |
| 45 | +# TODO(crbug.com/42290535): Move Chromium's use of libpki to the public API and |
| 46 | +# unexport pki_internal_headers. |
| 47 | +all_sources = bcm_internal_headers + bcm_sources + crypto_internal_headers + |
| 48 | + crypto_sources + ssl_internal_headers + ssl_sources + pki_sources |
| 49 | +all_headers = crypto_headers + ssl_headers + pki_headers + pki_internal_headers |
| 50 | + |
| 51 | +if (is_msan) { |
| 52 | + # MSan instrumentation is incompatible with assembly optimizations. |
| 53 | + # BoringSSL's GAS-compatible assembly knows how to detect MSan, but the NASM |
| 54 | + # assembly does not, so we check for MSan explicitly. |
| 55 | + source_set("boringssl_asm") { |
| 56 | + visibility = [ ":*" ] |
| 57 | + public_configs = [ ":no_asm_config" ] |
| 58 | + } |
| 59 | +} else if (is_win && (current_cpu == "x86" || current_cpu == "x64")) { |
| 60 | + # Windows' x86 and x86_64 assembly is built with NASM. |
| 61 | + source_set("boringssl_asm") { |
| 62 | + visibility = [ ":*" ] |
| 63 | + public_configs = [ ":no_asm_config" ] |
| 64 | + } |
| 65 | +} else { |
| 66 | + # All other targets use GAS-compatible assembler. BoringSSL's assembly files |
| 67 | + # are all wrapped in processor checks for the corresponding target, so there |
| 68 | + # is no need to add target conditions in the build. |
| 69 | + source_set("boringssl_asm") { |
| 70 | + visibility = [ ":*" ] |
| 71 | + sources = rebase_path(bcm_sources_asm + crypto_sources_asm, ".", "src") |
| 72 | + include_dirs = [ "src/include" ] |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +source_set("boringssl") { |
| 77 | + sources = rebase_path(all_sources, ".", "src") |
| 78 | + public = rebase_path(all_headers, ".", "src") |
| 79 | + |
| 80 | + if (is_win) { |
| 81 | + configs += [ ":no_asm_config" ] |
| 82 | + } else { |
| 83 | + deps = [ ":boringssl_asm" ] |
| 84 | + } |
| 85 | + |
| 86 | + public_configs = [ ":external_config" ] |
| 87 | + configs += [ ":component_config" ] |
| 88 | + |
| 89 | + configs -= [ "//build/config/compiler:chromium_code" ] |
| 90 | + configs += [ "//build/config/compiler:no_chromium_code" ] |
| 91 | +} |
0 commit comments