Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: BUILD.gn

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .gitignore ('k') | CHANGES » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 declare_args() { 5 import("//testing/test.gni")
6 use_srtp_boringssl = true
7 }
8 6
9 config("libsrtp_config") { 7 config("libsrtp_config") {
10 defines = [ 8 defines = [
9 # Package identity
10 "PACKAGE_STRING=\"libsrtp2 2.0.0-pre\"",
11 "PACKAGE_VERSION=\"2.0.0-pre\"",
12
13 # Config
11 "HAVE_CONFIG_H", 14 "HAVE_CONFIG_H",
15 "OPENSSL",
16
17 # Platform properties
12 "HAVE_STDLIB_H", 18 "HAVE_STDLIB_H",
13 "HAVE_STRING_H", 19 "HAVE_STRING_H",
14 "TESTAPP_SOURCE", 20 "HAVE_STDINT_H",
15 ] 21 "HAVE_INTTYPES_H",
16 22 "HAVE_INT16_T",
17 include_dirs = [ 23 "HAVE_INT32_T",
18 "config", 24 "HAVE_INT8_T",
19 "srtp/include", 25 "HAVE_UINT16_T",
20 "srtp/crypto/include", 26 "HAVE_UINT32_T",
21 ] 27 "HAVE_UINT64_T",
22 28 "HAVE_UINT8_T",
23 if (use_srtp_boringssl) { 29 ]
24 defines += [ "OPENSSL" ]
25 }
26
27 if (is_posix) { 30 if (is_posix) {
28 defines += [ 31 defines += [
29 "HAVE_INT16_T", 32 "HAVE_ARPA_INET_H",
30 "HAVE_INT32_T",
31 "HAVE_INT8_T",
32 "HAVE_UINT16_T",
33 "HAVE_UINT32_T",
34 "HAVE_UINT64_T",
35 "HAVE_UINT8_T",
36 "HAVE_STDINT_H",
37 "HAVE_INTTYPES_H",
38 "HAVE_NETINET_IN_H", 33 "HAVE_NETINET_IN_H",
39 "HAVE_ARPA_INET_H", 34 "HAVE_SYS_TYPES_H",
40 "HAVE_UNISTD_H", 35 "HAVE_UNISTD_H",
41 ] 36 ]
42 cflags = [ "-Wno-unused-variable" ] 37 }
43 }
44
45 if (is_win) { 38 if (is_win) {
46 defines += [ 39 defines += [ "HAVE_WINSOCK2_H" ]
47 "HAVE_BYTESWAP_METHODS_H", 40 }
48 41 }
49 # All Windows architectures are this way. 42
50 "SIZEOF_UNSIGNED_LONG=4", 43 config("libsrtp_public_config") {
51 "SIZEOF_UNSIGNED_LONG_LONG=8", 44 # Supports clients depending on SRTP_RELATIVE_PATH.
52 ] 45 # TODO(mattdr): Remove SRTP_RELATIVE_PATH and this config.
53 } 46 include_dirs = [
54 47 ".",
55 if (current_cpu == "x64" || current_cpu == "x86") { 48 "config",
56 defines += [ 49 "include",
57 "CPU_CISC", 50 "crypto/include",
58 ] 51 ]
59 }
60
61 if (current_cpu == "arm" || current_cpu == "arm64" ||
62 current_cpu == "mipsel" || current_cpu == "mips64el") {
63 # TODO(leozwang): CPU_RISC doesn't work properly on android/arm and
64 # mips platforms for unknown reasons, need to investigate the root
65 # cause of it. CPU_RISC is used for optimization only, and CPU_CISC
66 # should just work just fine, it has been tested on android/arm with
67 # srtp test applications and libjingle.
68 defines += [ "CPU_CISC" ]
69 }
70 if (current_cpu == "mipsel" || current_cpu == "arm" || current_cpu == "x86") {
71 # Define FORCE_64BIT_ALIGN to avoid alignment-related-crashes like
72 # crbug/414919. Without this, aes_cbc_alloc will allocate an
73 # aes_cbc_ctx_t not 64-bit aligned and the v128_t members of
74 # aes_cbc_ctx_t will not be 64-bit aligned, which breaks the
75 # compiler optimizations that assume 64-bit alignment of v128_t.
76 defines += [ "FORCE_64BIT_ALIGN" ]
77 }
78 } 52 }
79 53
80 static_library("libsrtp") { 54 static_library("libsrtp") {
81 configs -= [ "//build/config/compiler:chromium_code" ] 55 configs -= [ "//build/config/compiler:chromium_code" ]
82 configs += [ "//build/config/compiler:no_chromium_code" ] 56 configs += [ "//build/config/compiler:no_chromium_code" ]
83 public_configs = [ ":libsrtp_config" ] 57 configs += [ ":libsrtp_config" ]
84 58 public_configs = [ ":libsrtp_public_config" ]
85 sources = [ 59 sources = [
86 # includes 60 # includes
87 "srtp/include/ekt.h", 61 "include/ekt.h",
88 "srtp/include/getopt_s.h", 62 "include/rtp.h",
89 "srtp/include/rtp.h", 63 "include/srtp.h",
90 "srtp/include/rtp_priv.h",
91 "srtp/include/srtp.h",
92 "srtp/include/srtp_priv.h",
93 "srtp/include/ut_sim.h",
94 64
95 # headers 65 # headers
96 "srtp/crypto/include/aes.h", 66 "crypto/include/aes.h",
97 "srtp/crypto/include/aes_cbc.h", 67 "crypto/include/aes_gcm_ossl.h",
98 "srtp/crypto/include/aes_icm.h", 68 "crypto/include/aes_icm.h",
99 "srtp/crypto/include/alloc.h", 69 "crypto/include/aes_icm_ossl.h",
100 "srtp/crypto/include/auth.h", 70 "crypto/include/alloc.h",
101 "srtp/crypto/include/cipher.h", 71 "crypto/include/auth.h",
102 "srtp/crypto/include/crypto.h", 72 "crypto/include/cipher.h",
103 "srtp/crypto/include/crypto_kernel.h", 73 "crypto/include/crypto_kernel.h",
104 "srtp/crypto/include/crypto_math.h", 74 "crypto/include/crypto_types.h",
105 "srtp/crypto/include/crypto_types.h", 75 "crypto/include/datatypes.h",
106 "srtp/crypto/include/cryptoalg.h", 76 "crypto/include/err.h",
107 "srtp/crypto/include/datatypes.h", 77 "crypto/include/integers.h",
108 "srtp/crypto/include/err.h", 78 "crypto/include/key.h",
109 "srtp/crypto/include/gf2_8.h", 79 "crypto/include/null_auth.h",
110 "srtp/crypto/include/hmac.h", 80 "crypto/include/null_cipher.h",
111 "srtp/crypto/include/integers.h", 81 "crypto/include/rdb.h",
112 "srtp/crypto/include/kernel_compat.h", 82 "crypto/include/rdbx.h",
113 "srtp/crypto/include/key.h", 83 "crypto/include/stat.h",
114 "srtp/crypto/include/null_auth.h", 84 "include/rtp_priv.h",
115 "srtp/crypto/include/null_cipher.h", 85 "include/srtp_priv.h",
116 "srtp/crypto/include/prng.h", 86 "include/ut_sim.h",
117 "srtp/crypto/include/rand_source.h",
118 "srtp/crypto/include/rdb.h",
119 "srtp/crypto/include/rdbx.h",
120 "srtp/crypto/include/sha1.h",
121 "srtp/crypto/include/stat.h",
122 "srtp/crypto/include/xfm.h",
123 87
124 # sources 88 # sources
125 "srtp/crypto/cipher/aes.c", 89 "crypto/cipher/aes_gcm_ossl.c",
126 "srtp/crypto/cipher/aes_cbc.c", 90 "crypto/cipher/aes_icm_ossl.c",
127 "srtp/crypto/cipher/aes_icm.c", 91 "crypto/cipher/cipher.c",
128 "srtp/crypto/cipher/cipher.c", 92 "crypto/cipher/null_cipher.c",
129 "srtp/crypto/cipher/null_cipher.c", 93 "crypto/hash/auth.c",
130 "srtp/crypto/hash/auth.c", 94 "crypto/hash/hmac_ossl.c",
131 "srtp/crypto/hash/hmac.c", 95 "crypto/hash/null_auth.c",
132 "srtp/crypto/hash/null_auth.c", 96 "crypto/kernel/alloc.c",
133 "srtp/crypto/hash/sha1.c", 97 "crypto/kernel/crypto_kernel.c",
134 "srtp/crypto/kernel/alloc.c", 98 "crypto/kernel/err.c",
135 "srtp/crypto/kernel/crypto_kernel.c", 99 "crypto/kernel/key.c",
136 "srtp/crypto/kernel/err.c", 100 "crypto/math/datatypes.c",
137 "srtp/crypto/kernel/key.c", 101 "crypto/math/stat.c",
138 "srtp/crypto/math/datatypes.c", 102 "crypto/replay/rdb.c",
139 "srtp/crypto/math/gf2_8.c", 103 "crypto/replay/rdbx.c",
140 "srtp/crypto/math/stat.c", 104 "srtp/ekt.c",
141 "srtp/crypto/replay/rdb.c", 105 "srtp/srtp.c",
142 "srtp/crypto/replay/rdbx.c", 106 ]
143 "srtp/crypto/replay/ut_sim.c", 107 public_deps = [
144 "srtp/crypto/rng/ctr_prng.c", 108 "//third_party/boringssl:boringssl",
145 "srtp/crypto/rng/prng.c", 109 ]
146 "srtp/crypto/rng/rand_source.c", 110 }
147 "srtp/srtp/ekt.c", 111
148 "srtp/srtp/srtp.c", 112 config("srtp_test_config") {
149 ] 113 include_dirs = [ "test" ]
150 114 }
151 if (is_clang) { 115
152 cflags = [ "-Wno-implicit-function-declaration" ] 116 template("srtp_test") {
153 } 117 test("srtp_test_${target_name}") {
154
155 if (use_srtp_boringssl) {
156 deps = [
157 "//third_party/boringssl:boringssl",
158 ]
159 public_deps = [
160 "//third_party/boringssl:boringssl",
161 ]
162 sources -= [
163 "srtp/crypto/cipher/aes_cbc.c",
164 "srtp/crypto/cipher/aes_icm.c",
165 "srtp/crypto/hash/hmac.c",
166 "srtp/crypto/hash/sha1.c",
167 "srtp/crypto/rng/ctr_prng.c",
168 "srtp/crypto/rng/prng.c",
169 "srtp/crypto/rng/rand_source.c",
170 ]
171 sources += [
172 "srtp/crypto/cipher/aes_gcm_ossl.c",
173 "srtp/crypto/cipher/aes_icm_ossl.c",
174 "srtp/crypto/hash/hmac_ossl.c",
175 "srtp/crypto/include/aes_gcm_ossl.h",
176 "srtp/crypto/include/aes_icm_ossl.h",
177 "srtp/crypto/rng/rand_source_ossl.c",
178 ]
179 }
180 }
181
182 # TODO(GYP): A bunch of these tests don't compile (in gyp either). They're
183 # not very broken, so could probably be made to work if it's useful.
184 if (!is_win) {
185 executable("rdbx_driver") {
186 configs -= [ "//build/config/compiler:chromium_code" ] 118 configs -= [ "//build/config/compiler:chromium_code" ]
187 configs += [ "//build/config/compiler:no_chromium_code" ] 119 configs += [ "//build/config/compiler:no_chromium_code" ]
120 configs += [
121 ":libsrtp_config",
122 ":srtp_test_config",
123 ]
188 deps = [ 124 deps = [
189 ":libsrtp", 125 ":libsrtp",
190 ] 126 ]
191 sources = [ 127 sources = [
192 "srtp/include/getopt_s.h", 128 "crypto/replay/ut_sim.c",
193 "srtp/test/getopt_s.c", 129 "include/getopt_s.h",
194 "srtp/test/rdbx_driver.c", 130 "include/ut_sim.h",
195 ] 131 "test/getopt_s.c",
196 } 132 "test/util.c",
197 133 "test/util.h",
198 executable("srtp_driver") { 134 invoker.source,
199 configs -= [ "//build/config/compiler:chromium_code" ] 135 ]
200 configs += [ "//build/config/compiler:no_chromium_code" ] 136 testonly = true
201 deps = [ 137 }
202 ":libsrtp", 138 }
203 ] 139
204 sources = [ 140 srtp_test("dtls_srtp_driver") {
205 "srtp/include/getopt_s.h", 141 source = "test/dtls_srtp_driver.c"
206 "srtp/include/srtp_priv.h", 142 }
207 "srtp/test/getopt_s.c", 143 srtp_test("rdbx_driver") {
208 "srtp/test/srtp_driver.c", 144 source = "test/rdbx_driver.c"
209 ] 145 }
210 } 146 srtp_test("replay_driver") {
211 147 source = "test/replay_driver.c"
212 executable("roc_driver") { 148 }
213 configs -= [ "//build/config/compiler:chromium_code" ] 149 srtp_test("roc_driver") {
214 configs += [ "//build/config/compiler:no_chromium_code" ] 150 source = "test/roc_driver.c"
215 deps = [ 151 }
216 ":libsrtp", 152 srtp_test("srtp_driver") {
217 ] 153 source = "test/srtp_driver.c"
218 sources = [ 154 }
219 "srtp/crypto/include/rdbx.h", 155 srtp_test("cipher_driver") {
220 "srtp/include/ut_sim.h", 156 source = "crypto/test/cipher_driver.c"
221 "srtp/test/roc_driver.c", 157 }
222 ] 158 srtp_test("datatypes_driver") {
223 } 159 source = "crypto/test/datatypes_driver.c"
224 160 }
225 executable("replay_driver") { 161 srtp_test("kernel_driver") {
226 configs -= [ "//build/config/compiler:chromium_code" ] 162 source = "crypto/test/kernel_driver.c"
227 configs += [ "//build/config/compiler:no_chromium_code" ] 163 }
228 deps = [ 164
229 ":libsrtp", 165 if (is_posix) {
230 ] 166 # This might compile but won't be useful on non-POSIX.
231 sources = [
232 "srtp/crypto/include/rdbx.h",
233 "srtp/include/ut_sim.h",
234 "srtp/test/replay_driver.c",
235 ]
236 }
237 167
238 executable("rtpw") { 168 executable("rtpw") {
239 configs -= [ "//build/config/compiler:chromium_code" ] 169 configs -= [ "//build/config/compiler:chromium_code" ]
240 configs += [ "//build/config/compiler:no_chromium_code" ] 170 configs += [ "//build/config/compiler:no_chromium_code" ]
171 configs += [
172 ":libsrtp_config",
173 ":srtp_test_config",
174 ]
241 deps = [ 175 deps = [
242 ":libsrtp", 176 ":libsrtp",
243 ] 177 ]
244 sources = [ 178 sources = [
245 "srtp/crypto/include/datatypes.h", 179 "include/getopt_s.h",
246 "srtp/include/getopt_s.h", 180 "test/getopt_s.c",
247 "srtp/include/rtp.h", 181 "test/rtp.c",
248 "srtp/include/srtp.h", 182 "test/rtpw.c",
249 "srtp/test/getopt_s.c", 183 "test/util.c",
250 "srtp/test/rtp.c", 184 "test/util.h",
251 "srtp/test/rtpw.c", 185
252 ] 186 # The original Makefile includes this file, but all the functions rtpw
253 if (is_android) { 187 # uses have been moved to util.c.
254 defines = [ "HAVE_SYS_SOCKET_H" ] 188 "crypto/math/datatypes.c",
255 } 189 ]
256 if (is_clang) { 190 defines = [ "HAVE_SYS_SOCKET_H" ]
257 cflags = [ "-Wno-implicit-function-declaration" ] 191 testonly = true
258 } 192 }
259 } 193
260 194 copy("rtpw_test_scripts") {
261 executable("srtp_test_cipher_driver") { 195 sources = [
262 configs -= [ "//build/config/compiler:chromium_code" ] 196 "test/rtpw_test.sh",
263 configs += [ "//build/config/compiler:no_chromium_code" ] 197 "test/rtpw_test_gcm.sh",
198 ]
199 outputs = [
200 "$root_out_dir/{{source_file_part}}",
201 ]
202 testonly = true
203 }
204
205 group("srtp_test_rtpw") {
264 deps = [ 206 deps = [
265 ":libsrtp",
266 ]
267 sources = [
268 "srtp/crypto/test/cipher_driver.c",
269 "srtp/include/getopt_s.h",
270 "srtp/test/getopt_s.c",
271 ]
272 }
273
274 executable("srtp_test_datatypes_driver") {
275 configs -= [ "//build/config/compiler:chromium_code" ]
276 configs += [ "//build/config/compiler:no_chromium_code" ]
277 deps = [
278 ":libsrtp",
279 ]
280 sources = [
281 "srtp/crypto/test/datatypes_driver.c",
282 ]
283 }
284
285 executable("srtp_test_stat_driver") {
286 configs -= [ "//build/config/compiler:chromium_code" ]
287 configs += [ "//build/config/compiler:no_chromium_code" ]
288 deps = [
289 ":libsrtp",
290 ]
291 sources = [
292 "srtp/crypto/test/stat_driver.c",
293 ]
294 }
295
296 executable("srtp_test_sha1_driver") {
297 configs -= [ "//build/config/compiler:chromium_code" ]
298 configs += [ "//build/config/compiler:no_chromium_code" ]
299 deps = [
300 ":libsrtp",
301 ]
302 sources = [
303 "srtp/crypto/test/sha1_driver.c",
304 ]
305 }
306
307 executable("srtp_test_kernel_driver") {
308 configs -= [ "//build/config/compiler:chromium_code" ]
309 configs += [ "//build/config/compiler:no_chromium_code" ]
310 deps = [
311 ":libsrtp",
312 ]
313 sources = [
314 "srtp/crypto/test/kernel_driver.c",
315 "srtp/include/getopt_s.h",
316 "srtp/test/getopt_s.c",
317 ]
318 }
319
320 executable("srtp_test_aes_calc") {
321 configs -= [ "//build/config/compiler:chromium_code" ]
322 configs += [ "//build/config/compiler:no_chromium_code" ]
323 deps = [
324 ":libsrtp",
325 ]
326 sources = [
327 "srtp/crypto/test/aes_calc.c",
328 ]
329 }
330
331 executable("srtp_test_rand_gen") {
332 configs -= [ "//build/config/compiler:chromium_code" ]
333 configs += [ "//build/config/compiler:no_chromium_code" ]
334 deps = [
335 ":libsrtp",
336 ]
337 sources = [
338 "srtp/crypto/test/rand_gen.c",
339 "srtp/include/getopt_s.h",
340 "srtp/test/getopt_s.c",
341 ]
342 }
343
344 executable("srtp_test_rand_gen_soak") {
345 configs -= [ "//build/config/compiler:chromium_code" ]
346 configs += [ "//build/config/compiler:no_chromium_code" ]
347 deps = [
348 ":libsrtp",
349 ]
350 sources = [
351 "srtp/crypto/test/rand_gen_soak.c",
352 "srtp/include/getopt_s.h",
353 "srtp/test/getopt_s.c",
354 ]
355 }
356
357 executable("srtp_test_env") {
358 configs -= [ "//build/config/compiler:chromium_code" ]
359 configs += [ "//build/config/compiler:no_chromium_code" ]
360 deps = [
361 ":libsrtp",
362 ]
363 sources = [
364 "srtp/crypto/test/env.c",
365 ]
366 }
367
368 group("srtp_runtest") {
369 deps = [
370 ":rdbx_driver",
371 ":srtp_driver",
372 ":roc_driver",
373 ":replay_driver",
374 ":rtpw", 207 ":rtpw",
375 ":srtp_test_cipher_driver", 208 ":rtpw_test_scripts",
376 ":srtp_test_datatypes_driver", 209 ]
377 ":srtp_test_stat_driver", 210 testonly = true
378 ":srtp_test_sha1_driver", 211 }
379 ":srtp_test_kernel_driver", 212 } else {
380 ":srtp_test_aes_calc", 213 group("srtp_test_rtpw") {
381 ":srtp_test_rand_gen", 214 testonly = true
382 ":srtp_test_rand_gen_soak", 215 }
383 ":srtp_test_env", 216 }
384 ] 217
385 } 218 # Run with, e.g.:
386 } 219 # for a in out/Default/srtp_test_*; do
220 # echo $a
221 # "${a}" -v > /dev/null || "${a}" > /dev/null || echo $a FAILED
222 # done
223
224 group("srtp_tests") {
225 deps = [
226 ":srtp_test_cipher_driver",
227 ":srtp_test_datatypes_driver",
228 ":srtp_test_dtls_srtp_driver",
229 ":srtp_test_kernel_driver",
230 ":srtp_test_rdbx_driver",
231 ":srtp_test_replay_driver",
232 ":srtp_test_roc_driver",
233 ":srtp_test_rtpw",
234 ":srtp_test_srtp_driver",
235 ]
236 testonly = true
237 }
OLDNEW
« no previous file with comments | « .gitignore ('k') | CHANGES » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698