blob: 5a429c91f5f2f5615bf4e149dfbc6dafaec6716b [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
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") {
include_dirs = [ "src/include" ]
if (is_component_build) {
defines = [ "BORINGSSL_SHARED_LIBRARY" ]
}
}
# 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",
]
if (is_posix) {
cflags_c = [ "-std=c99" ]
defines += [
"_BSD_SOURCE", # Needed for broken uclibc headers.
"_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
if (is_win) {
public_configs = [ ":no_asm_config" ]
} 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" ]
if (is_android && is_clang) {
# Disable the integrated assembler and use the one shipped with the NDK.
import("//build/config/android/config.gni")
rebased_android_toolchain_root =
rebase_path(android_toolchain_root, root_build_dir)
asmflags = [
"-fno-integrated-as",
"-B${rebased_android_toolchain_root}/bin",
]
}
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
} else {
public_configs = [ ":no_asm_config" ]
}
}
}
component("boringssl") {
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" ]
}