| OLD | NEW |
| (Empty) |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 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/sanitizers/sanitizers.gni") | |
| 7 import("BUILD.generated.gni") | |
| 8 | |
| 9 # Config for us and everybody else depending on BoringSSL. | |
| 10 config("external_config") { | |
| 11 include_dirs = [ "src/include" ] | |
| 12 if (is_component_build) { | |
| 13 defines = [ "BORINGSSL_SHARED_LIBRARY" ] | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 # Config internal to this build file, shared by boringssl and boringssl_fuzzer. | |
| 18 config("internal_config") { | |
| 19 visibility = [ ":*" ] # Only targets in this file can depend on this. | |
| 20 defines = [ | |
| 21 "BORINGSSL_IMPLEMENTATION", | |
| 22 "BORINGSSL_NO_STATIC_INITIALIZER", | |
| 23 "OPENSSL_SMALL", | |
| 24 ] | |
| 25 # configs = [ | |
| 26 # # TODO(davidben): Fix size_t truncations in BoringSSL. | |
| 27 # # https://crbug.com/429039 | |
| 28 # "//build/config/compiler:no_size_t_to_int_warning", | |
| 29 # ] | |
| 30 if (is_posix) { | |
| 31 cflags_c = [ "-std=c99" ] | |
| 32 defines += [ "_XOPEN_SOURCE=700" ] | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 config("no_asm_config") { | |
| 37 visibility = [ ":*" ] # Only targets in this file can depend on this. | |
| 38 defines = [ "OPENSSL_NO_ASM" ] | |
| 39 } | |
| 40 | |
| 41 all_sources = crypto_sources + ssl_sources | |
| 42 | |
| 43 # Windows' assembly is built with Yasm. The other platforms use the platform | |
| 44 # assembler. | |
| 45 if (is_win && !is_msan) { | |
| 46 import("//third_party/yasm/yasm_assemble.gni") | |
| 47 yasm_assemble("boringssl_asm") { | |
| 48 if (current_cpu == "x64") { | |
| 49 sources = crypto_sources_win_x86_64 | |
| 50 } else if (current_cpu == "x86") { | |
| 51 sources = crypto_sources_win_x86 | |
| 52 } | |
| 53 } | |
| 54 } else { | |
| 55 # This has no sources on some platforms so must be a source_set. | |
| 56 source_set("boringssl_asm") { | |
| 57 visibility = [ ":*" ] # Only targets in this file can depend on this. | |
| 58 | |
| 59 defines = [] | |
| 60 sources = [] | |
| 61 include_dirs = [ "src/include" ] | |
| 62 | |
| 63 if ((current_cpu == "arm" || current_cpu == "arm64") && is_clang) { | |
| 64 if (current_cpu == "arm") { | |
| 65 # TODO(hans) Enable integrated-as (crbug.com/124610). | |
| 66 asmflags += [ "-fno-integrated-as" ] | |
| 67 } | |
| 68 if (is_android) { | |
| 69 rebased_android_toolchain_root = | |
| 70 rebase_path(android_toolchain_root, root_build_dir) | |
| 71 | |
| 72 # Else /usr/bin/as gets picked up. | |
| 73 asmflags += [ "-B${rebased_android_toolchain_root}/bin" ] | |
| 74 } | |
| 75 } | |
| 76 | |
| 77 if (is_msan) { | |
| 78 public_configs = [ ":no_asm_config" ] | |
| 79 } else if (current_cpu == "x64") { | |
| 80 if (is_mac) { | |
| 81 sources += crypto_sources_mac_x86_64 | |
| 82 } else if (is_linux || is_android) { | |
| 83 sources += crypto_sources_linux_x86_64 | |
| 84 } else { | |
| 85 public_configs = [ ":no_asm_config" ] | |
| 86 } | |
| 87 } else if (current_cpu == "x86") { | |
| 88 if (is_mac) { | |
| 89 sources += crypto_sources_mac_x86 | |
| 90 } else if (is_linux || is_android) { | |
| 91 sources += crypto_sources_linux_x86 | |
| 92 } else { | |
| 93 public_configs = [ ":no_asm_config" ] | |
| 94 } | |
| 95 } else if (current_cpu == "arm" && (is_linux || is_android)) { | |
| 96 sources += crypto_sources_linux_arm | |
| 97 } else if (current_cpu == "arm64" && (is_linux || is_android)) { | |
| 98 sources += crypto_sources_linux_aarch64 | |
| 99 | |
| 100 # TODO(davidben): Remove explicit arch flag once https://crbug.com/576858 | |
| 101 # is fixed. | |
| 102 asmflags += [ "-march=armv8-a+crypto" ] | |
| 103 } else { | |
| 104 public_configs = [ ":no_asm_config" ] | |
| 105 } | |
| 106 } | |
| 107 } | |
| 108 | |
| 109 component("boringssl") { | |
| 110 sources = all_sources | |
| 111 deps = [ | |
| 112 ":boringssl_asm", | |
| 113 ] | |
| 114 | |
| 115 public_configs = [ ":external_config" ] | |
| 116 configs += [ ":internal_config" ] | |
| 117 | |
| 118 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 119 configs += [ "//build/config/compiler:no_chromium_code" ] | |
| 120 } | |
| OLD | NEW |