File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (263 lines) | stat: -rw-r--r-- 6,689 bytes parent folder | download | duplicates (6)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# 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("//testing/test.gni")
import("//third_party/libsrtp/options.gni")

declare_args() {
  # Tests may not be appropriate for some build environments, e.g. Windows.
  # Rather than enumerate valid options, we just let clients ask for them.
  build_libsrtp_tests = false
}

config("external_ssl_library") {
  if (libsrtp_ssl_root != "") {
    include_dirs = [ libsrtp_ssl_root ]
  }
  libs = [
    "crypto",
    "ssl",
  ]
}

config("libsrtp_config") {
  defines = [
    # Package identity
    "PACKAGE_STRING=\"860492290f7d1f25e2bd45da6471bfd4cd4d7add\"",
    "PACKAGE_VERSION=\"860492290f7d1f25e2bd45da6471bfd4cd4d7add\"",

    # Config
    "HAVE_CONFIG_H",
    "OPENSSL",
    "GCM",

    # Platform properties
    "HAVE_STDLIB_H",
    "HAVE_STRING_H",
    "HAVE_STDINT_H",
    "HAVE_INTTYPES_H",
    "HAVE_INT16_T",
    "HAVE_INT32_T",
    "HAVE_INT8_T",
    "HAVE_UINT16_T",
    "HAVE_UINT32_T",
    "HAVE_UINT64_T",
    "HAVE_UINT8_T",
  ]

  if (is_posix || is_fuchsia) {
    defines += [
      "HAVE_ARPA_INET_H",
      "HAVE_NETINET_IN_H",
      "HAVE_SYS_TYPES_H",
      "HAVE_UNISTD_H",
    ]
  }
  if (is_win) {
    defines += [ "HAVE_WINSOCK2_H" ]
  }

  # Supports clients depending on SRTP_RELATIVE_PATH.
  # TODO(mattdr): Remove SRTP_RELATIVE_PATH and this config.
  include_dirs = [
    ".",
    "config",
    "include",
    "crypto/include",
  ]
}

config("libsrtp_warnings") {
  cflags = []
  if (is_win) {
    cflags += [ "/wd4018" ]  # Signed/unsigned mismatch in comparison
  }
}

static_library("libsrtp") {
  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
  configs += [ ":libsrtp_warnings" ]
  public_configs = [ ":libsrtp_config" ]
  sources = [
    # includes
    "include/srtp.h",

    # headers
    "crypto/cipher/cipher_test_cases.h",
    "crypto/hash/auth_test_cases.h",
    "crypto/include/aes.h",
    "crypto/include/aes_gcm.h",
    "crypto/include/aes_icm.h",
    "crypto/include/aes_icm_ext.h",
    "crypto/include/alloc.h",
    "crypto/include/auth.h",
    "crypto/include/cipher.h",
    "crypto/include/cipher_priv.h",
    "crypto/include/cipher_types.h",
    "crypto/include/crypto_kernel.h",
    "crypto/include/crypto_types.h",
    "crypto/include/datatypes.h",
    "crypto/include/err.h",
    "crypto/include/integers.h",
    "crypto/include/key.h",
    "crypto/include/null_auth.h",
    "crypto/include/null_cipher.h",
    "crypto/include/rdb.h",
    "crypto/include/rdbx.h",
    "include/srtp_priv.h",

    # sources
    "crypto/cipher/aes_gcm_ossl.c",
    "crypto/cipher/aes_icm_ossl.c",
    "crypto/cipher/cipher.c",
    "crypto/cipher/cipher_test_cases.c",
    "crypto/cipher/null_cipher.c",
    "crypto/hash/auth.c",
    "crypto/hash/auth_test_cases.c",
    "crypto/hash/hmac_ossl.c",
    "crypto/hash/null_auth.c",
    "crypto/kernel/alloc.c",
    "crypto/kernel/crypto_kernel.c",
    "crypto/kernel/err.c",
    "crypto/kernel/key.c",
    "crypto/math/datatypes.c",
    "crypto/replay/rdb.c",
    "crypto/replay/rdbx.c",
    "srtp/srtp.c",

    # TODO(bugs.webrtc.org/11915): The following files are not needed by
    # WebRTC and they are not part of the build and the checkout.
    # Adding them to the build, requires the addition of some conditionals
    # since these files include duplicated symbols and cannot be built
    # together.
    #
    # "crypto/include/hmac.h",
    # "crypto/include/sha1.h",
    # "crypto/cipher/aes.c",
    # "crypto/cipher/aes_icm.c",
    # "crypto/hash/hmac.c",
    # "crypto/hash/sha1.c",
    # "crypto/cipher/aes_gcm_nss.c",
    # "crypto/cipher/aes_icm_nss.c",
  ]

  deps = []
  if (libsrtp_build_boringssl) {
    deps += [ "//third_party/boringssl:boringssl" ]
  } else {
    configs += [ ":external_ssl_library" ]
  }
}

