@@ -50,7 +50,7 @@ if [ -n "$IS_OSX" ]; then
5050 function generate_ffmpeg_formula {
5151 local FF=" ffmpeg"
5252 local LFF=" ffmpeg_opencv"
53- local FF_FORMULA; FF_FORMULA=$( brew formula " $FF " )
53+ local FF_FORMULA; FF_FORMULA=$( brew formula " ${FF}${FFMPEG_FORMULA_VERSION} " )
5454 local LFF_FORMULA; LFF_FORMULA=" $( dirname " $FF_FORMULA " ) /${LFF} .rb"
5555
5656 local REGENERATE
@@ -70,8 +70,9 @@ if [ -n "$IS_OSX" ]; then
7070 if [ -n " $REGENERATE " ]; then
7171 echo " Regenerating custom ffmpeg formula"
7272 # Bottle block syntax: https://docs.brew.sh/Bottles#bottle-dsl-domain-specific-language
73+ # FfmpegAT4 is a class in ffmpeg@4 formula
7374 perl -wpe ' BEGIN {our ($found_blank, $bottle_block);}
74- if (/(^class )(Ffmpeg )(\s.*)/) {$_=$1.$2."Opencv ".$3."\n"; next;}
75+ if (/(^class )(FfmpegAT4 )(\s.*)/) {$_=$1."FfmpegOpencv ".$3."\n"; next;}
7576 if (!$found_blank && /^$/) {$_.="conflicts_with \"ffmpeg\"\n\n"; $found_blank=1; next;}
7677 if (!$bottle_block && /^\s*bottle do$/) { $bottle_block=1; next; }
7778 if ($bottle_block) { if (/^\s*end\s*$/) { $bottle_block=0} elsif (/^\s*sha256\s/) {$_=""} next; }
@@ -111,34 +112,14 @@ function pre_build {
111112 CACHE_STAGE=
112113 export HOMEBREW_NO_AUTO_UPDATE=1
113114
114- # after the cache stage, all bottles and Homebrew metadata should be already cached locally
115- # if [ -n "$CACHE_STAGE" ]; then
116- # brew update
117- # generate_ffmpeg_formula
118- # brew_add_local_bottles
119- # fi
120-
121115 echo ' Installing FFmpeg'
122116
123- # if [ -n "$CACHE_STAGE" ]; then
124- # brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; }
125- # else
126- brew update
127- generate_ffmpeg_formula
128- brew_add_local_bottles
129- # brew unlink python@2
130- brew install --build-bottle ffmpeg_opencv
131- # fi
132-
133- # echo 'Installing qt5'
134-
135- # if [ -n "$CACHE_STAGE" ]; then
136- # echo "Qt5 has bottle, no caching needed"
137- # else
138- # brew switch qt 5.13.2
139- # brew pin qt
140- # export PATH="/usr/local/opt/qt/bin:$PATH"
141- # fi
117+ brew update
118+ generate_ffmpeg_formula
119+ brew_add_local_bottles
120+ brew install --build-bottle ffmpeg_opencv
121+ # It needs when we use not the latest ffmpeg formula
122+ brew link ffmpeg_opencv
142123
143124 if [ -n " $CACHE_STAGE " ]; then
144125 brew_go_bootstrap_mode 0
0 commit comments