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
+80
View File
@@ -0,0 +1,80 @@
headers = [
"opus.h",
"opus_defines.h",
"opus_multistream.h",
"opus_projection.h",
"opus_types.h",
]
libs = [
"opus",
]
genrule(
name = "opus_build",
srcs = [
"build-opus-bazel.sh",
"opus-1.5.1.tar.gz",
],
cmd_bash =
"""
set -ex
if [ "$(TARGET_CPU)" == "ios_armv7" ]; then
BUILD_ARCH="armv7"
elif [ "$(TARGET_CPU)" == "ios_arm64" ]; then
BUILD_ARCH="arm64"
elif [ "$(TARGET_CPU)" == "ios_sim_arm64" ]; then
BUILD_ARCH="sim_arm64"
elif [ "$(TARGET_CPU)" == "ios_x86_64" ]; then
BUILD_ARCH="x86_64"
else
echo "Unsupported architecture $(TARGET_CPU)"
fi
BUILD_DIR="$(RULEDIR)/build_$${BUILD_ARCH}"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
cp $(location :build-opus-bazel.sh) "$$BUILD_DIR/"
cp $(location :opus-1.5.1.tar.gz) "$$BUILD_DIR/"
mkdir -p "$$BUILD_DIR/Public/opus"
sh $$BUILD_DIR/build-opus-bazel.sh $$BUILD_ARCH "$$BUILD_DIR" opus-1.5.1.tar.gz
""" +
"\n".join([
"cp -f \"$$BUILD_DIR/built/include/opus/{}\" \"$(location Public/opus/{})\"".format(header, header) for header in headers
]) +
"\n" +
"\n".join([
"cp -f \"$$BUILD_DIR/built/lib/lib{}.a\" \"$(location Public/opus/lib/lib{}.a)\"".format(lib, lib) for lib in libs
]),
outs = ["Public/opus/" + x for x in headers] +
["Public/opus/lib/lib{}.a".format(x) for x in libs],
visibility = [
"//visibility:public",
]
)
cc_library(
name = "opus_lib",
srcs = [":Public/opus/lib/lib" + x + ".a" for x in libs],
)
objc_library(
name = "opus",
module_name = "opus",
enable_modules = True,
hdrs = [":Public/opus/" + x for x in headers],
includes = [
"Public",
],
deps = [
":opus_lib",
],
visibility = [
"//visibility:public",
],
)
+55
View File
@@ -0,0 +1,55 @@
#! /bin/sh
set -ex
ARCH="$1"
BUILD_DIR=$(echo "$(cd "$(dirname "$2")"; pwd -P)/$(basename "$2")")
SOURCE_CODE_ARCHIVE="$3"
MINIOSVERSION="13.0"
OPT_CFLAGS="-Os -g"
OPT_LDFLAGS=""
OPT_CONFIG_ARGS=""
DEVELOPER=`xcode-select -print-path`
OUTPUTDIR="$BUILD_DIR/Public"
# where we will keep our sources and build from.
SRCDIR="${BUILD_DIR}/src"
mkdir -p $SRCDIR
# where we will store intermediary builds
INTERDIR="${BUILD_DIR}/built"
mkdir -p $INTERDIR
########################################
tar zxf "$BUILD_DIR/$SOURCE_CODE_ARCHIVE" -C $SRCDIR
cd "${SRCDIR}/opus-"*
if [ "${ARCH}" == "x86_64" ]; then
PLATFORM="iphonesimulator"
EXTRA_CFLAGS="-arch ${ARCH}"
EXTRA_CONFIG="--host=x86_64-apple-darwin"
elif [ "${ARCH}" == "sim_arm64" ]; then
PLATFORM="iphonesimulator"
EXTRA_CFLAGS="-arch arm64 --target=arm64-apple-ios$MINIOSVERSION-simulator"
EXTRA_CONFIG="--host=arm-apple-darwin20"
else
PLATFORM="iphoneos"
EXTRA_CFLAGS="-arch ${ARCH}"
EXTRA_CONFIG="--host=arm-apple-darwin"
fi
SDK_PATH="$(xcrun --sdk $PLATFORM --show-sdk-path 2>/dev/null)"
mkdir -p "${INTERDIR}"
./configure --disable-shared --enable-static --with-pic --disable-extra-programs --disable-doc --disable-asm --enable-intrinsics ${EXTRA_CONFIG} \
--prefix="${INTERDIR}" \
LDFLAGS="$LDFLAGS ${OPT_LDFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -L${OUTPUTDIR}/lib" \
CFLAGS="$CFLAGS ${EXTRA_CFLAGS} ${OPT_CFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -I${OUTPUTDIR}/include -isysroot ${SDK_PATH}" \
make -j
make install
Binary file not shown.