aboutsummaryrefslogtreecommitdiff
path: root/third_party/boringssl/BUILD.gn
blob: a43fbba9be29625bb21a8a802c999db5335c2ce1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright 2019 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_overrides/build.gni")
import("BUILD.generated.gni")
import("BUILD.generated_tests.gni")

if (build_with_chromium) {
  group("boringssl") {
    public_configs = [ "//build/config/compiler:default_include_dirs" ]
    public_deps = [
      "//third_party/boringssl",
    ]
  }
} else {
  # Config for us and everybody else depending on BoringSSL.
  config("external_config") {
    include_dirs = [ "src/include" ]
    cflags = []
    if (is_clang) {
      cflags += [ "-Wno-extra-semi" ]
    }
  }

  # 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_ALLOW_CXX_RUNTIME",
      "BORINGSSL_IMPLEMENTATION",
      "BORINGSSL_NO_STATIC_INITIALIZER",
      "OPENSSL_SMALL",
    ]
    cflags = []
    cflags_c = [ "-std=c99" ]
    cflags_cc = []
    if (is_clang) {
      cflags += [ "-Wno-extra-semi" ]
      cflags_cc += [ "-Wno-c++98-compat-extra-semi" ]
    }

    if (is_mac) {
      # Necessary since trybots have an old version of clang.
      cflags += [ "-Wno-unknown-warning-option" ]
    }

    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
  all_headers = crypto_headers + ssl_headers

  # 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.

    sources = []
    asmflags = []

    if (is_linux) {
      if (current_cpu == "x64") {
        sources += crypto_sources_linux_x86_64
      } else if (current_cpu == "x86") {
        sources += crypto_sources_linux_x86
      } else {
        public_configs = [ ":no_asm_config" ]
      }
    } else if (is_mac) {
      if (current_cpu == "x64") {
        sources += crypto_sources_mac_x86_64
      } else if (current_cpu == "x86") {
        sources += crypto_sources_mac_x86
      } else {
        public_configs = [ ":no_asm_config" ]
      }
    } else {
      public_configs = [ ":no_asm_config" ]
    }
  }

  source_set("boringssl") {
    sources = all_sources
    public = all_headers
    deps = [
      ":boringssl_asm",
      "src/third_party/fiat:fiat_license",
    ]

    public_configs = [ ":external_config" ]
    configs += [ ":internal_config" ]

    configs -= [ "//build:default_include_dirs" ]
  }
}