Index: third_party/boringssl/BUILD.gn |
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn |
index dc26330e500574bcba7806080ebdc243ca0a37bd..a71a73552bf6cd00bfae6d9670fbe4a12eabca11 100644 |
--- a/third_party/boringssl/BUILD.gn |
+++ b/third_party/boringssl/BUILD.gn |
@@ -4,6 +4,7 @@ |
import("//build/config/android/config.gni") |
import("//build/config/sanitizers/sanitizers.gni") |
+import("BUILD.generated.gni") |
# Config for us and everybody else depending on BoringSSL. |
config("external_config") { |
@@ -13,83 +14,107 @@ config("external_config") { |
} |
} |
- |
# Config internal to this build file, shared by boringssl and boringssl_fuzzer. |
config("internal_config") { |
visibility = [ ":*" ] # Only targets in this file can depend on this. |
defines = [ |
"BORINGSSL_IMPLEMENTATION", |
"BORINGSSL_NO_STATIC_INITIALIZER", |
- "OPENSSL_SMALL_FOOTPRINT", |
+ "OPENSSL_SMALL", |
] |
+ # configs = [ |
+ # # TODO(davidben): Fix size_t truncations in BoringSSL. |
+ # # https://crbug.com/429039 |
+ # "//build/config/compiler:no_size_t_to_int_warning", |
+ # ] |
+ if (is_posix) { |
+ cflags_c = [ "-std=c99" ] |
+ defines += [ "_XOPEN_SOURCE=700" ] |
+ } |
} |
- |
config("no_asm_config") { |
visibility = [ ":*" ] # Only targets in this file can depend on this. |
defines = [ "OPENSSL_NO_ASM" ] |
} |
+all_sources = crypto_sources + ssl_sources |
-# The list of BoringSSL files is kept in boringssl.gypi. |
-gypi_values = |
- exec_script("../../tools/gypi_to_gn.py", |
- [ rebase_path("boringssl.gypi") ], |
- "scope", |
- [ "boringssl.gypi" ]) |
-boringssl_sources = |
- gypi_values.boringssl_crypto_sources + gypi_values.boringssl_ssl_sources |
+# Windows' assembly is built with Yasm. The other platforms use the platform |
+# assembler. |
+if (is_win && !is_msan) { |
+ import("//third_party/yasm/yasm_assemble.gni") |
+ yasm_assemble("boringssl_asm") { |
+ if (current_cpu == "x64") { |
+ sources = crypto_sources_win_x86_64 |
+ } else if (current_cpu == "x86") { |
+ sources = crypto_sources_win_x86 |
+ } |
+ } |
+} else { |
+ # This has no sources on some platforms so must be a source_set. |
+ source_set("boringssl_asm") { |
+ visibility = [ ":*" ] # Only targets in this file can depend on this. |
+ defines = [] |
+ sources = [] |
+ include_dirs = [ "src/include" ] |
-source_set("boringssl_asm") { |
- visibility = [ ":*" ] # Only targets in this file can depend on this. |
- sources = [] |
- #asmflags = [] |
- include_dirs = [ |
- "src/include", |
- # This is for arm_arch.h, which is needed by some asm files. Since the |
- # asm files are generated and kept in a different directory, they |
- # cannot use relative paths to find this file. |
- "src/crypto", |
- ] |
+ if ((current_cpu == "arm" || current_cpu == "arm64") && is_clang) { |
+ if (current_cpu == "arm") { |
+ # TODO(hans) Enable integrated-as (crbug.com/124610). |
+ asmflags += [ "-fno-integrated-as" ] |
+ } |
+ if (is_android) { |
+ rebased_android_toolchain_root = |
+ rebase_path(android_toolchain_root, root_build_dir) |
- if (current_cpu == "x64") { |
- if (is_ios) { |
- defines += [ "OPENSSL_NO_ASM" ] |
- } else if (is_mac) { |
- sources += gypi_values.boringssl_mac_x86_64_sources |
- } else if (is_linux || is_android) { |
- sources += gypi_values.boringssl_linux_x86_64_sources |
- } else { |
- public_configs = [ ":no_asm_config" ] |
+ # Else /usr/bin/as gets picked up. |
+ asmflags += [ "-B${rebased_android_toolchain_root}/bin" ] |
+ } |
} |
- } else if (current_cpu == "x86") { |
- if (is_ios) { |
- defines += [ "OPENSSL_NO_ASM" ] |
- } else if (is_mac) { |
- sources += gypi_values.boringssl_mac_x86_sources |
- } else if (is_linux || is_android) { |
- sources += gypi_values.boringssl_linux_x86_sources |
+ |
+ if (is_msan) { |
+ public_configs = [ ":no_asm_config" ] |
+ } else if (current_cpu == "x64") { |
+ if (is_mac) { |
+ sources += crypto_sources_mac_x86_64 |
+ } else if (is_linux || is_android) { |
+ sources += crypto_sources_linux_x86_64 |
+ } else { |
+ public_configs = [ ":no_asm_config" ] |
+ } |
+ } else if (current_cpu == "x86") { |
+ if (is_mac) { |
+ sources += crypto_sources_mac_x86 |
+ } else if (is_linux || is_android) { |
+ sources += crypto_sources_linux_x86 |
+ } else { |
+ public_configs = [ ":no_asm_config" ] |
+ } |
+ } else if (current_cpu == "arm" && (is_linux || is_android)) { |
+ sources += crypto_sources_linux_arm |
+ } else if (current_cpu == "arm64" && (is_linux || is_android)) { |
+ sources += crypto_sources_linux_aarch64 |
+ |
+ # TODO(davidben): Remove explicit arch flag once https://crbug.com/576858 |
+ # is fixed. |
+ asmflags += [ "-march=armv8-a+crypto" ] |
} else { |
public_configs = [ ":no_asm_config" ] |
} |
- } else if (current_cpu == "arm" && (is_linux || is_android)) { |
- sources += gypi_values.boringssl_linux_arm_sources |
- } else if (current_cpu == "arm64" && (is_linux || is_android)) { |
- sources += gypi_values.boringssl_linux_aarch64_sources |
- } else { |
- public_configs = [ ":no_asm_config" ] |
} |
} |
- |
component("boringssl") { |
- sources = boringssl_sources |
+ sources = all_sources |
deps = [ |
":boringssl_asm", |
] |
+ |
public_configs = [ ":external_config" ] |
configs += [ ":internal_config" ] |
+ |
configs -= [ "//build/config/compiler:chromium_code" ] |
configs += [ "//build/config/compiler:no_chromium_code" ] |
} |