94 lines
2.8 KiB
Plaintext
94 lines
2.8 KiB
Plaintext
# Copyright 2021 The Pigweed Authors
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy of
|
|
# the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations under
|
|
# the License.
|
|
|
|
import("//build_overrides/pigweed.gni")
|
|
import("$dir_pw_build/target_types.gni")
|
|
import("$dir_pw_third_party/boringssl/boringssl.gni")
|
|
import("$dir_pw_unit_test/test.gni")
|
|
|
|
if (dir_pw_third_party_boringssl != "") {
|
|
import("$dir_pw_third_party_boringssl/BUILD.generated.gni")
|
|
|
|
config("boringssl_public_config") {
|
|
include_dirs = [
|
|
"$dir_pw_third_party_boringssl/src/include",
|
|
"public",
|
|
]
|
|
cflags = [
|
|
"-Wno-cast-qual",
|
|
"-Wno-ignored-qualifiers",
|
|
"-w",
|
|
]
|
|
|
|
# This can be removed once boringssl threading primitives are implemented,
|
|
# i.e. using pw_sync, and when we have a posix style socket layer.
|
|
defines =
|
|
[ "OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED" ]
|
|
}
|
|
|
|
config("boringssl_internal_config") {
|
|
defines = [
|
|
# Enable virtual desctructor and compile-time check of pure virtual base class
|
|
"BORINGSSL_ALLOW_CXX_RUNTIME",
|
|
|
|
# Code size optimiaztion
|
|
"OPENSSL_SMALL",
|
|
|
|
# The ARM assembly code is only for cortex-A.
|
|
"OPENSSL_NO_ASM",
|
|
|
|
# Disable assert, which may additionally link in unwanted binaries via
|
|
# argument evaluation.
|
|
"NDEBUG",
|
|
]
|
|
cflags = [
|
|
"-Wno-unused-function",
|
|
"-Wno-conversion",
|
|
"-Wno-unused-parameter",
|
|
"-Wno-char-subscripts",
|
|
]
|
|
cflags_cc = [
|
|
"-fpermissive",
|
|
"-Wno-error", # To get through the -Werror=permissive error
|
|
]
|
|
include_dirs = [ "$dir_pw_third_party_boringssl" ]
|
|
}
|
|
|
|
# Remove sources that require file system and posix socket support
|
|
excluded_sources = [
|
|
"src/crypto/bio/connect.c",
|
|
"src/crypto/bio/fd.c",
|
|
"src/crypto/bio/socket.c",
|
|
"src/crypto/bio/socket_helper.c",
|
|
]
|
|
|
|
pw_source_set("boringssl") {
|
|
sources = [ "crypto_sysrand.cc" ]
|
|
foreach(source, crypto_sources - excluded_sources + ssl_sources) {
|
|
sources += [ "$dir_pw_third_party_boringssl/$source" ]
|
|
}
|
|
public_configs = [ ":boringssl_public_config" ]
|
|
configs = [ ":boringssl_internal_config" ]
|
|
|
|
# Contains a faked "sysdeps/sys/socket.h"
|
|
# Can be removed once posix socket layer in Pigweed is supported.
|
|
include_dirs = [ "sysdeps" ]
|
|
|
|
public_deps = [ "$dir_pw_tls_client:time" ]
|
|
}
|
|
} else {
|
|
group("boringssl") {
|
|
}
|
|
}
|