From 06a49f02bde1690d676c3dfc3c302899f4afa7b7 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 22 Aug 2024 11:52:33 -0700 Subject: [PATCH] build: add options to configure libsrtp for boringssl or other libraries Depends on https://webrtc-review.googlesource.com/c/src/+/359928 BUG=webrtc:42234521,webrtc:42224104 Change-Id: I0d6335aa5fb3f090c781bed234ed34d6c98ec299 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359928 Reviewed-by: Mirko Bonadei Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#42857} --- BUILD.gn | 12 ++++++++++++ build_overrides/build.gni | 2 +- pc/BUILD.gn | 23 +++++++++++++++++++++-- rtc_base/BUILD.gn | 22 +++++----------------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 64cd32ab05..2bf28cc016 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -512,6 +512,18 @@ config("common_objc") { frameworks = [ "Foundation.framework" ] } +if (!rtc_build_ssl) { + config("external_ssl_library") { + if (rtc_ssl_root != "") { + include_dirs = [ rtc_ssl_root ] + } + libs = [ + "crypto", + "ssl", + ] + } +} + if (!build_with_chromium) { # Target to build all the WebRTC production code. rtc_static_library("webrtc") { diff --git a/build_overrides/build.gni b/build_overrides/build.gni index 33a535525e..88b7ac3d38 100644 --- a/build_overrides/build.gni +++ b/build_overrides/build.gni @@ -12,7 +12,7 @@ enable_java_templates = true # Enables assertions on safety checks in libc++. enable_safe_libcxx = true -# Don't set this variable to true when building stadalone WebRTC, it is +# Don't set this variable to true when building standalone WebRTC, it is # only needed to support both WebRTC standalone and Chromium builds. build_with_chromium = false diff --git a/pc/BUILD.gn b/pc/BUILD.gn index 6f2fb90f1b..fd60ce2505 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -34,6 +34,13 @@ if (is_android) { import("//build/config/android/rules.gni") } +if (rtc_build_libsrtp) { + import("//third_party/libsrtp/options.gni") + assert(rtc_build_ssl == libsrtp_build_boringssl, + "Mismatch ssl build settings detected") + assert(rtc_ssl_root == libsrtp_ssl_root, "Mismatch in ssl root detected") +} + group("pc") { deps = [ ":rtc_pc" ] } @@ -178,6 +185,10 @@ rtc_source_set("external_hmac") { ] if (rtc_build_libsrtp) { deps += [ "//third_party/libsrtp" ] + configs = [] + if (!rtc_build_ssl) { + configs += [ "..:external_ssl_library" ] + } } } @@ -613,6 +624,10 @@ rtc_source_set("srtp_session") { ] if (rtc_build_libsrtp) { deps += [ "//third_party/libsrtp" ] + configs = [] + if (!rtc_build_ssl) { + configs += [ "..:external_ssl_library" ] + } } } rtc_source_set("srtp_transport") { @@ -1991,8 +2006,6 @@ if (rtc_include_tests && !build_with_chromium) { "video_rtp_receiver_unittest.cc", ] - include_dirs = [ "//third_party/libsrtp/srtp" ] - if (is_win) { libs = [ "strmiids.lib" ] } @@ -2100,8 +2113,14 @@ if (rtc_include_tests && !build_with_chromium) { "//third_party/abseil-cpp/absl/types:optional", ] + include_dirs = [] + configs = [] if (rtc_build_libsrtp) { + include_dirs += [ "//third_party/libsrtp/srtp" ] deps += [ "//third_party/libsrtp" ] + if (!rtc_build_ssl) { + configs += [ "..:external_ssl_library" ] + } } if (is_android) { diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 4743a46d9d..4e06cdd45e 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -13,18 +13,6 @@ if (is_android) { import("//build/config/android/rules.gni") } -if (!rtc_build_ssl) { - config("external_ssl_library") { - if (rtc_ssl_root != "") { - include_dirs = [ rtc_ssl_root ] - } - libs = [ - "crypto", - "ssl", - ] - } -} - rtc_source_set("protobuf_utils") { sources = [ "protobuf_utils.h" ] if (rtc_enable_protobuf) { @@ -1504,7 +1492,7 @@ rtc_source_set("digest") { if (rtc_build_ssl) { deps += [ "//third_party/boringssl" ] } else { - configs += [ ":external_ssl_library" ] + configs += [ "..:external_ssl_library" ] } } @@ -1526,7 +1514,7 @@ rtc_library("crypto_random") { if (rtc_build_ssl) { deps += [ "//third_party/boringssl" ] } else { - configs += [ ":external_ssl_library" ] + configs += [ "..:external_ssl_library" ] } } @@ -1591,7 +1579,7 @@ rtc_library("ssl") { ] deps += [ ":crypto_random" ] - configs += [ ":external_ssl_library" ] + configs += [ "..:external_ssl_library" ] } if (build_with_chromium) { @@ -1653,7 +1641,7 @@ rtc_library("ssl_adapter") { if (rtc_build_ssl) { deps += [ "//third_party/boringssl" ] } else { - configs += [ ":external_ssl_library" ] + configs += [ "..:external_ssl_library" ] } } @@ -2211,7 +2199,7 @@ if (rtc_include_tests) { if (rtc_build_ssl) { deps += [ "//third_party/boringssl" ] } else { - configs += [ ":external_ssl_library" ] + configs += [ "..:external_ssl_library" ] } } }