From 2693c162b806333027eff629ae164d6947997962 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 21 Sep 2020 14:54:22 -0700 Subject: [PATCH] devops(ffmpeg): compile zlib dependency that is needed for ffmpeg (#3940) This patch adds zlib compilation that is required for ffmpeg. --- browser_patches/ffmpeg/BUILD_NUMBER | 2 +- browser_patches/ffmpeg/CONFIG.sh | 3 +++ browser_patches/ffmpeg/build-linux.sh | 10 ++++++++++ browser_patches/ffmpeg/build-mac.sh | 10 ++++++++++ browser_patches/ffmpeg/build.sh | 2 +- .../ffmpeg/crosscompile-from-linux-to-win.sh | 18 ++++++++++++++++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/browser_patches/ffmpeg/BUILD_NUMBER b/browser_patches/ffmpeg/BUILD_NUMBER index 7d802a3e71..baccd0398f 100644 --- a/browser_patches/ffmpeg/BUILD_NUMBER +++ b/browser_patches/ffmpeg/BUILD_NUMBER @@ -1 +1 @@ -1002 +1003 diff --git a/browser_patches/ffmpeg/CONFIG.sh b/browser_patches/ffmpeg/CONFIG.sh index 1d78853ecd..2cb8e6f836 100644 --- a/browser_patches/ffmpeg/CONFIG.sh +++ b/browser_patches/ffmpeg/CONFIG.sh @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +ZLIB_VERSION="v1.2.11" +ZLIB_CONFIG="--static" + LIBVPX_VERSION="v1.9.0" LIBVPX_CONFIG="--enable-static \ --disable-shared \ diff --git a/browser_patches/ffmpeg/build-linux.sh b/browser_patches/ffmpeg/build-linux.sh index 8133748aab..cb79a56f2e 100644 --- a/browser_patches/ffmpeg/build-linux.sh +++ b/browser_patches/ffmpeg/build-linux.sh @@ -36,6 +36,15 @@ elif ! [[ -d $(dirname "${output_path}") ]]; then die "ERROR: folder for output path ${output_path} does not exist." fi +function build_zlib { + cd "${HOME}" + git clone https://github.com/madler/zlib + cd zlib + git checkout "${ZLIB_VERSION}" + ./configure --prefix="${PREFIX}" ${ZLIB_CONFIG} + make && make install +} + function build_libvpx { cd "${HOME}" git clone https://chromium.googlesource.com/webm/libvpx @@ -74,6 +83,7 @@ source ./CONFIG.sh apt-get update apt-get install -y git make yasm pkg-config +build_zlib build_libvpx build_ffmpeg diff --git a/browser_patches/ffmpeg/build-mac.sh b/browser_patches/ffmpeg/build-mac.sh index 5bb34149a6..02da3180aa 100755 --- a/browser_patches/ffmpeg/build-mac.sh +++ b/browser_patches/ffmpeg/build-mac.sh @@ -31,6 +31,15 @@ BUILDDIR="${PWD}/build" PREFIX="${BUILDDIR}/osx_prefix" OUTPUT_PATH="${PWD}/output/ffmpeg-mac" +function build_zlib { + cd "${BUILDDIR}" + git clone https://github.com/madler/zlib + cd zlib + git checkout "${ZLIB_VERSION}" + ./configure --prefix="${PREFIX}" ${ZLIB_CONFIG} + make && make install +} + function build_libvpx { cd "${BUILDDIR}" git clone https://chromium.googlesource.com/webm/libvpx @@ -79,6 +88,7 @@ set -x rm -rf "${BUILDDIR}" mkdir -p "${BUILDDIR}" +build_zlib build_libvpx build_ffmpeg diff --git a/browser_patches/ffmpeg/build.sh b/browser_patches/ffmpeg/build.sh index ad3310b539..68b1af351b 100755 --- a/browser_patches/ffmpeg/build.sh +++ b/browser_patches/ffmpeg/build.sh @@ -21,7 +21,7 @@ trap "cd $(pwd -P)" EXIT cd "$(dirname $0)" if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then - echo "usage: $(basename $0) [--mac|--cross-compile-win32|--cross-compile-win64]" + echo "usage: $(basename $0) [--mac|--linux|--cross-compile-win32|--cross-compile-win64]" echo echo "Build ffmpeg for the given platform" echo diff --git a/browser_patches/ffmpeg/crosscompile-from-linux-to-win.sh b/browser_patches/ffmpeg/crosscompile-from-linux-to-win.sh index c61da6f4c6..a9b30ae7fb 100644 --- a/browser_patches/ffmpeg/crosscompile-from-linux-to-win.sh +++ b/browser_patches/ffmpeg/crosscompile-from-linux-to-win.sh @@ -52,6 +52,23 @@ elif ! [[ -d $(dirname "${output_path}") ]]; then die "ERROR: folder for output path ${output_path} does not exist." fi +function build_zlib { + cd "${HOME}" + git clone https://github.com/madler/zlib + cd zlib + git checkout "${ZLIB_VERSION}" + ./configure --prefix="${PREFIX}" ${ZLIB_CONFIG} + make \ + CC="${toolchain_prefix}gcc" \ + CXX="${toolchain_prefix}g++" \ + AR="${toolchain_prefix}ar" \ + PREFIX="$PREFIX" \ + RANLIB="${toolchain_prefix}ranlib" \ + LD="${toolchain_prefix}ld" \ + STRIP="${toolchain_prefix}strip" + make install +} + function build_libvpx { cd "${HOME}" git clone https://chromium.googlesource.com/webm/libvpx @@ -109,6 +126,7 @@ source ./CONFIG.sh apt-get update apt-get install -y mingw-w64 git make yasm pkg-config +build_zlib build_libvpx build_ffmpeg