mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Build with both systems
This commit is contained in:
parent
763876773c
commit
e2fda3f9ef
@ -35,6 +35,7 @@ framework(
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/LegacyComponents:LegacyComponents",
|
||||
"//submodules/TgVoip:TgVoip",
|
||||
"//submodules/TgVoipWebrtc:TgVoipWebrtc",
|
||||
"//submodules/lottie-ios:Lottie",
|
||||
"//submodules/FFMpegBinding:FFMpegBinding",
|
||||
"//submodules/WebPBinding:WebPBinding",
|
||||
|
@ -12,6 +12,7 @@ static_library(
|
||||
"//submodules/Postbox:Postbox#shared",
|
||||
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
|
||||
"//submodules/TgVoip:TgVoip",
|
||||
"//submodules/TgVoipWebrtc:TgVoipWebrtc",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
|
@ -1,5 +1,36 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library", "glob_map", "glob_sub_map", "merge_maps")
|
||||
|
||||
replace_symbols = [
|
||||
"WebRtcAgc_Process",
|
||||
"rtc_FatalMessage",
|
||||
"WebRtcAgc_UpdateAgcThresholds",
|
||||
"WebRtcAgc_Init",
|
||||
"WebRtcAgc_GetAddFarendError",
|
||||
"WebRtcAgc_ZeroCtrl",
|
||||
"WebRtcAgc_SaturationCtrl",
|
||||
"WebRtcAgc_SpeakerInactiveCtrl",
|
||||
"WebRtcAgc_ProcessAnalog",
|
||||
"WebRtcAgc_set_config",
|
||||
"WebRtcAgc_get_config",
|
||||
"WebRtcAgc_ExpCurve",
|
||||
"WebRtcAgc_Create",
|
||||
"WebRtcAgc_Free",
|
||||
"WebRtcAgc_AddFarend",
|
||||
"WebRtcAgc_VirtualMic",
|
||||
"WebRtcAgc_AddMic",
|
||||
"WebRtcAgc_InitDigital",
|
||||
"WebRtcAgc_AddFarendToDigital",
|
||||
"WebRtcAgc_CalculateGainTable",
|
||||
"WebRtcAgc_InitVad",
|
||||
"WebRtcAgc_ProcessVad",
|
||||
"rtc",
|
||||
"webrtc",
|
||||
]
|
||||
|
||||
shared_compiler_flags = [
|
||||
"-DTGVOIP_INCLUDE_OPUS_PACKAGE",
|
||||
] + ["-D{symbol}={symbol}1".format(symbol=symbol) for symbol in replace_symbols]
|
||||
|
||||
static_library(
|
||||
name = "TgVoip",
|
||||
srcs = glob([
|
||||
@ -49,7 +80,7 @@ static_library(
|
||||
'-DWEBRTC_NS_FLOAT',
|
||||
'-DWEBRTC_IOS',
|
||||
'-DWEBRTC_HAS_NEON',
|
||||
]),
|
||||
] + shared_compiler_flags),
|
||||
('.*', [
|
||||
'-DTGVOIP_USE_CUSTOM_CRYPTO',
|
||||
'-DTGVOIP_USE_INSTALLED_OPUS',
|
||||
@ -58,7 +89,7 @@ static_library(
|
||||
'-DTGVOIP_HAVE_TGLOG',
|
||||
'-DWEBRTC_NS_FLOAT',
|
||||
'-DWEBRTC_IOS',
|
||||
]),
|
||||
] + shared_compiler_flags),
|
||||
],
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit a045c9eea47b371c0c514c72c76172a211c894cb
|
||||
Subproject commit dc4e9ec48207388e41db1c2ef1cccf9899d9765f
|
@ -5,64 +5,33 @@ static_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.m",
|
||||
"Sources/**/*.mm",
|
||||
"Sources/**/*.h",
|
||||
"libtgvoip/*.m",
|
||||
"libtgvoip/*.mm",
|
||||
"libtgvoip/*.cpp",
|
||||
"libtgvoip/audio/*.cpp",
|
||||
"libtgvoip/video/*.cpp",
|
||||
"libtgvoip/os/darwin/*.m",
|
||||
"libtgvoip/os/darwin/*.mm",
|
||||
"libtgvoip/os/darwin/*.cpp",
|
||||
"libtgvoip/os/posix/*.cpp",
|
||||
"libtgvoip/webrtc_dsp/**/*.c",
|
||||
"libtgvoip/webrtc_dsp/**/*.cc",
|
||||
"libtgvoip/webrtc_dsp/**/*.cpp",
|
||||
], exclude = ["libtgvoip/os/darwin/*OSX*"]),
|
||||
"Impl/*.cpp",
|
||||
]),
|
||||
has_cpp = True,
|
||||
headers = merge_maps([
|
||||
glob_sub_map("libtgvoip/", [
|
||||
"libtgvoip/*.h",
|
||||
"libtgvoip/*.hpp",
|
||||
"libtgvoip/audio/*.h",
|
||||
"libtgvoip/audio/*.hpp",
|
||||
"libtgvoip/video/*.h",
|
||||
"libtgvoip/video/*.hpp",
|
||||
glob_sub_map("PublicHeaders/", [
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
glob_sub_map("libtgvoip/", [
|
||||
"libtgvoip/os/darwin/*.h",
|
||||
], exclude = ["libtgvoip/os/darwin/*OSX*"]),
|
||||
glob_sub_map("libtgvoip/webrtc_dsp/", [
|
||||
"libtgvoip/webrtc_dsp/**/*.h",
|
||||
glob_sub_map("Impl/", [
|
||||
"Impl/*.h",
|
||||
]),
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
platform_compiler_flags = [
|
||||
('arm.*', [
|
||||
'-DTGVOIP_USE_CUSTOM_CRYPTO',
|
||||
'-DTGVOIP_USE_INSTALLED_OPUS',
|
||||
'-DWEBRTC_APM_DEBUG_DUMP=0',
|
||||
'-DWEBRTC_POSIX',
|
||||
'-DTGVOIP_HAVE_TGLOG',
|
||||
'-DWEBRTC_NS_FLOAT',
|
||||
'-DWEBRTC_IOS',
|
||||
'-DWEBRTC_HAS_NEON',
|
||||
]),
|
||||
('.*', [
|
||||
'-DTGVOIP_USE_CUSTOM_CRYPTO',
|
||||
'-DTGVOIP_USE_INSTALLED_OPUS',
|
||||
'-DWEBRTC_APM_DEBUG_DUMP=0',
|
||||
'-DWEBRTC_POSIX',
|
||||
'-DTGVOIP_HAVE_TGLOG',
|
||||
'-DWEBRTC_NS_FLOAT',
|
||||
'-DWEBRTC_IOS',
|
||||
]),
|
||||
compiler_flags = [
|
||||
"-Ithird-party/webrtc/webrtc-ios/src",
|
||||
"-Ithird-party/webrtc/webrtc-ios/src/third_party/abseil-cpp",
|
||||
"-Ithird-party/submodules/TgVoipWebrtc/PublicHeaders",
|
||||
"-DWEBRTC_IOS",
|
||||
"-DWEBRTC_MAC",
|
||||
"-DWEBRTC_POSIX",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
"//submodules/Opus:opus",
|
||||
"//submodules/openssl:openssl",
|
||||
"//third-party/webrtc:webrtc_lib",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
|
@ -20,8 +20,8 @@ objc_library(
|
||||
]),
|
||||
copts = [
|
||||
"-I{}/Impl".format(package_name()),
|
||||
"-Ithird-party/webrtc/webrtc-ios/src".format(package_name()),
|
||||
"-Ithird-party/webrtc/webrtc-ios/src/third_party/abseil-cpp".format(package_name()),
|
||||
"-Ithird-party/webrtc/webrtc-ios/src",
|
||||
"-Ithird-party/webrtc/webrtc-ios/src/third_party/abseil-cpp",
|
||||
"-DWEBRTC_IOS",
|
||||
"-DWEBRTC_MAC",
|
||||
"-DWEBRTC_POSIX",
|
||||
|
@ -1,4 +1,4 @@
|
||||
#import "TgVoip/OngoingCallThreadLocalContext.h"
|
||||
#import <TgVoip/OngoingCallThreadLocalContext.h>
|
||||
|
||||
#import "TgVoip.h"
|
||||
|
||||
|
@ -132,13 +132,28 @@ genrule(
|
||||
srcs = [
|
||||
"pack-openssl.sh",
|
||||
],
|
||||
bash = "sh $SRCDIR/pack-openssl.sh $OUT $(location :openssl_build_arm64)/out/include " + " ".join(["$(location :openssl_build_" + arch + ")/out/lib/libcrypto.a" for arch in archs]),
|
||||
bash = "sh $SRCDIR/pack-openssl.sh $OUT $(location :openssl_build_arm64)/out/include " +
|
||||
" ".join(["$(location :openssl_build_" + arch + ")/out/lib/libcrypto.a" for arch in archs]),
|
||||
out = "openssl",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
]
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "openssl_libssl_merged",
|
||||
srcs = [
|
||||
"pack-libssl.sh",
|
||||
],
|
||||
bash = "sh $SRCDIR/pack-libssl.sh $OUT $(location :openssl_build_arm64)/out/include " +
|
||||
" ".join(["$(location :openssl_build_" + arch + ")/out/lib/libssl.a" for arch in archs]),
|
||||
out = "libssl",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
openssl_header_targets = gen_header_targets(openssl_header_paths, "openssl_header_", "", "openssl_build_arm64", "out/include")
|
||||
|
||||
apple_library(
|
||||
@ -150,11 +165,15 @@ apple_library(
|
||||
exported_headers = openssl_header_targets,
|
||||
linker_flags = [
|
||||
"-L$(location :openssl_build_merged)/lib",
|
||||
"-L$(location :openssl_libssl_merged)/lib",
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
],
|
||||
exported_linker_flags = [
|
||||
"-L$(location :openssl_build_merged)/lib",
|
||||
"-L$(location :openssl_libssl_merged)/lib",
|
||||
"-lcrypto",
|
||||
"-lssl",
|
||||
],
|
||||
deps = [":openssl_build_" + arch for arch in ["arm64"]],
|
||||
)
|
||||
|
15
submodules/openssl/pack-libssl.sh
Normal file
15
submodules/openssl/pack-libssl.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
OUT_DIR="$1"
|
||||
INCLUDE_DIR="$2"
|
||||
shift
|
||||
shift
|
||||
LIBS="$@"
|
||||
|
||||
mkdir -p "$OUT_DIR/lib"
|
||||
|
||||
/usr/bin/lipo $LIBS -output "$OUT_DIR/lib/libssl.a" -create
|
||||
|
8
third-party/BUCK
vendored
8
third-party/BUCK
vendored
@ -0,0 +1,8 @@
|
||||
|
||||
filegroup(
|
||||
name = "depot_tools_sources",
|
||||
srcs = glob([
|
||||
"depot_tools/**/*"
|
||||
]),
|
||||
visibility = ["PUBLIC"],
|
||||
)
|
65
third-party/webrtc/BUCK
vendored
Normal file
65
third-party/webrtc/BUCK
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
webrtc_lib_flags = [
|
||||
"-lwebrtc"
|
||||
]
|
||||
|
||||
genrule(
|
||||
name = "webrtc_build",
|
||||
srcs = [
|
||||
"build-webrtc-buck.sh",
|
||||
"webrtc-ios",
|
||||
"patch.sh",
|
||||
],
|
||||
bash =
|
||||
"""
|
||||
set -x
|
||||
echo "SRCDIR=$SRCDIR"
|
||||
|
||||
OUT_DIR="ios"
|
||||
|
||||
BUILD_ARCH=arm64
|
||||
|
||||
BUILD_DIR="$SRCDIR/$BUILD_ARCH"
|
||||
rm -rf "$BUILD_DIR"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
mkdir -p "$BUILD_DIR/webrtc-ios"
|
||||
cp -R "$SRCDIR/webrtc-ios/.git" "$BUILD_DIR/webrtc-ios/.git"
|
||||
cp -R "$SRCDIR/webrtc-ios/src" "$BUILD_DIR/webrtc-ios/src"
|
||||
|
||||
DEPOT_TOOLS_PATH="$(location //third-party:depot_tools_sources)"
|
||||
|
||||
rm -rf "$BUILD_DIR/depot_tools"
|
||||
cp -R "$DEPOT_TOOLS_PATH" "$BUILD_DIR/"
|
||||
|
||||
cp "$SRCDIR/patch.sh" "$BUILD_DIR/"
|
||||
|
||||
rm -rf "$BUILD_DIR/openssl"
|
||||
cp -R "$(location //submodules/openssl:openssl_build_merged)" "$BUILD_DIR/openssl/"
|
||||
cp -R "$(location //submodules/openssl:openssl_libssl_merged)" "$BUILD_DIR/libssl/"
|
||||
|
||||
sh $SRCDIR/build-webrtc-buck.sh "$BUILD_DIR" $BUILD_ARCH
|
||||
|
||||
mkdir -p "$OUT"
|
||||
cp "$BUILD_DIR/webrtc-ios/src/out/$OUT_DIR/obj/libwebrtc.a" "$OUT/"
|
||||
""",
|
||||
out = "libwebrtc",
|
||||
visibility = ["PUBLIC"]
|
||||
)
|
||||
|
||||
apple_library(
|
||||
name = "webrtc_lib",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
linker_flags = [
|
||||
"-L$(location :webrtc_build)",
|
||||
] + webrtc_lib_flags,
|
||||
exported_linker_flags = [
|
||||
"-L$(location :webrtc_build)",
|
||||
] + webrtc_lib_flags,
|
||||
deps = [
|
||||
":webrtc_build"
|
||||
],
|
||||
)
|
33
third-party/webrtc/build-webrtc-buck.sh
vendored
Executable file
33
third-party/webrtc/build-webrtc-buck.sh
vendored
Executable file
@ -0,0 +1,33 @@
|
||||
#/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
BUILD_DIR="$1"
|
||||
ARCH="$2"
|
||||
|
||||
echo "BUILD_DIR=$BUILD_DIR"
|
||||
echo "ARCH=$ARCH"
|
||||
|
||||
export PATH="$PATH:$BUILD_DIR/depot_tools_sources/depot_tools"
|
||||
|
||||
rm -rf "$BUILD_DIR/webrtc-ios/src/openssl"
|
||||
cp -R "$BUILD_DIR/openssl" "$BUILD_DIR/webrtc-ios/src/"
|
||||
cp -R "$BUILD_DIR/libssl" "$BUILD_DIR/webrtc-ios/src/"
|
||||
|
||||
pushd "$BUILD_DIR/webrtc-ios/src"
|
||||
|
||||
mv openssl/lib/libcrypto.a openssl/
|
||||
mv libssl/lib/libssl.a openssl/
|
||||
|
||||
sh "../../patch.sh" || true
|
||||
|
||||
OUT_DIR="ios"
|
||||
if [ "$ARCH" == "x64" ]; then
|
||||
OUT_DIR="ios_sim"
|
||||
fi
|
||||
|
||||
gn gen out/$OUT_DIR --args="use_xcode_clang=true "" target_cpu=\"$ARCH\""' target_os="ios" is_debug=false is_component_build=false rtc_include_tests=false use_rtti=true rtc_use_x11=false use_custom_libcxx=false use_custom_libcxx_for_host=false rtc_include_builtin_video_codecs=false rtc_build_ssl=false rtc_build_examples=false rtc_build_tools=false ios_deployment_target="9.0" ios_enable_code_signing=false is_unsafe_developer_build=false rtc_enable_protobuf=false rtc_include_builtin_video_codecs=false rtc_use_gtk=false rtc_use_metal_rendering=false rtc_ssl_root="//openssl"'
|
||||
ninja -C out/$OUT_DIR webrtc
|
||||
|
||||
popd
|
2
third-party/webrtc/webrtc-ios
vendored
2
third-party/webrtc/webrtc-ios
vendored
@ -1 +1 @@
|
||||
Subproject commit 6774acc02feb905ee8209a2e187c8cc464c87289
|
||||
Subproject commit 8f607fdd6930223d8db1c8f0496c4cd3ab83be9a
|
Loading…
x
Reference in New Issue
Block a user