mirror of
git://code.qt.io/qt/qt5.git
synced 2026-05-04 02:07:48 +08:00
Decouple install-ffmpeg on linux and macos specific files
The FFmpeg building flow has become too different on linux and macos. Decoupling the logic makes it more simple to follow. The CR also fixes nits and shellcheck warnings in install-ffmpeg. Pick-to: 6.8 6.9 Change-Id: I28639d28c7210809e52ff18ce612da52f8754285 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
This commit is contained in:
66
coin/provisioning/common/macos/install-ffmpeg-macos.sh
Executable file
66
coin/provisioning/common/macos/install-ffmpeg-macos.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
# This script builds and installs FFmpeg shared libs
|
||||
|
||||
set -ex
|
||||
|
||||
os="$1"
|
||||
|
||||
if [ "$os" != "macos" ] && [ "$os" != "macos-universal" ]; then
|
||||
>&2 echo "invalid os paremeter: $os"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "${BASH_SOURCE%/*}/../unix/ffmpeg-installation-utils.sh"
|
||||
|
||||
ffmpeg_source_dir=$(download_ffmpeg)
|
||||
ffmpeg_name=$(basename "$ffmpeg_source_dir")
|
||||
ffmpeg_config_options=$(get_ffmpeg_config_options "shared")
|
||||
prefix="/usr/local/$ffmpeg_name"
|
||||
|
||||
build_ffmpeg() {
|
||||
local arch="$1"
|
||||
local build_dir="$ffmpeg_source_dir/build/$arch"
|
||||
mkdir -p "$build_dir"
|
||||
pushd "$build_dir"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if [ -n "$arch" ]; then
|
||||
local cc="clang -arch $arch"
|
||||
"$ffmpeg_source_dir/configure" $ffmpeg_config_options --prefix="$prefix" --enable-cross-compile --arch="$arch" --cc="$cc"
|
||||
else
|
||||
"$ffmpeg_source_dir/configure" $ffmpeg_config_options --prefix="$prefix"
|
||||
fi
|
||||
# shellcheck disable=
|
||||
|
||||
make install DESTDIR="$build_dir/installed" -j4
|
||||
popd
|
||||
}
|
||||
|
||||
brew install yasm
|
||||
export MACOSX_DEPLOYMENT_TARGET=12
|
||||
fix_relative_dependencies="${BASH_SOURCE%/*}/../macos/fix_relative_dependencies.sh"
|
||||
|
||||
if [ "$os" == "macos" ]; then
|
||||
build_ffmpeg
|
||||
|
||||
install_dir="$ffmpeg_source_dir/build/installed"
|
||||
"$fix_relative_dependencies" "$install_dir/usr/local/$ffmpeg_name/lib"
|
||||
sudo mv "$install_dir/usr/local/$ffmpeg_name" "/usr/local"
|
||||
else
|
||||
build_ffmpeg "arm64"
|
||||
build_ffmpeg "x86_64"
|
||||
|
||||
arm64_install_dir="$ffmpeg_source_dir/build/arm64/installed"
|
||||
x86_64_install_dir="$ffmpeg_source_dir/build/x86_64/installed"
|
||||
|
||||
"$fix_relative_dependencies" "$arm64_install_dir/usr/local/$ffmpeg_name/lib"
|
||||
"$fix_relative_dependencies" "$x86_64_install_dir/usr/local/$ffmpeg_name/lib"
|
||||
|
||||
sudo rm -rf "/usr/local/$ffmpeg_name" # lipo fails upon 2nd run
|
||||
sudo "${BASH_SOURCE%/*}/../macos/makeuniversal.sh" "$arm64_install_dir" "$x86_64_install_dir"
|
||||
fi
|
||||
|
||||
set_ffmpeg_dir_env_var "FFMPEG_DIR" "/usr/local/$ffmpeg_name"
|
||||
Reference in New Issue
Block a user