Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
From 929479648182b3e5b3a84c46065f7520146902f6 Mon Sep 17 00:00:00 2001
From: Ali <>
Date: Thu, 21 Apr 2022 18:10:43 +0400
Subject: [PATCH] Support arm simulator
---
build/make/configure.sh | 18 ++++++++++++++----
configure | 1 +
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/build/make/configure.sh b/build/make/configure.sh
index 581042e38..88dc80e92 100644
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -1117,9 +1117,14 @@ EOF
soft_enable unit_tests
;;
- darwin)
+ darwin|iphonesimulator)
if ! enabled external_build; then
- XCRUN_FIND="xcrun --sdk iphoneos --find"
+ sdk_platform_name="iphoneos"
+ if [ "${tgt_os}" == "iphonesimulator" ]; then
+ sdk_platform_name="iphonesimulator"
+ fi
+
+ XCRUN_FIND="xcrun --sdk $sdk_platform_name --find"
CXX="$(${XCRUN_FIND} clang++)"
CC="$(${XCRUN_FIND} clang)"
AR="$(${XCRUN_FIND} ar)"
@@ -1138,7 +1143,12 @@ EOF
add_cflags -arch ${tgt_isa}
add_ldflags -arch ${tgt_isa}
- alt_libc="$(show_darwin_sdk_path iphoneos)"
+ if [ "${tgt_os}" == "iphonesimulator" ]; then
+ add_cflags --target=arm64-apple-ios7.0-simulator
+ add_ldflags --target=arm64-apple-ios7.0-simulator
+ fi
+
+ alt_libc="$(show_darwin_sdk_path $sdk_platform_name)"
if [ -d "${alt_libc}" ]; then
add_cflags -isysroot ${alt_libc}
fi
@@ -1167,7 +1177,7 @@ EOF
;;
esac
- if [ "$(show_darwin_sdk_major_version iphoneos)" -gt 8 ]; then
+ if [ "$(show_darwin_sdk_major_version $sdk_platform_name)" -gt 8 ]; then
check_add_cflags -fembed-bitcode
check_add_asflags -fembed-bitcode
check_add_ldflags -fembed-bitcode
diff --git a/configure b/configure
index beea65032..f29c9f327 100755
--- a/configure
+++ b/configure
@@ -100,6 +100,7 @@ EOF
all_platforms="${all_platforms} arm64-android-gcc"
all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-darwin20-gcc"
+all_platforms="${all_platforms} arm64-iphonesimulator-gcc"
all_platforms="${all_platforms} arm64-darwin21-gcc"
all_platforms="${all_platforms} arm64-linux-gcc"
all_platforms="${all_platforms} arm64-win64-gcc"
--
2.32.0 (Apple Git-132)
+119
View File
@@ -0,0 +1,119 @@
headers = [
"vp8.h",
"vp8cx.h",
"vp8dx.h",
"vpx_codec.h",
"vpx_decoder.h",
"vpx_encoder.h",
"vpx_frame_buffer.h",
"vpx_image.h",
"vpx_integer.h",
"vpx_version.h",
"vpx_ext_ratectrl.h",
"vpx_tpl.h",
]
libs = [
"VPX",
]
filegroup(
name = "libvpx_sources",
srcs = glob([
"libvpx/**/*"
]),
)
genrule(
name = "libvpx_build",
srcs = [
"build-libvpx-bazel.sh",
"0001-Support-arm64-simulator.patch",
":libvpx_sources",
],
cmd_bash =
"""
set -ex
if [ "$(TARGET_CPU)" == "ios_armv7" ]; then
BUILD_ARCH="armv7"
PLATFORM_HEADER_DIR="armv7-darwin-gcc"
elif [ "$(TARGET_CPU)" == "ios_arm64" ]; then
BUILD_ARCH="arm64"
PLATFORM_HEADER_DIR="arm64-darwin-gcc"
elif [ "$(TARGET_CPU)" == "ios_sim_arm64" ]; then
BUILD_ARCH="sim_arm64"
PLATFORM_HEADER_DIR="arm64-iphonesimulator-gcc"
elif [ "$(TARGET_CPU)" == "ios_x86_64" ]; then
BUILD_ARCH="x86_64"
PLATFORM_HEADER_DIR="x86_64-iphonesimulator-gcc"
else
echo "Unsupported architecture $(TARGET_CPU)"
fi
BUILD_DIR="$(RULEDIR)/build_$${BUILD_ARCH}"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
YASM_DIR="$$BUILD_DIR/yasm"
rm -rf "$$YASM_DIR"
mkdir -p "$$YASM_DIR"
tar -xf "$(location //third-party/yasm:yasm.tar)" -C "$$YASM_DIR"
ABS_YASM_DIR="$$(pwd)/$$(dirname $$YASM_DIR)/$$(basename $$YASM_DIR)"
cp $(location :build-libvpx-bazel.sh) "$$BUILD_DIR/"
cp $(location :0001-Support-arm64-simulator.patch) "$$BUILD_DIR/"
SOURCE_PATH="third-party/libvpx/libvpx"
cp -R "$$SOURCE_PATH" "$$BUILD_DIR/"
pushd "$$BUILD_DIR/libvpx"
patch -p1 < ../0001-Support-arm64-simulator.patch
popd
mkdir -p "$$BUILD_DIR/Public/libvpx"
PATH="$$PATH:$$ABS_YASM_DIR" sh $$BUILD_DIR/build-libvpx-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/libvpx" "$$BUILD_DIR"
""" +
"\n".join([
"cp -f \"$$BUILD_DIR/VPX.framework/Headers/vpx/{}\" \"$(location Public/vpx/{})\"".format(header, header) for header in headers
]) +
"\n" +
"\n".join([
"cp -f \"$$BUILD_DIR/VPX.framework/{}\" \"$(location Public/vpx/lib{}.a)\"".format(lib, lib) for lib in libs
]) +
"\n" + "cp -f \"$$BUILD_DIR/VPX.framework/Headers/vpx/$$PLATFORM_HEADER_DIR/vpx_config.h\" \"$(location Public/vpx/vpx_config.h)\"",
outs = ["Public/vpx/" + x for x in headers] +
["Public/vpx/vpx_config.h"] +
["Public/vpx/lib{}.a".format(x) for x in libs],
tools = [
"//third-party/yasm:yasm.tar",
],
visibility = [
"//visibility:public",
]
)
cc_library(
name = "libvpx_lib",
srcs = [":Public/vpx/lib" + x + ".a" for x in libs],
)
objc_library(
name = "vpx",
module_name = "vpx",
enable_modules = True,
hdrs = [":Public/vpx/" + x for x in headers],
includes = [
"Public",
],
deps = [
":libvpx_lib",
],
visibility = [
"//visibility:public",
],
)
+182
View File
@@ -0,0 +1,182 @@
#! /bin/sh
set -e
set -x
ARCH="$1"
SOURCE_DIR=$(echo "$(cd "$(dirname "$2")"; pwd -P)/$(basename "$2")")
BUILD_DIR=$(echo "$(cd "$(dirname "$3")"; pwd -P)/$(basename "$3")")
pushd "$BUILD_DIR"
set -e
devnull='> /dev/null 2>&1'
BUILD_ROOT="_iosbuild"
CONFIGURE_ARGS="--disable-docs
--disable-examples
--disable-postproc
--disable-webm-io
--disable-vp9-highbitdepth
--disable-vp9-postproc
--disable-vp9-temporal-denoising
--disable-unit-tests
--enable-realtime-only
--enable-multi-res-encoding
--size-limit=8192x8192"
DIST_DIR="_dist"
FRAMEWORK_DIR="VPX.framework"
FRAMEWORK_LIB="VPX.framework/VPX"
HEADER_DIR="${FRAMEWORK_DIR}/Headers/vpx"
SCRIPT_DIR="$SOURCE_DIR"
LIBVPX_SOURCE_DIR="$SOURCE_DIR"
LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo)
ORIG_PWD="$(pwd)"
if [ "$ARCH" = "armv7" ]; then
TARGETS="armv7-darwin-gcc"
elif [ "$ARCH" = "arm64" ]; then
TARGETS="arm64-darwin-gcc"
elif [ "$ARCH" = "sim_arm64" ]; then
TARGETS="arm64-iphonesimulator-gcc"
elif [ "$ARCH" = "x86_64" ]; then
TARGETS="x86_64-iphonesimulator-gcc"
else
echo "Unsupported architecture $ARCH"
exit 1
fi
# Configures for the target specified by $1, and invokes make with the dist
# target using $DIST_DIR as the distribution output directory.
build_target() {
local target="$1"
local old_pwd="$(pwd)"
local target_specific_flags=""
case "${target}" in
x86-*)
target_specific_flags="--enable-pic"
;;
esac
mkdir "${target}"
cd "${target}"
eval "${LIBVPX_SOURCE_DIR}/configure" --target="${target}" \
${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS} ${target_specific_flags} \
export DIST_DIR
eval make dist
cd "${old_pwd}"
}
# Returns the preprocessor symbol for the target specified by $1.
target_to_preproc_symbol() {
target="$1"
case "${target}" in
arm64-*)
echo "__aarch64__"
;;
armv7-*)
echo "__ARM_ARCH_7A__"
;;
x86_64-*)
echo "__x86_64__"
;;
*)
echo "#error ${target} unknown/unsupported"
return 1
;;
esac
}
# Create a vpx_config.h shim that, based on preprocessor settings for the
# current target CPU, includes the real vpx_config.h for the current target.
# $1 is the list of targets.
create_vpx_framework_config_shim() {
local targets="$1"
local config_file="${HEADER_DIR}/vpx_config.h"
local preproc_symbol=""
local target=""
local include_guard="VPX_FRAMEWORK_HEADERS_VPX_VPX_CONFIG_H_"
local file_header="/*
* Copyright (c) The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/* GENERATED FILE: DO NOT EDIT! */
#ifndef ${include_guard}
#define ${include_guard}
#if defined"
printf "%s" "${file_header}" > "${config_file}"
for target in ${targets}; do
preproc_symbol=$(target_to_preproc_symbol "${target}")
printf " ${preproc_symbol}\n" >> "${config_file}"
printf "#define VPX_FRAMEWORK_TARGET \"${target}\"\n" >> "${config_file}"
printf "#include \"VPX/vpx/${target}/vpx_config.h\"\n" >> "${config_file}"
printf "#elif defined" >> "${config_file}"
mkdir "${HEADER_DIR}/${target}"
cp -p "${BUILD_ROOT}/${target}/vpx_config.h" "${HEADER_DIR}/${target}"
done
# Consume the last line of output from the loop: We don't want it.
sed -i.bak -e '$d' "${config_file}"
rm "${config_file}.bak"
printf "#endif\n\n" >> "${config_file}"
printf "#endif // ${include_guard}" >> "${config_file}"
}
# Configures and builds each target specified by $1, and then builds
# VPX.framework.
build_framework() {
local lib_list=""
local targets="$1"
local target=""
local target_dist_dir=""
# Clean up from previous build(s).
rm -rf "${BUILD_ROOT}" "${FRAMEWORK_DIR}"
# Create output dirs.
mkdir -p "${BUILD_ROOT}"
mkdir -p "${HEADER_DIR}"
cd "${BUILD_ROOT}"
for target in ${targets}; do
build_target "${target}"
target_dist_dir="${BUILD_ROOT}/${target}/${DIST_DIR}"
local suffix="a"
lib_list="${lib_list} ${target_dist_dir}/lib/libvpx.${suffix}"
done
cd "${ORIG_PWD}"
# The basic libvpx API includes are all the same; just grab the most recent
# set.
cp -p "${target_dist_dir}"/include/vpx/* "${HEADER_DIR}"
# Build the fat library.
${LIPO} -create ${lib_list} -output ${FRAMEWORK_DIR}/VPX
# Create the vpx_config.h shim that allows usage of vpx_config.h from
# within VPX.framework.
create_vpx_framework_config_shim "${targets}"
# Copy in vpx_version.h.
cp -p "${BUILD_ROOT}/${target}/vpx_version.h" "${HEADER_DIR}"
}
build_framework "${TARGETS}"
popd
Vendored Submodule
+1