Telegram-iOS/third-party/td/BUILD
Isaac 5962a563e4 feat: tgcalls CLI test tool with group SFU, video, and adaptation
Squashed buildout of the tgcalls testbench:

- CLI test tool with --mode p2p/reflector/group/group-churn,
  cross-version interop (--version, --version2), and quiet/summary output
- Linux toolchain + Docker multi-stage build, AWS Fargate mass test harness,
  local parallel mass test harness with signaling loss simulation
- SCTP writable gate, retransmission timer tuning, role-based handshake
- InstanceV2CompatImpl (PeerConnection backend with V2Impl signaling) and
  SignalingTranslator for v14.0.0 interop
- In-process Go/Pion SFU (ICE+DTLS+SRTP+SCTP per participant) with audio
  RTP forwarding, ActiveAudio/VideoSsrcs data channel broadcast, RTCP
  feedback path, and CGo c-archive integration
- GroupInstanceReferenceImpl (PeerConnection group-call) and mixed-impl
  group mode (--reference-participants), with SDP munging for simulcast
- H264 simulcast group video (FakeVideoTrackSource pattern generator,
  FakeVideoSink frame counting, --video flag, two-pass channel setup,
  reactive video setup from ActiveVideoSsrcs)
- Group churn stress mode (--mode group-churn, --churn-cycles)
- SFU stream-quality adaptation: BandwidthEstimator, LayerSelector
  state machine, RtxRingBuffer, simulcast SSRC rewrite
- Transport-cc feedback generation, NetworkSimulator (delay/jitter/loss/
  token-bucket bandwidth), --network-scenario step-down-up
- CLAUDE.md updates throughout

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 18:28:43 +02:00

155 lines
3.6 KiB
Text

load(
"//third-party/boringssl:BUILD.generated.bzl",
"crypto_headers",
)
headers = [
"td/e2e/e2e_api.h",
"td/e2e/e2e_errors.h",
]
libs = [
"tde2e",
"tdutils",
]
filegroup(
name = "td_sources",
srcs = glob([
"td/**/*"
]),
)
genrule(
name = "td_build",
srcs = [
"build-td-bazel.sh",
":td_sources",
"@cmake_tar_gz//file",
"//third-party/boringssl:crypto",
] + [
"//third-party/boringssl:{}".format(header) for header in crypto_headers
],
cmd_bash =
"""
set -ex
if [ "$(TARGET_CPU)" == "ios_arm64" ]; then
BUILD_ARCH="arm64"
elif [ "$(TARGET_CPU)" == "ios_sim_arm64" ]; then
BUILD_ARCH="sim_arm64"
elif [ "$(TARGET_CPU)" == "darwin_arm64" ]; then
BUILD_ARCH="macos_arm64"
else
echo "Unsupported architecture $(TARGET_CPU)"
fi
BUILD_DIR="$(RULEDIR)/build_$${BUILD_ARCH}"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake"
rm -rf "$$CMAKE_DIR"
mkdir -p "$$CMAKE_DIR"
tar -xzf "$(location @cmake_tar_gz//file)" -C "$$CMAKE_DIR"
OPENSSL_BASE_DIR="$$(pwd)/$$BUILD_DIR"
OPENSSL_DIR="$$OPENSSL_BASE_DIR/openssl"
rm -rf "$$OPENSSL_DIR"
mkdir -p "$$OPENSSL_DIR"
mkdir -p "$$OPENSSL_DIR/lib"
mkdir -p "$$OPENSSL_DIR/src/include/openssl"
mkdir -p "$$OPENSSL_DIR/src/include/openssl/experimental"
cp -R "$(location //third-party/boringssl:crypto)" "$$OPENSSL_DIR/lib/libcrypto.a"
# Copy header files
""" +
"\n".join([
"cp -f \"$(location //third-party/boringssl:{})\" \"$$OPENSSL_DIR/{}\"".format(header, header)
for header in crypto_headers
]) +
"""
cp $(location :build-td-bazel.sh) "$$BUILD_DIR/"
SOURCE_PATH="third-party/td/td"
cp -R "$$SOURCE_PATH" "$$BUILD_DIR/"
mkdir -p "$$BUILD_DIR/Public/td"
PATH="$$CMAKE_DIR/cmake-4.1.2-macos-universal/CMake.app/Contents/bin:$$PATH" sh $$BUILD_DIR/build-td-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/td" "$$BUILD_DIR" "$$OPENSSL_DIR"
""" +
"\n".join([
"cp -f \"$$BUILD_DIR/td/tde2e/{}\" \"$(location Public/td/{})\"".format(header, header) for header in headers
]) +
"\n" +
"\n".join([
"cp -f \"$$BUILD_DIR/build/tde2e/libtde2e.a\" \"$(location Public/td/lib/libtde2e.a)\"",
"cp -f \"$$BUILD_DIR/build/tdutils/libtdutils.a\" \"$(location Public/td/lib/libtdutils.a)\"",
]),
outs = [
"Public/td/" + x for x in headers
] +
[
"Public/td/lib/lib{}.a".format(x) for x in libs
],
visibility = [
"//visibility:public",
]
)
cc_library(
name = "td_lib",
srcs = [":Public/td/lib/lib" + x + ".a" for x in libs],
)
objc_library(
name = "td",
module_name = "td",
enable_modules = True,
hdrs = [":Public/td/" + x for x in headers],
includes = [
"Public/td",
],
deps = [
":td_lib",
"//third-party/boringssl:crypto",
],
visibility = [
"//visibility:public",
],
)
objc_library(
name = "TdBinding",
module_name = "TdBinding",
enable_modules = True,
srcs = glob([
"TdBinding/Sources/**/*.m",
"TdBinding/Sources/**/*.mm",
"TdBinding/Sources/**/*.h",
], allow_empty=True),
hdrs = glob([
"TdBinding/Public/**/*.h",
]),
copts = [
"-Werror",
],
cxxopts = [
"-Werror",
"-std=c++17",
],
includes = [
"TdBinding/Public",
],
deps = [
":td",
],
sdk_frameworks = [
],
visibility = [
"//visibility:public",
]
)