mirror of
git://code.qt.io/qt/qt5.git
synced 2026-04-19 19:46:16 +08:00
Fix FFmpeg provisioning for Android in arm64, x86 and x86_64
Added install-ffmpeg-android script for the android cross-compile Removed android stuff from install-ffmpeg Changed the yaml variables to include the target arch Added the arm64 target arch Task-number: QTQAINFRA-5476 Pick-to: 6.5 Change-Id: Id9609ed0427f2fc42f7f27e7787a81ad145f59be Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
This commit is contained in:
@@ -48,26 +48,9 @@ source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh"
|
||||
# shellcheck source=../unix/SetEnvVar.sh
|
||||
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
|
||||
|
||||
function SourceEnvVar {
|
||||
echo "Source environment variables file"
|
||||
if [ uname -a | grep -q "Ubuntu" ];
|
||||
then
|
||||
if [ lsb_release -a | grep "Ubuntu 22.04" ];
|
||||
then source ~/.bashrc
|
||||
else source ~/.profile
|
||||
fi
|
||||
else
|
||||
source ~/.bashrc
|
||||
source ~/.zshrc
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
version="n6.0"
|
||||
url_public="https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$version.tar.gz"
|
||||
sha1="78435ec71cc2227017a99c030e858719b8c7c74d"
|
||||
|
||||
|
||||
url_cached="http://ci-files01-hki.intra.qt.io/input/ffmpeg/$version.tar.gz"
|
||||
ffmpeg_name="FFmpeg-$version"
|
||||
|
||||
@@ -94,8 +77,7 @@ build_ffmpeg() {
|
||||
then prefix="/usr/local/$ffmpeg_name"
|
||||
fi
|
||||
|
||||
# android configures its own toolchain, it does not use the system clang
|
||||
if [ -n "$arch" ] && [ "$os" != "android" ]
|
||||
if [ -n "$arch" ]
|
||||
then cc="clang -arch $arch"
|
||||
fi
|
||||
|
||||
@@ -107,36 +89,6 @@ build_ffmpeg() {
|
||||
popd
|
||||
}
|
||||
|
||||
build_ffmpeg_android() {
|
||||
SourceEnvVar
|
||||
target_arch=$1
|
||||
target_dir=$2
|
||||
|
||||
if [ "$target_arch" == "x86_64" ];
|
||||
then
|
||||
#emulador on CI is x86_64
|
||||
target_toolchain_arch="x86_64-linux-android"
|
||||
target_arch=x86_64
|
||||
target_cpu=x86_64
|
||||
else
|
||||
#emulador on CI is x86
|
||||
target_toolchain_arch="i686-linux-android"
|
||||
target_arch=x86
|
||||
target_cpu=i686
|
||||
fi
|
||||
|
||||
api_version=24
|
||||
|
||||
toolchain=${ANDROID_NDK_ROOT_DEFAULT}/toolchains/llvm/prebuilt/${ANDROID_NDK_HOST}
|
||||
toolchain_bin=${toolchain}/bin
|
||||
sysroot=${toolchain}/sysroot
|
||||
cxx=${toolchain_bin}/${target_toolchain_arch}${api_version}-clang++
|
||||
cc=${toolchain_bin}/${target_toolchain_arch}${api_version}-clang
|
||||
|
||||
ffmpeg_config_options+=" --disable-vulkan --target-os=android --enable-jni --enable-mediacodec --enable-pthreads --enable-neon --disable-asm --cpu=${target_cpu} --disable-indev=android_camera --sysroot=${sysroot} --sysinclude=${sysroot}/usr/include/ --cc=${cc} --cxx=${cxx}"
|
||||
build_ffmpeg ${target_arch} ${target_dir}
|
||||
}
|
||||
|
||||
if [ "$os" == "linux" ]; then
|
||||
ffmpeg_config_options="$ffmpeg_config_options --enable-openssl"
|
||||
build_ffmpeg
|
||||
@@ -159,39 +111,5 @@ elif [ "$os" == "macos-universal" ]; then
|
||||
sudo "${BASH_SOURCE%/*}/../macos/makeuniversal.sh" "$ffmpeg_source_dir/build/arm64/installed" "$ffmpeg_source_dir/build/x86_64/installed"
|
||||
SetEnvVar "FFMPEG_DIR" "/usr/local/$ffmpeg_name"
|
||||
|
||||
elif [ "$os" == "android" ]; then
|
||||
|
||||
SourceEnvVar
|
||||
|
||||
url_cached=""
|
||||
url_public=""
|
||||
sha1=""
|
||||
|
||||
#get emulator target arch
|
||||
if [ "$ANDROID_EMULATOR" == *"x86_64"* ];
|
||||
then
|
||||
target_arch=x86_64
|
||||
sha1="0241fd483c16f4ce53206b911214b06854cdef9d"
|
||||
url_cached="http://ci-files01-hki.intra.qt.io/input/ffmpeg/android-ffmpeg-x86_64.zip"
|
||||
target_dir="/opt/android/$ffmpeg_name/ffmpeg-x86_64"
|
||||
else
|
||||
target_arch=x86
|
||||
url_cached="http://ci-files01-hki.intra.qt.io/input/ffmpeg/android-ffmpeg-x86.zip"
|
||||
sha1="8b254e31411a350edb581bb30e31401866abbe7d"
|
||||
target_dir="/opt/android/$ffmpeg_name/ffmpeg-x86"
|
||||
fi
|
||||
|
||||
app_prefix=""
|
||||
|
||||
#try install a pre-build
|
||||
InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir" "$app_prefix"
|
||||
|
||||
#if could not install pre-build, build it
|
||||
if [ ! -d "$target_dir" ];
|
||||
then build_ffmpeg_android "$target_arch" "$target_dir"
|
||||
fi
|
||||
|
||||
#set the var to use in yaml
|
||||
SetEnvVar "FFMPEG_DIR_ANDROID" "$target_dir"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user