Fix buck project

This commit is contained in:
Ali 2020-06-17 19:42:03 +04:00
parent d1da4e2c65
commit 1afb687cd7
6 changed files with 10 additions and 90 deletions

View File

@ -1,5 +1,7 @@
load("//Config:buck_rule_macros.bzl", "static_library", "glob_map", "glob_sub_map", "merge_maps")
webrtc_include_prefix = "-I../../" if native.read_config("custom", "mode") == "project" else "-I"
static_library(
name = "TgVoipWebrtc",
srcs = glob([
@ -22,12 +24,12 @@ static_library(
"PublicHeaders/**/*.h",
]),
compiler_flags = [
"-Ithird-party/webrtc/webrtc-ios/src",
"-Ithird-party/webrtc/webrtc-ios/src/third_party/abseil-cpp",
"-Ithird-party/webrtc/webrtc-ios/src/sdk/objc",
"-Ithird-party/webrtc/webrtc-ios/src/sdk/objc/base",
"-Ithird-party/webrtc/webrtc-ios/src/sdk/objc/components/renderer/metal",
"-Ithird-party/submodules/TgVoipWebrtc/PublicHeaders",
webrtc_include_prefix + "third-party/webrtc/webrtc-ios/src",
webrtc_include_prefix + "third-party/webrtc/webrtc-ios/src/third_party/abseil-cpp",
webrtc_include_prefix + "third-party/webrtc/webrtc-ios/src/sdk/objc",
webrtc_include_prefix + "third-party/webrtc/webrtc-ios/src/sdk/objc/base",
webrtc_include_prefix + "third-party/webrtc/webrtc-ios/src/sdk/objc/components/renderer/metal",
webrtc_include_prefix + "third-party/submodules/TgVoipWebrtc/PublicHeaders",
"-DWEBRTC_IOS",
"-DWEBRTC_MAC",
"-DWEBRTC_POSIX",

View File

@ -9,7 +9,6 @@ genrule(
srcs = [
"build-webrtc-buck.sh",
"webrtc-ios",
"patch.sh",
],
bash =
"""
@ -33,8 +32,6 @@ genrule(
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/"

View File

@ -15,7 +15,6 @@ genrule(
name = "webrtc_build",
srcs = [
"build-webrtc-bazel.sh",
"patch.sh",
":webrtc_sources",
"//third-party:depot_tools_sources",
"//submodules/openssl:openssl_include",
@ -36,7 +35,7 @@ genrule(
echo "Unsupported architecture $(TARGET_CPU)"
fi
BUILD_DIR="$(RULEDIR)/$$BUILD_ARCH"
#rm -rf "$$BUILD_DIR"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
SOURCE_PATH="third-party/webrtc/webrtc-ios/src"
@ -62,9 +61,6 @@ genrule(
rm -f "$$BUILD_DIR/build-webrtc-bazel.sh"
cp $(location build-webrtc-bazel.sh) "$$BUILD_DIR/"
rm -f "$$BUILD_DIR/patch.sh"
cp $(location patch.sh) "$$BUILD_DIR/"
sh $$BUILD_DIR/build-webrtc-bazel.sh "$$BUILD_DIR" $$BUILD_ARCH
""" + "\n".join([
"cp -f $$BUILD_DIR/src/out/$$OUT_DIR/obj/sdk/libframework_objc_static.a $(location {lib})".format(lib=lib) for lib in webrtc_libs

View File

@ -16,14 +16,12 @@ cp -R "$BUILD_DIR/openssl" "$BUILD_DIR/src/"
pushd "$BUILD_DIR/src"
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_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=true rtc_build_libvpx=true rtc_libvpx_build_vp9=true rtc_use_gtk=false rtc_use_metal_rendering=true'
buildtools/mac/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_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=true rtc_build_libvpx=true rtc_libvpx_build_vp9=true rtc_use_gtk=false rtc_use_metal_rendering=true'
ninja -C out/$OUT_DIR framework_objc_static
popd

View File

@ -20,8 +20,6 @@ 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"

View File

@ -1,71 +0,0 @@
#!/bin/sh
PATCH=$(cat <<-END
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -23,7 +23,11 @@ if (!rtc_build_ssl) {
config("external_ssl_library") {
assert(rtc_ssl_root != "",
"You must specify rtc_ssl_root when rtc_build_ssl==0.")
- include_dirs = [ rtc_ssl_root ]
+ include_dirs = [ "\$rtc_ssl_root/include" ]
+ libs = [
+ "\$rtc_ssl_root/libssl.a",
+ "\$rtc_ssl_root/libcrypto.a"
+ ]
}
}
--- a/third_party/usrsctp/BUILD.gn
+++ b/third_party/usrsctp/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/toolchain/toolchain.gni")
+import("//webrtc.gni")
config("usrsctp_config") {
include_dirs = [
@@ -140,7 +141,9 @@ static_library("usrsctp") {
if (is_fuchsia) {
defines += [ "__Userspace_os_Fuchsia" ]
}
- deps = [
- "//third_party/boringssl",
- ]
+ if (rtc_build_ssl) {
+ deps += [ "//third_party/boringssl" ]
+ } else {
+ configs += [ "//rtc_base:external_ssl_library" ]
+ }
}
--- a/third_party/libsrtp/BUILD.gn
+++ b/third_party/libsrtp/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//testing/test.gni")
+import("//webrtc.gni")
declare_args() {
# Tests may not be appropriate for some build environments, e.g. Windows.
@@ -114,9 +115,11 @@ static_library("libsrtp") {
"srtp/ekt.c",
"srtp/srtp.c",
]
- public_deps = [
- "//third_party/boringssl:boringssl",
- ]
+ if (rtc_build_ssl) {
+ public_deps = [ "//third_party/boringssl" ]
+ } else {
+ configs += [ "//rtc_base:external_ssl_library" ]
+ }
}
if (build_libsrtp_tests) {
END
)
echo "$PATCH" | patch -p1