if (build_libsrtp_tests) {
  config("srtp_test_config") {
    include_dirs = [ "test" ]
    configs = [ ":libsrtp_warnings" ]
  }

  template("srtp_test") {
    test("${target_name}") {
      output_name = invoker.target_name
      output_dir = "${root_out_dir}/srtp_tests"
      configs -= [ "//build/config/compiler:chromium_code" ]
      configs += [ "//build/config/compiler:no_chromium_code" ]
      configs += [ ":srtp_test_config" ]
      deps = [ ":libsrtp" ]
      sources = [
                  "test/getopt_s.h",
                  "test/getopt_s.c",
                  "test/ut_sim.c",
                  "test/ut_sim.h",
                  "test/util.c",
                  "test/util.h",
                ] + invoker.sources
      testonly = true
    }
  }

  srtp_test("rdbx_driver") {
    sources = [ "test/rdbx_driver.c" ]
  }
  srtp_test("replay_driver") {
    sources = [ "test/replay_driver.c" ]
  }
  srtp_test("roc_driver") {
    sources = [ "test/roc_driver.c" ]
  }
  srtp_test("srtp_driver") {
    sources = [ "test/srtp_driver.c" ]
  }
  srtp_test("test_srtp") {
    sources = [
      "test/cutest.h",
      "test/test_srtp.c",
    ]
  }
  srtp_test("cipher_driver") {
    sources = [ "crypto/test/cipher_driver.c" ]
  }
  srtp_test("datatypes_driver") {
    sources = [ "crypto/test/datatypes_driver.c" ]
  }
  srtp_test("kernel_driver") {
    sources = [ "crypto/test/kernel_driver.c" ]
  }

  executable("rtpw") {
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [ "//build/config/compiler:no_chromium_code" ]
    configs += [ ":srtp_test_config" ]
    output_dir = "${root_out_dir}/srtp_tests"
    deps = [ ":libsrtp" ]
    sources = [
      "include/getopt_s.h",
      "test/getopt_s.c",
      "test/rtp.c",
      "test/rtp.h",
      "test/rtpw.c",
      "test/util.c",
      "test/util.h",

      # The original Makefile includes this file, but all the functions rtpw
      # uses have been moved to util.c.
      "crypto/math/datatypes.c",
    ]
    defines = [ "HAVE_SYS_SOCKET_H" ]
    testonly = true
  }

  copy("test_scripts") {
    sources = [
      "run_all_tests.sh",
      "test/rtpw_test.sh",
      "test/rtpw_test_gcm.sh",
    ]
    outputs = [ "${root_out_dir}/srtp_tests/{{source_file_part}}" ]
    testonly = true
  }

  copy("test_data") {
    sources = [ "test/words.txt" ]
    outputs = [ "${root_out_dir}/srtp_tests/{{source_file_part}}" ]
    testonly = true
  }

  group("srtp_tests") {
    deps = [
      ":cipher_driver",
      ":datatypes_driver",
      ":kernel_driver",
      ":rdbx_driver",
      ":replay_driver",
      ":roc_driver",
      ":rtpw",
      ":srtp_driver",
      ":test_data",
      ":test_scripts",
      ":test_srtp",
    ]
    testonly = true
  }
}