Skip to content

Commit

Permalink
Defined ffmpeg version for macos (4.4.1) and fixed MacOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
asenyaev committed Mar 3, 2022
1 parent 141a763 commit 602a8be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_wheels_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
USE_CCACHE: 1
UNICODE_WIDTH: 32
PLAT: x86_64
FFMPEG_FORMULA_VERSION: '@4'
SDIST: ${{ matrix.build_sdist || 0 }}
ENABLE_HEADLESS: ${{ matrix.without_gui }}
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
Expand Down
37 changes: 9 additions & 28 deletions travis_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if [ -n "$IS_OSX" ]; then
function generate_ffmpeg_formula {
local FF="ffmpeg"
local LFF="ffmpeg_opencv"
local FF_FORMULA; FF_FORMULA=$(brew formula "$FF")
local FF_FORMULA; FF_FORMULA=$(brew formula "${FF}${FFMPEG_FORMULA_VERSION}")
local LFF_FORMULA; LFF_FORMULA="$(dirname "$FF_FORMULA")/${LFF}.rb"

local REGENERATE
Expand All @@ -70,8 +70,9 @@ if [ -n "$IS_OSX" ]; then
if [ -n "$REGENERATE" ]; then
echo "Regenerating custom ffmpeg formula"
# Bottle block syntax: https://docs.brew.sh/Bottles#bottle-dsl-domain-specific-language
# FfmpegAT4 is a class in ffmpeg@4 formula
perl -wpe 'BEGIN {our ($found_blank, $bottle_block);}
if (/(^class )(Ffmpeg)(\s.*)/) {$_=$1.$2."Opencv".$3."\n"; next;}
if (/(^class )(FfmpegAT4)(\s.*)/) {$_=$1."FfmpegOpencv".$3."\n"; next;}
if (!$found_blank && /^$/) {$_.="conflicts_with \"ffmpeg\"\n\n"; $found_blank=1; next;}
if (!$bottle_block && /^\s*bottle do$/) { $bottle_block=1; next; }
if ($bottle_block) { if (/^\s*end\s*$/) { $bottle_block=0} elsif (/^\s*sha256\s/) {$_=""} next; }
Expand Down Expand Up @@ -111,34 +112,14 @@ function pre_build {
CACHE_STAGE=
export HOMEBREW_NO_AUTO_UPDATE=1

#after the cache stage, all bottles and Homebrew metadata should be already cached locally
# if [ -n "$CACHE_STAGE" ]; then
# brew update
# generate_ffmpeg_formula
# brew_add_local_bottles
# fi

echo 'Installing FFmpeg'

# if [ -n "$CACHE_STAGE" ]; then
# brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
# else
brew update
generate_ffmpeg_formula
brew_add_local_bottles
# brew unlink python@2
brew install --build-bottle ffmpeg_opencv
# fi

# echo 'Installing qt5'

# if [ -n "$CACHE_STAGE" ]; then
# echo "Qt5 has bottle, no caching needed"
# else
# brew switch qt 5.13.2
# brew pin qt
# export PATH="/usr/local/opt/qt/bin:$PATH"
# fi
brew update
generate_ffmpeg_formula
brew_add_local_bottles
brew install --build-bottle ffmpeg_opencv
# It needs when we use not the latest ffmpeg formula
brew link ffmpeg_opencv

if [ -n "$CACHE_STAGE" ]; then
brew_go_bootstrap_mode 0
Expand Down

0 comments on commit 602a8be

Please sign in to comment.