Migrate all libs (remove fdk-aac due to license issue and wavpack as no longer supported)
This commit is contained in:
parent
1fd52fd851
commit
03f14d866c
110
Dockerfile
110
Dockerfile
@ -6,16 +6,18 @@ ARG EXTRA_CFLAGS
|
||||
ARG EXTRA_LDFLAGS
|
||||
ARG FFMPEG_ST
|
||||
ARG FFMPEG_MT
|
||||
ENV INSTALL_DIR=/build
|
||||
ENV INSTALL_DIR=/opt
|
||||
ENV FFMPEG_VERSION=n5.1
|
||||
ENV CFLAGS="-I$INSTALL_DIR/include $CFLAGS $EXTRA_CFLAGS"
|
||||
ENV CXXFLAGS="$CFLAGS"
|
||||
ENV LDFLAGS="$LDFLAGS $CFLAGS $EXTRA_LDFLAGS"
|
||||
ENV LDFLAGS="-L$INSTALL_DIR/lib $LDFLAGS $CFLAGS $EXTRA_LDFLAGS"
|
||||
ENV EM_PKG_CONFIG_PATH=$EM_PKG_CONFIG_PATH:$INSTALL_DIR/lib/pkgconfig:/emsdk/upstream/emscripten/system/lib/pkgconfig
|
||||
ENV EM_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
||||
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$EM_PKG_CONFIG_PATH
|
||||
ENV FFMPEG_ST=$FFMPEG_ST
|
||||
ENV FFMPEG_MT=$FFMPEG_MT
|
||||
RUN apt-get update && \
|
||||
apt-get install -y pkg-config autoconf automake libtool ragel
|
||||
|
||||
# Build x264
|
||||
FROM emsdk-base AS x264-builder
|
||||
@ -31,6 +33,13 @@ ADD https://github.com/ffmpegwasm/x265.git#$X265_BRANCH /src
|
||||
COPY build/x265.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build libvpx
|
||||
FROM emsdk-base AS libvpx-builder
|
||||
ENV LIBVPX_BRANCH=v1.9.0
|
||||
ADD https://github.com/ffmpegwasm/libvpx.git#$LIBVPX_BRANCH /src
|
||||
COPY build/libvpx.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build lame
|
||||
FROM emsdk-base AS lame-builder
|
||||
ENV LAME_BRANCH=master
|
||||
@ -38,15 +47,95 @@ ADD https://github.com/ffmpegwasm/lame.git#$LAME_BRANCH /src
|
||||
COPY build/lame.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build ogg
|
||||
FROM emsdk-base AS ogg-builder
|
||||
ENV OGG_BRANCH=v1.3.4
|
||||
ADD https://github.com/ffmpegwasm/Ogg.git#$OGG_BRANCH /src
|
||||
COPY build/ogg.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build theora
|
||||
FROM emsdk-base AS theora-builder
|
||||
COPY --from=ogg-builder $INSTALL_DIR $INSTALL_DIR
|
||||
ENV THEORA_BRANCH=v1.1.1
|
||||
ADD https://github.com/ffmpegwasm/theora.git#$THEORA_BRANCH /src
|
||||
COPY build/theora.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build opus
|
||||
FROM emsdk-base AS opus-builder
|
||||
ENV OPUS_BRANCH=v1.3.1
|
||||
ADD https://github.com/ffmpegwasm/opus.git#$OPUS_BRANCH /src
|
||||
COPY build/opus.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build vorbis
|
||||
FROM emsdk-base AS vorbis-builder
|
||||
COPY --from=ogg-builder $INSTALL_DIR $INSTALL_DIR
|
||||
ENV VORBIS_BRANCH=v1.3.3
|
||||
ADD https://github.com/ffmpegwasm/vorbis.git#$VORBIS_BRANCH /src
|
||||
COPY build/vorbis.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build zlib
|
||||
FROM emsdk-base AS zlib-builder
|
||||
ENV ZLIB_BRANCH=v1.2.11
|
||||
ADD https://github.com/ffmpegwasm/zlib.git#$ZLIB_BRANCH /src
|
||||
COPY build/zlib.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build libwebp
|
||||
FROM emsdk-base AS libwebp-builder
|
||||
COPY --from=zlib-builder $INSTALL_DIR $INSTALL_DIR
|
||||
ENV LIBWEBP_BRANCH=v1.1.0
|
||||
ADD https://github.com/ffmpegwasm/libwebp.git#$LIBWEBP_BRANCH /src
|
||||
COPY build/libwebp.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build freetype2
|
||||
FROM emsdk-base AS freetype2-builder
|
||||
ENV FREETYPE2_BRANCH=VER-2-10-4
|
||||
ADD https://github.com/ffmpegwasm/freetype2.git#$FREETYPE2_BRANCH /src
|
||||
COPY build/freetype2.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build fribidi
|
||||
FROM emsdk-base AS fribidi-builder
|
||||
ENV FRIBIDI_BRANCH=v1.0.9
|
||||
ADD https://github.com/fribidi/fribidi.git#$FRIBIDI_BRANCH /src
|
||||
COPY build/fribidi.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build harfbuzz
|
||||
FROM emsdk-base AS harfbuzz-builder
|
||||
ENV HARFBUZZ_BRANCH=5.2.0
|
||||
ADD https://github.com/harfbuzz/harfbuzz.git#$HARFBUZZ_BRANCH /src
|
||||
COPY build/harfbuzz.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build libass
|
||||
FROM emsdk-base AS libass-builder
|
||||
COPY --from=freetype2-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=fribidi-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=harfbuzz-builder $INSTALL_DIR $INSTALL_DIR
|
||||
ENV LIBASS_BRANCH=0.15.0
|
||||
ADD https://github.com/libass/libass.git#$LIBASS_BRANCH /src
|
||||
COPY build/libass.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Base ffmpeg image with dependencies and source code populated.
|
||||
FROM emsdk-base AS ffmpeg-base
|
||||
RUN apt-get update && \
|
||||
apt-get install -y pkg-config
|
||||
RUN embuilder build sdl2 sdl2-mt
|
||||
ADD https://github.com/FFmpeg/FFmpeg.git#$FFMPEG_VERSION /src
|
||||
COPY --from=x264-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=x265-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=libvpx-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=lame-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=opus-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=theora-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=vorbis-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=libwebp-builder $INSTALL_DIR $INSTALL_DIR
|
||||
COPY --from=libass-builder $INSTALL_DIR $INSTALL_DIR
|
||||
|
||||
# Build ffmpeg
|
||||
FROM ffmpeg-base AS ffmpeg-builder
|
||||
@ -55,14 +144,23 @@ RUN bash -x /src/build.sh \
|
||||
--enable-gpl \
|
||||
--enable-libx264 \
|
||||
--enable-libx265 \
|
||||
--enable-libmp3lame
|
||||
--enable-libvpx \
|
||||
--enable-libmp3lame \
|
||||
--enable-libtheora \
|
||||
--enable-libvorbis \
|
||||
--enable-libopus \
|
||||
--enable-zlib \
|
||||
--enable-libwebp \
|
||||
--enable-libfreetype \
|
||||
--enable-libfribidi \
|
||||
--enable-libass
|
||||
|
||||
# Build ffmpeg.wasm
|
||||
FROM ffmpeg-builder AS ffmpeg-wasm-builder
|
||||
COPY src/bind /src/src/bind
|
||||
COPY src/fftools /src/src/fftools
|
||||
COPY build/ffmpeg-wasm.sh build.sh
|
||||
ENV FFMPEG_LIBS="-lx264 -lx265 -lmp3lame"
|
||||
ENV FFMPEG_LIBS="-lx264 -lx265 -lvpx -lmp3lame -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lopus -lz -lwebp -lfreetype -lfribidi -lharfbuzz -lass"
|
||||
RUN mkdir -p /src/dist/umd && bash -x /src/build.sh \
|
||||
${FFMPEG_LIBS} \
|
||||
-o dist/umd/ffmpeg-core.js
|
||||
|
27
build/aom.sh
Executable file
27
build/aom.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CM_FLAGS=(
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR # assign lib and include install path
|
||||
-DCMAKE_TOOLCHAIN_FILE=$EM_TOOLCHAIN_FILE # use emscripten toolchain file
|
||||
-DBUILD_SHARED_LIBS=0 # disable shared library build
|
||||
-DAOM_TARGET_CPU=generic # use generic cpu
|
||||
-DENABLE_DOCS=0 # disable docs
|
||||
-DENABLE_TESTS=0 # disable tests
|
||||
-DENABLE_EXAMPLES=0 # disable examples
|
||||
-DENABLE_TOOLS=0 # disable tools
|
||||
-DCONFIG_RUNTIME_CPU_DETECT=0 # disable cpu detect
|
||||
-DCONFIG_WEBM_IO=0 # disable libwebm support
|
||||
)
|
||||
|
||||
CMBUILD_DIR=cmbuild
|
||||
rm -rf $CMBUILD_DIR
|
||||
mkdir -p $CMBUILD_DIR
|
||||
cd $CMBUILD_DIR
|
||||
|
||||
emmake cmake .. \
|
||||
-DAOM_EXTRA_C_FLAGS="$CFLAGS" \
|
||||
-DAOM_EXTRA_CXX_FLAGS="$CFLAGS" \
|
||||
${CM_FLAGS[@]}
|
||||
emmake make install -j
|
@ -15,7 +15,7 @@ CONF_FLAGS=(
|
||||
--disable-autodetect # disable env auto detect
|
||||
|
||||
# assign toolchains and extra flags
|
||||
--nm="llvm-nm"
|
||||
--nm=emnm
|
||||
--ar=emar
|
||||
--ranlib=emranlib
|
||||
--cc=emcc
|
||||
|
15
build/freetype2.sh
Executable file
15
build/freetype2.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=x86_64-gnu # use i686 linux
|
||||
--enable-shared=no # not to build shared library
|
||||
--without-harfbuzz # disable harfbuzz as incompatible
|
||||
)
|
||||
emconfigure ./autogen.sh
|
||||
emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
# build apinames manually to prevent it built by emcc
|
||||
gcc -o objs/apinames src/tools/apinames.c
|
||||
emmake make install -j
|
16
build/fribidi.sh
Executable file
16
build/fribidi.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=x86_64-linux
|
||||
--enable-shared=no # not to build shared library
|
||||
--enable-static=yes
|
||||
--disable-dependency-tracking
|
||||
--disable-debug
|
||||
)
|
||||
emconfigure ./autogen.sh "${CONF_FLAGS[@]}"
|
||||
# A hacky to fix "Too many symbolic links" error
|
||||
emmake make install -j || true
|
||||
mkdir -p $INSTALL_DIR/lib/pkgconfig && cp fribidi.pc $INSTALL_DIR/lib/pkgconfig/
|
22
build/harfbuzz.sh
Executable file
22
build/harfbuzz.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CFLAGS="$CFLAGS -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR"
|
||||
|
||||
# A hacky way to disable pthread
|
||||
if [[ "$FFMPEG_ST" == "yes" ]]; then
|
||||
sed -i 's#\[have_pthread=true\]#\[have_pthread=false\]#g' configure.ac
|
||||
else
|
||||
sed -i 's#\[have_pthread=false\]#\[have_pthread=true\]#g' configure.ac
|
||||
fi
|
||||
CXXFLAGS=$CFLAGS
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-gnu # use i686 linux
|
||||
--enable-shared=no # not to build shared library
|
||||
--enable-static
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
16
build/libass.sh
Executable file
16
build/libass.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-gnu # use i686 linux
|
||||
--disable-shared
|
||||
--enable-static
|
||||
--disable-asm # disable asm optimization
|
||||
--disable-fontconfig
|
||||
--disable-require-system-font-provider
|
||||
)
|
||||
|
||||
./autogen.sh && emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
22
build/libvpx.sh
Executable file
22
build/libvpx.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--target=generic-gnu # target with miminal features
|
||||
--disable-install-bins # not to install bins
|
||||
--disable-examples # not to build examples
|
||||
--disable-tools # not to build tools
|
||||
--disable-docs # not to build docs
|
||||
--disable-unit-tests # not to do unit tests
|
||||
--disable-dependency-tracking # speed up one-time build
|
||||
--extra-cflags="$CFLAGS" # flags to use pthread and code optimization
|
||||
--extra-cxxflags="$CXXFLAGS" # flags to use pthread and code optimization
|
||||
${FFMPEG_ST:+ --disable-multithread}
|
||||
)
|
||||
|
||||
emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
||||
# Fix ffmpeg configure error: "libvpx enabled but no supported decoders found"
|
||||
emranlib $INSTALL_DIR/lib/libvpx.a
|
26
build/libwebp.sh
Executable file
26
build/libwebp.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CM_FLAGS=(
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
|
||||
-DCMAKE_TOOLCHAIN_FILE=$EM_TOOLCHAIN_FILE
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DZLIB_LIBRARY=$INSTALL_DIR/lib
|
||||
-DZLIB_INCLUDE_DIR=$INSTALL_DIR/include
|
||||
-DWEBP_ENABLE_SIMD=ON
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF
|
||||
-DWEBP_BUILD_CWEBP=OFF
|
||||
-DWEBP_BUILD_DWEBP=OFF
|
||||
-DWEBP_BUILD_GIF2WEBP=OFF
|
||||
-DWEBP_BUILD_IMG2WEBP=OFF
|
||||
-DWEBP_BUILD_VWEBP=OFF
|
||||
-DWEBP_BUILD_WEBPINFO=OFF
|
||||
-DWEBP_BUILD_WEBPMUX=OFF
|
||||
-DWEBP_BUILD_EXTRAS=OFF
|
||||
)
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
emmake cmake .. -DCMAKE_C_FLAGS="$CXXFLAGS" ${CM_FLAGS[@]}
|
||||
emmake make install
|
15
build/ogg.sh
Executable file
15
build/ogg.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-linux # use i686 linux
|
||||
--disable-shared # disable shared library
|
||||
--disable-dependency-tracking # speed up one-time build
|
||||
--disable-maintainer-mode
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh
|
||||
emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
18
build/opus.sh
Executable file
18
build/opus.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-gnu # use i686 linux
|
||||
--enable-shared=no # not to build shared library
|
||||
--disable-asm # not to use asm
|
||||
--disable-rtcd # not to detect cpu capabilities
|
||||
--disable-doc # not to build docs
|
||||
--disable-extra-programs # not to build demo and tests
|
||||
--disable-stack-protector
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh
|
||||
CFLAGS=$CFLAGS emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
20
build/theora.sh
Executable file
20
build/theora.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-linux # use i686 linux
|
||||
--enable-shared=no # disable shared library
|
||||
--enable-docs=no
|
||||
--enable-fast-install=no
|
||||
--disable-spec
|
||||
--disable-asm
|
||||
--disable-examples
|
||||
--disable-oggtest # disable ogg tests
|
||||
--disable-vorbistest # disable vorbis tests
|
||||
--disable-sdltest # disable sdl tests
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
21
build/vorbis.sh
Executable file
21
build/vorbis.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Remove this flag as clang doesn't recognize
|
||||
sed -i 's#-mno-ieee-fp##g' configure.ac
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=i686-linux # use i686 linux
|
||||
--enable-shared=no # disable shared library
|
||||
--enable-docs=no
|
||||
--enable-examples=no
|
||||
--enable-fast-install=no
|
||||
--disable-oggtest # disable oggtests
|
||||
--disable-dependency-tracking # speed up one-time build
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh
|
||||
emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
19
build/wavpack.sh
Executable file
19
build/wavpack.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # install library in a build directory for FFmpeg to include
|
||||
--host=x86-linux-gnu # use x86 linux as host
|
||||
--disable-asm # disable asm optimization
|
||||
--disable-man # disable docs
|
||||
--disable-tests # disable tests
|
||||
--disable-apps # disable wavpack apps
|
||||
--disable-dsd # disalbe legacy
|
||||
--enable-legacy # enable compability for old version of wav
|
||||
--disable-shared # enable building static library
|
||||
--disable-dependency-tracking # speed up one-time build
|
||||
--disable-maintainer-mode
|
||||
)
|
||||
CFLAGS=$CFLAGS emconfigure ./autogen.sh "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
16
build/zlib.sh
Executable file
16
build/zlib.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CM_FLAGS=(
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
|
||||
-DCMAKE_TOOLCHAIN_FILE=$EM_TOOLCHAIN_FILE
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DSKIP_INSTALL_FILES=ON
|
||||
)
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
emmake cmake .. -DCMAKE_C_FLAGS="$CXXFLAGS" ${CM_FLAGS[@]}
|
||||
emmake make clean
|
||||
emmake make install
|
Loading…
Reference in New Issue
Block a user