feat: enable --enable-libzimg (#574)
* feat: enable --enable-libzimg * 📄 doc: comment the Dockerfile * ⚙️ conf: modify CI to add zimg-dev * ⚙️ conf: try to install and build from git zimg * ⚙️ fix: git recursive * ⚙️ conf: add zimg version display * ⚙️ conf: change cache name to check if cache was responsible for build failure * ⚙️ conf: change dockerfile to build zimg * ➕ add: missing build script file zimg.sh
This commit is contained in:
parent
26f0e482da
commit
cf9cf11c6d
28
.github/workflows/CI.yml
vendored
28
.github/workflows/CI.yml
vendored
@ -13,13 +13,15 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
- name: Update pkg-config database
|
||||
run: sudo ldconfig
|
||||
- name: Setup Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Cache build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: build-cache-st
|
||||
key: build-cache-st-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
||||
@ -28,7 +30,7 @@ jobs:
|
||||
- name: Build ffmpeg-core
|
||||
run: make prd EXTRA_ARGS="--cache-from=type=local,src=build-cache-st --cache-to=type=local,dest=build-cache-st,mode=max"
|
||||
- name: Upload core
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ffmpeg-core
|
||||
path: packages/core/dist/*
|
||||
@ -36,23 +38,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Cache build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: build-cache-mt
|
||||
|
||||
key: build-cache-mt-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
||||
restore-keys: |
|
||||
build-cache-v1-
|
||||
- name: Build ffmpet-core-mt
|
||||
run: make prd-mt EXTRA_ARGS="--cache-from=type=local,src=build-cache-mt --cache-to=type=local,dest=build-cache-mt,mode=max"
|
||||
- name: Upload core-mt
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ffmpeg-core-mt
|
||||
path: packages/core-mt/dist/*
|
||||
@ -63,31 +64,30 @@ jobs:
|
||||
- build-core-mt
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
- name: Download ffmpeg-core
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ffmpeg-core
|
||||
path: packages/core/dist
|
||||
- name: Download ffmpeg-core-mt
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ffmpeg-core-mt
|
||||
path: packages/core-mt/dist
|
||||
- name: Use Node.js 18
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.x
|
||||
- name: Cache dependencies
|
||||
id: cache-dependencies
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
|
||||
key: node-modules-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-modules-
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
run: npm test
|
17
Dockerfile
17
Dockerfile
@ -20,6 +20,14 @@ ENV FFMPEG_MT=$FFMPEG_MT
|
||||
RUN apt-get update && \
|
||||
apt-get install -y pkg-config autoconf automake libtool ragel
|
||||
|
||||
# Build zimg
|
||||
FROM emsdk-base AS zimg-builder
|
||||
ENV ZIMG_BRANCH=release-3.0.5
|
||||
RUN apt-get update && apt-get install -y git
|
||||
RUN git clone --recursive -b $ZIMG_BRANCH https://github.com/sekrit-twc/zimg.git /src
|
||||
COPY build/zimg.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh
|
||||
|
||||
# Build x264
|
||||
FROM emsdk-base AS x264-builder
|
||||
ENV X264_BRANCH=4-cores
|
||||
@ -137,8 +145,9 @@ 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
|
||||
COPY --from=zimg-builder $INSTALL_DIR $INSTALL_DIR
|
||||
|
||||
# Build ffmpeg
|
||||
# Build ffmpeg with --enable-libzimg
|
||||
FROM ffmpeg-base AS ffmpeg-builder
|
||||
COPY build/ffmpeg.sh /src/build.sh
|
||||
RUN bash -x /src/build.sh \
|
||||
@ -154,7 +163,8 @@ RUN bash -x /src/build.sh \
|
||||
--enable-libwebp \
|
||||
--enable-libfreetype \
|
||||
--enable-libfribidi \
|
||||
--enable-libass
|
||||
--enable-libass \
|
||||
--enable-libzimg
|
||||
|
||||
# Build ffmpeg.wasm
|
||||
FROM ffmpeg-builder AS ffmpeg-wasm-builder
|
||||
@ -178,7 +188,8 @@ ENV FFMPEG_LIBS \
|
||||
-lfreetype \
|
||||
-lfribidi \
|
||||
-lharfbuzz \
|
||||
-lass
|
||||
-lass \
|
||||
-lzimg
|
||||
RUN mkdir -p /src/dist/umd && bash -x /src/build.sh \
|
||||
${FFMPEG_LIBS} \
|
||||
-o dist/umd/ffmpeg-core.js
|
||||
|
17
build/zimg.sh
Normal file
17
build/zimg.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CONF_FLAGS=(
|
||||
--prefix=$INSTALL_DIR # lib installation directory
|
||||
--host=x86_64-linux-gnu # use i686 linux host
|
||||
--disable-shared # build static library
|
||||
--enable-static # enable static library
|
||||
--disable-dependency-tracking # speed up one-time build
|
||||
--disable-simd # disable simd optimization
|
||||
)
|
||||
|
||||
emconfigure ./autogen.sh
|
||||
|
||||
emconfigure ./configure "${CONF_FLAGS[@]}"
|
||||
emmake make install -j
|
Loading…
Reference in New Issue
Block a user