Index: BUILD.gn |
diff --git a/BUILD.gn b/BUILD.gn |
index 6f3e0017f9bb198a19bd760978857287d465ca8c..1c81935e6bd127f0263dccd5389727009ab47f6f 100644 |
--- a/BUILD.gn |
+++ b/BUILD.gn |
@@ -1,386 +1,236 @@ |
-# Copyright 2014 The Chromium Authors. All rights reserved. |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
kjellander_chromium
2016/10/05 07:14:13
nit: according to the style guide, year shouldn't
mattdr-at-chromium
2016/10/05 08:46:41
Reverted
|
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-declare_args() { |
- use_srtp_boringssl = true |
-} |
+import("//testing/test.gni") |
config("libsrtp_config") { |
defines = [ |
+ # Package identity |
+ "PACKAGE_STRING=\"libsrtp2 2.0.0-pre\"", |
+ "PACKAGE_VERSION=\"2.0.0-pre\"", |
+ |
+ # Config |
"HAVE_CONFIG_H", |
+ "OPENSSL", |
+ |
+ # Platform properties |
"HAVE_STDLIB_H", |
"HAVE_STRING_H", |
- "TESTAPP_SOURCE", |
- ] |
- |
- include_dirs = [ |
- "config", |
- "srtp/include", |
- "srtp/crypto/include", |
+ "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 (use_srtp_boringssl) { |
- defines += [ "OPENSSL" ] |
- } |
- |
if (is_posix) { |
defines += [ |
- "HAVE_INT16_T", |
- "HAVE_INT32_T", |
- "HAVE_INT8_T", |
- "HAVE_UINT16_T", |
- "HAVE_UINT32_T", |
- "HAVE_UINT64_T", |
- "HAVE_UINT8_T", |
- "HAVE_STDINT_H", |
- "HAVE_INTTYPES_H", |
- "HAVE_NETINET_IN_H", |
"HAVE_ARPA_INET_H", |
+ "HAVE_NETINET_IN_H", |
+ "HAVE_SYS_TYPES_H", |
"HAVE_UNISTD_H", |
] |
- cflags = [ "-Wno-unused-variable" ] |
} |
- |
if (is_win) { |
- defines += [ |
- "HAVE_BYTESWAP_METHODS_H", |
- |
- # All Windows architectures are this way. |
- "SIZEOF_UNSIGNED_LONG=4", |
- "SIZEOF_UNSIGNED_LONG_LONG=8", |
- ] |
- } |
- |
- if (current_cpu == "x64" || current_cpu == "x86") { |
- defines += [ |
- "CPU_CISC", |
- ] |
+ defines += [ "HAVE_WINSOCK2_H" ] |
} |
+} |
- if (current_cpu == "arm" || current_cpu == "arm64" || |
- current_cpu == "mipsel" || current_cpu == "mips64el") { |
- # TODO(leozwang): CPU_RISC doesn't work properly on android/arm and |
- # mips platforms for unknown reasons, need to investigate the root |
- # cause of it. CPU_RISC is used for optimization only, and CPU_CISC |
- # should just work just fine, it has been tested on android/arm with |
- # srtp test applications and libjingle. |
- defines += [ "CPU_CISC" ] |
- } |
- if (current_cpu == "mipsel" || current_cpu == "arm" || current_cpu == "x86") { |
- # Define FORCE_64BIT_ALIGN to avoid alignment-related-crashes like |
- # crbug/414919. Without this, aes_cbc_alloc will allocate an |
- # aes_cbc_ctx_t not 64-bit aligned and the v128_t members of |
- # aes_cbc_ctx_t will not be 64-bit aligned, which breaks the |
- # compiler optimizations that assume 64-bit alignment of v128_t. |
- defines += [ "FORCE_64BIT_ALIGN" ] |
- } |
+config("libsrtp_public_config") { |
+ # Supports clients depending on SRTP_RELATIVE_PATH. |
+ # TODO(mattdr): Remove SRTP_RELATIVE_PATH and this config. |
+ include_dirs = [ |
+ ".", |
kjellander_chromium
2016/10/05 07:14:12
I don't believe you need "." in the GN world. It's
mattdr-at-chromium
2016/10/05 08:46:41
Confirmed. Removed.
mattdr-at-chromium
2016/10/05 09:02:21
I spoke too soon. Without this, srtpfilter_unittes
kjellander_chromium
2016/10/05 09:17:12
That's weird. Well, if it fails it fails :)
|
+ "config", |
+ "include", |
+ "crypto/include", |
+ ] |
} |
static_library("libsrtp") { |
configs -= [ "//build/config/compiler:chromium_code" ] |
configs += [ "//build/config/compiler:no_chromium_code" ] |
- public_configs = [ ":libsrtp_config" ] |
- |
+ configs += [ ":libsrtp_config" ] |
+ public_configs = [ ":libsrtp_public_config" ] |
sources = [ |
# includes |
- "srtp/include/ekt.h", |
- "srtp/include/getopt_s.h", |
- "srtp/include/rtp.h", |
- "srtp/include/rtp_priv.h", |
- "srtp/include/srtp.h", |
- "srtp/include/srtp_priv.h", |
- "srtp/include/ut_sim.h", |
+ "include/ekt.h", |
+ "include/rtp.h", |
+ "include/srtp.h", |
# headers |
- "srtp/crypto/include/aes.h", |
- "srtp/crypto/include/aes_cbc.h", |
- "srtp/crypto/include/aes_icm.h", |
- "srtp/crypto/include/alloc.h", |
- "srtp/crypto/include/auth.h", |
- "srtp/crypto/include/cipher.h", |
- "srtp/crypto/include/crypto.h", |
- "srtp/crypto/include/crypto_kernel.h", |
- "srtp/crypto/include/crypto_math.h", |
- "srtp/crypto/include/crypto_types.h", |
- "srtp/crypto/include/cryptoalg.h", |
- "srtp/crypto/include/datatypes.h", |
- "srtp/crypto/include/err.h", |
- "srtp/crypto/include/gf2_8.h", |
- "srtp/crypto/include/hmac.h", |
- "srtp/crypto/include/integers.h", |
- "srtp/crypto/include/kernel_compat.h", |
- "srtp/crypto/include/key.h", |
- "srtp/crypto/include/null_auth.h", |
- "srtp/crypto/include/null_cipher.h", |
- "srtp/crypto/include/prng.h", |
- "srtp/crypto/include/rand_source.h", |
- "srtp/crypto/include/rdb.h", |
- "srtp/crypto/include/rdbx.h", |
- "srtp/crypto/include/sha1.h", |
- "srtp/crypto/include/stat.h", |
- "srtp/crypto/include/xfm.h", |
+ "crypto/include/aes.h", |
+ "crypto/include/aes_gcm_ossl.h", |
+ "crypto/include/aes_icm.h", |
+ "crypto/include/aes_icm_ossl.h", |
+ "crypto/include/alloc.h", |
+ "crypto/include/auth.h", |
+ "crypto/include/cipher.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", |
+ "crypto/include/stat.h", |
+ "include/rtp_priv.h", |
+ "include/srtp_priv.h", |
+ "include/ut_sim.h", |
# sources |
- "srtp/crypto/cipher/aes.c", |
- "srtp/crypto/cipher/aes_cbc.c", |
- "srtp/crypto/cipher/aes_icm.c", |
- "srtp/crypto/cipher/cipher.c", |
- "srtp/crypto/cipher/null_cipher.c", |
- "srtp/crypto/hash/auth.c", |
- "srtp/crypto/hash/hmac.c", |
- "srtp/crypto/hash/null_auth.c", |
- "srtp/crypto/hash/sha1.c", |
- "srtp/crypto/kernel/alloc.c", |
- "srtp/crypto/kernel/crypto_kernel.c", |
- "srtp/crypto/kernel/err.c", |
- "srtp/crypto/kernel/key.c", |
- "srtp/crypto/math/datatypes.c", |
- "srtp/crypto/math/gf2_8.c", |
- "srtp/crypto/math/stat.c", |
- "srtp/crypto/replay/rdb.c", |
- "srtp/crypto/replay/rdbx.c", |
- "srtp/crypto/replay/ut_sim.c", |
- "srtp/crypto/rng/ctr_prng.c", |
- "srtp/crypto/rng/prng.c", |
- "srtp/crypto/rng/rand_source.c", |
- "srtp/srtp/ekt.c", |
- "srtp/srtp/srtp.c", |
+ "crypto/cipher/aes_gcm_ossl.c", |
+ "crypto/cipher/aes_icm_ossl.c", |
+ "crypto/cipher/cipher.c", |
+ "crypto/cipher/null_cipher.c", |
+ "crypto/hash/auth.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/math/stat.c", |
+ "crypto/replay/rdb.c", |
+ "crypto/replay/rdbx.c", |
+ "srtp/ekt.c", |
+ "srtp/srtp.c", |
] |
+ public_deps = [ |
+ "//third_party/boringssl:boringssl", |
+ ] |
+} |
- if (is_clang) { |
- cflags = [ "-Wno-implicit-function-declaration" ] |
- } |
- |
- if (use_srtp_boringssl) { |
- deps = [ |
- "//third_party/boringssl:boringssl", |
- ] |
- public_deps = [ |
- "//third_party/boringssl:boringssl", |
- ] |
- sources -= [ |
- "srtp/crypto/cipher/aes_cbc.c", |
- "srtp/crypto/cipher/aes_icm.c", |
- "srtp/crypto/hash/hmac.c", |
- "srtp/crypto/hash/sha1.c", |
- "srtp/crypto/rng/ctr_prng.c", |
- "srtp/crypto/rng/prng.c", |
- "srtp/crypto/rng/rand_source.c", |
- ] |
- sources += [ |
- "srtp/crypto/cipher/aes_gcm_ossl.c", |
- "srtp/crypto/cipher/aes_icm_ossl.c", |
- "srtp/crypto/hash/hmac_ossl.c", |
- "srtp/crypto/include/aes_gcm_ossl.h", |
- "srtp/crypto/include/aes_icm_ossl.h", |
- "srtp/crypto/rng/rand_source_ossl.c", |
- ] |
- } |
+config("srtp_test_config") { |
+ include_dirs = [ "test" ] |
} |
-# TODO(GYP): A bunch of these tests don't compile (in gyp either). They're |
-# not very broken, so could probably be made to work if it's useful. |
-if (!is_win) { |
- executable("rdbx_driver") { |
+template("srtp_test") { |
+ test("srtp_test_${target_name}") { |
kjellander_chromium
2016/10/05 07:14:12
add testonly = true to the template.
mattdr-at-chromium
2016/10/05 08:46:41
Done.
|
configs -= [ "//build/config/compiler:chromium_code" ] |
configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
+ configs += [ |
+ ":libsrtp_config", |
+ ":srtp_test_config", |
] |
- sources = [ |
- "srtp/include/getopt_s.h", |
- "srtp/test/getopt_s.c", |
- "srtp/test/rdbx_driver.c", |
- ] |
- } |
- |
- executable("srtp_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
deps = [ |
":libsrtp", |
] |
sources = [ |
- "srtp/include/getopt_s.h", |
- "srtp/include/srtp_priv.h", |
- "srtp/test/getopt_s.c", |
- "srtp/test/srtp_driver.c", |
+ "crypto/replay/ut_sim.c", |
+ "include/getopt_s.h", |
+ "include/ut_sim.h", |
+ "test/getopt_s.c", |
+ "test/util.c", |
+ "test/util.h", |
+ invoker.source, |
] |
} |
+} |
- executable("roc_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/include/rdbx.h", |
- "srtp/include/ut_sim.h", |
- "srtp/test/roc_driver.c", |
- ] |
- } |
+srtp_test("dtls_srtp_driver") { |
+ source = "test/dtls_srtp_driver.c" |
+} |
+srtp_test("rdbx_driver") { |
+ source = "test/rdbx_driver.c" |
+} |
+srtp_test("replay_driver") { |
+ source = "test/replay_driver.c" |
+} |
+srtp_test("roc_driver") { |
+ source = "test/roc_driver.c" |
+} |
+srtp_test("srtp_driver") { |
+ source = "test/srtp_driver.c" |
+} |
+srtp_test("cipher_driver") { |
+ source = "crypto/test/cipher_driver.c" |
+} |
+srtp_test("datatypes_driver") { |
+ source = "crypto/test/datatypes_driver.c" |
+} |
+srtp_test("kernel_driver") { |
+ source = "crypto/test/kernel_driver.c" |
+} |
- executable("replay_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/include/rdbx.h", |
- "srtp/include/ut_sim.h", |
- "srtp/test/replay_driver.c", |
- ] |
- } |
+if (is_posix) { |
+ # This might compile but won't be useful on non-POSIX. |
executable("rtpw") { |
kjellander_chromium
2016/10/05 07:14:13
It looks like this can also use the srtp_test temp
mattdr-at-chromium
2016/10/05 08:46:41
The two differ slightly in sources and defines, so
kjellander_chromium
2016/10/05 09:17:12
OK, I mostly wanted to check, since the other test
|
configs -= [ "//build/config/compiler:chromium_code" ] |
configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/include/datatypes.h", |
- "srtp/include/getopt_s.h", |
- "srtp/include/rtp.h", |
- "srtp/include/srtp.h", |
- "srtp/test/getopt_s.c", |
- "srtp/test/rtp.c", |
- "srtp/test/rtpw.c", |
- ] |
- if (is_android) { |
- defines = [ "HAVE_SYS_SOCKET_H" ] |
- } |
- if (is_clang) { |
- cflags = [ "-Wno-implicit-function-declaration" ] |
- } |
- } |
- |
- executable("srtp_test_cipher_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/cipher_driver.c", |
- "srtp/include/getopt_s.h", |
- "srtp/test/getopt_s.c", |
+ configs += [ |
+ ":libsrtp_config", |
+ ":srtp_test_config", |
] |
- } |
- |
- executable("srtp_test_datatypes_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
deps = [ |
":libsrtp", |
] |
sources = [ |
- "srtp/crypto/test/datatypes_driver.c", |
- ] |
- } |
+ "include/getopt_s.h", |
+ "test/getopt_s.c", |
+ "test/rtp.c", |
+ "test/rtpw.c", |
+ "test/util.c", |
+ "test/util.h", |
- executable("srtp_test_stat_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/stat_driver.c", |
+ # 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 |
} |
- executable("srtp_test_sha1_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
+ copy("rtpw_test_scripts") { |
sources = [ |
- "srtp/crypto/test/sha1_driver.c", |
- ] |
- } |
- |
- executable("srtp_test_kernel_driver") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
+ "test/rtpw_test.sh", |
+ "test/rtpw_test_gcm.sh", |
] |
- sources = [ |
- "srtp/crypto/test/kernel_driver.c", |
- "srtp/include/getopt_s.h", |
- "srtp/test/getopt_s.c", |
+ outputs = [ |
+ "$root_out_dir/{{source_file_part}}", |
] |
+ testonly = true |
} |
- executable("srtp_test_aes_calc") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
+ group("srtp_test_rtpw") { |
deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/aes_calc.c", |
- ] |
- } |
- |
- executable("srtp_test_rand_gen") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/rand_gen.c", |
- "srtp/include/getopt_s.h", |
- "srtp/test/getopt_s.c", |
- ] |
- } |
- |
- executable("srtp_test_rand_gen_soak") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/rand_gen_soak.c", |
- "srtp/include/getopt_s.h", |
- "srtp/test/getopt_s.c", |
+ ":rtpw", |
+ ":rtpw_test_scripts", |
] |
+ testonly = true |
} |
- |
- executable("srtp_test_env") { |
- configs -= [ "//build/config/compiler:chromium_code" ] |
- configs += [ "//build/config/compiler:no_chromium_code" ] |
- deps = [ |
- ":libsrtp", |
- ] |
- sources = [ |
- "srtp/crypto/test/env.c", |
- ] |
+} else { |
+ group("srtp_test_rtpw") { |
+ testonly = true |
} |
+} |
- group("srtp_runtest") { |
- deps = [ |
- ":rdbx_driver", |
- ":srtp_driver", |
- ":roc_driver", |
- ":replay_driver", |
- ":rtpw", |
- ":srtp_test_cipher_driver", |
- ":srtp_test_datatypes_driver", |
- ":srtp_test_stat_driver", |
- ":srtp_test_sha1_driver", |
- ":srtp_test_kernel_driver", |
- ":srtp_test_aes_calc", |
- ":srtp_test_rand_gen", |
- ":srtp_test_rand_gen_soak", |
- ":srtp_test_env", |
- ] |
- } |
+# Run with, e.g.: |
+# for a in out/Default/srtp_test_*; do |
+# echo $a |
+# "${a}" -v > /dev/null || "${a}" > /dev/null || echo $a FAILED |
+# done |
+ |
+group("srtp_tests") { |
+ deps = [ |
+ ":srtp_test_cipher_driver", |
+ ":srtp_test_datatypes_driver", |
+ ":srtp_test_dtls_srtp_driver", |
+ ":srtp_test_kernel_driver", |
+ ":srtp_test_rdbx_driver", |
+ ":srtp_test_replay_driver", |
+ ":srtp_test_roc_driver", |
+ ":srtp_test_rtpw", |
+ ":srtp_test_srtp_driver", |
+ ] |
+ testonly = true |
} |