blob: 4f3f96aebd47d61b3b2c25bc7d8d708b8602a1e1 [file] [log] [blame]
# 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("BUILD.generated.gni")
group("boringssl_baremetal") {
public_deps = [
":crypto_lib_baremetal",
":ssl_lib_baremetal",
]
}
library_common_vars = {
public_configs = [ ":boringssl_public_config" ]
include_dirs = [ "src/include" ]
configs = [ ":boringssl_internal_config" ]
}
crypto_library_common_vars = {
forward_variables_from(library_common_vars, "*")
sources = crypto_sources + [ "boringssl_utils.cc" ]
public = crypto_headers + [ "public/boringssl/boringssl_utils.h" ]
}
ssl_library_common_vars = {
forward_variables_from(library_common_vars, "*")
sources = ssl_sources
public = ssl_headers
}
pw_source_set("crypto_lib_baremetal") {
forward_variables_from(crypto_library_common_vars, "*")
# Remove sources that require file system and posix socket support
sources -= [
"src/crypto/bio/connect.c",
"src/crypto/bio/fd.c",
"src/crypto/bio/socket.c",
"src/crypto/bio/socket_helper.c",
]
public_configs += [ ":config_baremetal" ]
}
pw_source_set("ssl_lib_baremetal") {
forward_variables_from(ssl_library_common_vars, "*")
# ssl_lib.c includes sys/socket.h which needs to be faked
include_dirs += [ "baremetal_sysdeps/" ]
public_deps = [ ":crypto_lib_baremetal" ]
}
# configs
config("boringssl_public_config") {
include_dirs = [
"src/include",
"public",
]
cflags = [
"-Wno-cast-qual",
"-Wno-ignored-qualifiers",
]
}
config("boringssl_internal_config") {
visibility = [ ":*" ]
defines = [
"BORINGSSL_ALLOW_CXX_RUNTIME",
"BORINGSSL_IMPLEMENTATION",
"BORINGSSL_NO_STATIC_INITIALIZER",
"BORINGSSL_SHARED_LIBRARY",
"OPENSSL_SMALL",
"OPENSSL_NO_ASM",
]
cflags = [
"-Wno-unused-function",
"-Wno-conversion",
"-Wno-unused-parameter",
"-Wno-char-subscripts",
]
cflags_cc = [
"-fpermissive",
# To get through the -Werror=permissive error
"-Wno-error",
]
configs = [ ":boringssl_public_config" ]
}
config("config_baremetal") {
defines = [ "OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED" ]
}