Skip to content

Commit

Permalink
Adjusted dependencies scripts for macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Dec 7, 2024
1 parent 6c19180 commit ae35770
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
5 changes: 3 additions & 2 deletions TMessagesProj/jni/build_ffmpeg_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -e
function build_one {
echo "Building ${ARCH}..."

LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}"
LLVM_BIN="${LLVM_PREFIX}/bin"

PREBUILT=${NDK}/toolchains/${PREBUILT_ARCH}${PREBUILT_MIDDLE}-${VERSION}/prebuilt/${BUILD_PLATFORM}
PLATFORM=${NDK}/platforms/android-${ANDROID_API}/arch-${ARCH}

Expand Down Expand Up @@ -153,8 +156,6 @@ checkPreRequisites
cd ffmpeg

## common
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/linux-x86_64"
LLVM_BIN="${LLVM_PREFIX}/bin"
VERSION="4.9"

function build {
Expand Down
17 changes: 13 additions & 4 deletions TMessagesProj/jni/build_libvpx_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ function build_one {
export CXX=${CC_PREFIX}clang++
export AS=${CC_PREFIX}clang++
export CROSS_PREFIX=${PREBUILT}/bin/${ARCH_NAME}-linux-${BIN_MIDDLE}-



export ISYSTEM="-isystem ${LLVM_PREFIX}/sysroot/usr/include/${ARCH_NAME}-linux-${BIN_MIDDLE} -isystem ${LLVM_PREFIX}/sysroot/usr/include"
export EXTRA_CFLAGS="--extra-cflags=\"${ISYSTEM}\""

export CFLAGS="-DANDROID -fpic -fpie ${OPTIMIZE_CFLAGS}"
if [ "no" = ${SUPPORT_EXTRA_FLAGS} ]; then
export CFLAGS="-DANDROID -fpic -fpie ${OPTIMIZE_CFLAGS} ${ISYSTEM}"
export EXTRA_CFLAGS=""
fi
export CPPFLAGS="${CFLAGS}"
export CXXFLAGS="${CFLAGS} -std=c++11"
export ASFLAGS="-D__ANDROID__"
Expand All @@ -40,7 +46,7 @@ function build_one {


./configure \
--extra-cflags="-isystem ${LLVM_PREFIX}/sysroot/usr/include/${ARCH_NAME}-linux-${BIN_MIDDLE} -isystem ${LLVM_PREFIX}/sysroot/usr/include" \
${EXTRA_CFLAGS} \
--libc="${LLVM_PREFIX}/sysroot" \
--prefix=${PREFIX} \
--target=${TARGET} \
Expand Down Expand Up @@ -83,15 +89,18 @@ function setCurrentPlatform {
Darwin*)
BUILD_PLATFORM=darwin-x86_64
COMPILATION_PROC_COUNT=`sysctl -n hw.physicalcpu`
SUPPORT_EXTRA_FLAGS=no
;;
Linux*)
BUILD_PLATFORM=linux-x86_64
COMPILATION_PROC_COUNT=$(nproc)
SUPPORT_EXTRA_FLAGS=yes
;;
*)
echo -e "\033[33mWarning! Unknown platform ${CURRENT_PLATFORM}! falling back to linux-x86_64\033[0m"
BUILD_PLATFORM=linux-x86_64
COMPILATION_PROC_COUNT=1
SUPPORT_EXTRA_FLAGS=yes
;;
esac

Expand Down Expand Up @@ -120,7 +129,7 @@ checkPreRequisites
cd libvpx

## common
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/linux-x86_64"
LLVM_PREFIX="${NDK}/toolchains/llvm/prebuilt/${BUILD_PLATFORM}"
LLVM_BIN="${LLVM_PREFIX}/bin"
VERSION="4.9"
ANDROID_API=21
Expand Down
8 changes: 7 additions & 1 deletion TMessagesProj/jni/patch_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ patch -d ffmpeg -p1 < patches/ffmpeg/0001-compilation-magic.patch
patch -d ffmpeg -p1 < patches/ffmpeg/0002-compilation-magic-2.patch

function cp {
install -D $@
CURRENT_PLATFORM="$(uname -s)"
if [ "Darwin" = ${CURRENT_PLATFORM} ]; then
mkdir -p $(dirname $2)
install $@
else
install -D $@
fi
}

cp ffmpeg/libavformat/dv.h ffmpeg/build/arm64-v8a/include/libavformat/dv.h
Expand Down

0 comments on commit ae35770

Please sign in to comment.