| # Copyright 2017 The Fuchsia 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/cpp/sdk_shared_library.gni") |
| import("//build/package.gni") |
| import("BUILD.generated.gni") |
| import("BUILD.generated_tests.gni") |
| |
| ################################################################################ |
| # Public targets |
| |
| group("boringssl") { |
| public_deps = [ |
| ":crypto", |
| ":ssl", |
| ] |
| } |
| |
| if (is_fuchsia) { |
| library_type = "sdk_shared_library" |
| } else { |
| library_type = default_library_type |
| } |
| |
| ################ |
| # libcrypto.so # |
| ################ |
| target(library_type, "crypto") { |
| if (is_fuchsia) { |
| category = "partner" |
| } |
| sources = crypto_sources |
| public = crypto_headers |
| public_configs = [ ":boringssl_config" ] |
| configs += [ ":internal_config" ] |
| if (current_cpu == "arm64") { |
| if (is_mac) { |
| sources += crypto_sources_ios_aarch64 |
| configs += [ ":pthread_config" ] |
| } else if (is_fuchsia) { |
| # TODO(aarongreen): Switch once aarch64 once crypto/cpu-aarch64-fuchsia.c |
| # is upstreamed. |
| # sources += crypto_sources_linux_aarch64 |
| configs += [ ":no_asm_config" ] |
| } else if (is_linux) { |
| sources += crypto_sources_linux_aarch64 |
| configs += [ ":pthread_config" ] |
| } else { |
| assert(false, "unsupported OS: {{current_os}}") |
| } |
| } else if (current_cpu == "x64") { |
| if (is_mac) { |
| sources += crypto_sources_mac_x86_64 |
| configs += [ ":pthread_config" ] |
| } else if (is_fuchsia) { |
| # Fuchsia assembly is the same as Linux on x86-64, for now; i.e. ELF. |
| sources += crypto_sources_linux_x86_64 |
| } else if (is_linux) { |
| sources += crypto_sources_linux_x86_64 |
| configs += [ ":pthread_config" ] |
| } else { |
| assert(false, "unsupported OS: {{current_os}}") |
| } |
| } else { |
| assert(false, "unsupported CPU: {{current_cpu}}") |
| } |
| if (is_fuchsia) { |
| include_base = "//third_party/boringssl/src/include" |
| deps = [ "//zircon/public/lib/zxcpp" ] |
| } |
| } |
| |
| target(library_type, "ssl") { |
| if (is_fuchsia) { |
| category = "partner" |
| } |
| sources = ssl_sources |
| public = ssl_headers |
| public_configs = [ ":boringssl_config" ] |
| configs += [ ":internal_config" ] |
| deps = [ |
| ":crypto", |
| ] |
| if (is_fuchsia) { |
| runtime_deps = [ ":crypto_sdk" ] |
| include_base = "//third_party/boringssl/src/include" |
| deps += [ "//zircon/public/lib/zxcpp" ] |
| } |
| } |
| |
| ########################## |
| # bssl command line tool # |
| ########################## |
| if (is_fuchsia) { |
| package("boringssl_tool") { |
| deprecated_system_image = true |
| deps = [ |
| ":bssl", |
| ] |
| binaries = [ |
| { |
| name = "bssl" |
| }, |
| ] |
| } |
| } else { |
| group("boringssl_tool") { |
| deps = [ |
| ":bssl_tool", |
| ] |
| } |
| } |
| |
| # See //third_party/boringssl/tool/CMakeLists.txt |
| executable("bssl") { |
| visibility = [ ":*" ] |
| sources = [ |
| "src/tool/args.cc", |
| "src/tool/ciphers.cc", |
| "src/tool/client.cc", |
| "src/tool/const.cc", |
| "src/tool/digest.cc", |
| "src/tool/file.cc", |
| "src/tool/generate_ed25519.cc", |
| "src/tool/genrsa.cc", |
| "src/tool/pkcs12.cc", |
| "src/tool/rand.cc", |
| "src/tool/server.cc", |
| "src/tool/sign.cc", |
| "src/tool/speed.cc", |
| "src/tool/tool.cc", |
| "src/tool/transport_common.cc", |
| ] |
| configs += [ "//third_party/boringssl:internal_config" ] |
| deps = [ |
| ":crypto", |
| ":ssl", |
| ] |
| } |
| |
| ############## |
| # Unit tests # |
| ############## |
| if (is_fuchsia) { |
| package("boringssl_tests") { |
| testonly = true |
| deps = [ |
| ":crypto_test", |
| ":ssl_test", |
| ] |
| tests = [ |
| { |
| name = "crypto_test" |
| |
| # This test takes a long time to run, and it is included in every subset |
| # of the Fuchsia build. |
| # TODO(bgoldman): Find a way to skip this test when runtests is set to |
| # skip "large" tests. |
| disabled = true |
| }, |
| { |
| name = "ssl_test" |
| }, |
| ] |
| } |
| } else { |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":crypto_test", |
| ":ssl_test", |
| ] |
| } |
| } |
| |
| executable("crypto_test") { |
| testonly = true |
| visibility = [ ":*" ] |
| sources = crypto_test_sources + test_support_sources |
| configs += [ ":test_config" ] |
| deps = [ |
| ":crypto", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("ssl_test") { |
| testonly = true |
| visibility = [ ":*" ] |
| sources = ssl_test_sources + test_support_sources |
| configs += [ ":test_config" ] |
| deps = [ |
| ":crypto", |
| ":ssl", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| ################################################################################ |
| # Configs |
| config("boringssl_config") { |
| include_dirs = [ "src/include" ] |
| if (is_fuchsia) { |
| # rand_fuchsia uses a system call |
| libs = [ "zircon" ] |
| } |
| } |
| |
| config("internal_config") { |
| visibility = [ ":*" ] |
| defines = [ |
| "BORINGSSL_ALLOW_CXX_RUNTIME", |
| "BORINGSSL_IMPLEMENTATION", |
| "BORINGSSL_NO_STATIC_INITIALIZER", |
| "BORINGSSL_SHARED_LIBRARY", |
| "OPENSSL_SMALL", |
| ] |
| cflags = [ "-Wno-unused-function" ] |
| configs = [ |
| ":boringssl_config", |
| "//build/config:shared_library_config", |
| ] |
| } |
| |
| config("pthread_config") { |
| # pthread_rwlock_t on host requires a feature flag. |
| defines = [ "_XOPEN_SOURCE=700" ] |
| } |
| |
| config("no_asm_config") { |
| defines = [ "OPENSSL_NO_ASM" ] |
| } |
| |
| config("test_config") { |
| visibility = [ ":*" ] |
| include_dirs = [ |
| "src/crypto/test", |
| "src/ssl/test", |
| ] |
| configs = [ ":internal_config" ] |
| } |