Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
- fix merge conflicts
- add win64 target to CI config
- update upload/download artifacts + deploy parameters
- clean up readme
  • Loading branch information
bastimeyer committed Mar 20, 2022
2 parents 5f16d7c + 22719ab commit 737a827
Show file tree
Hide file tree
Showing 90 changed files with 2,704 additions and 658 deletions.
2 changes: 2 additions & 0 deletions .github/buildkit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[worker.oci]
max-parallelism = 4
86 changes: 54 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
Expand All @@ -26,13 +30,18 @@ jobs:
password: ${{ github.token }}
- name: Image Name
id: imagename
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base:latest"
- name: Build base image
run: |
T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base
- name: Push base image
run: docker push ${{ steps.imagename.outputs.name }}
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base"
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
uses: docker/build-push-action@v2
with:
context: images/base
pull: true
push: true
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
build_target_bases:
name: Build target base image
needs: build_base
Expand All @@ -44,9 +53,14 @@ jobs:
matrix:
target:
- win32
- win64
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
Expand All @@ -55,13 +69,18 @@ jobs:
password: ${{ github.token }}
- name: Image Name
id: imagename
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest"
run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}"
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
run: |
T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg GH_REPO=${GITHUB_REPOSITORY,,} --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base-${{ matrix.target }}
- name: Push target base image
run: docker push ${{ steps.imagename.outputs.name }}
uses: docker/build-push-action@v2
with:
context: images/base-${{ matrix.target }}
pull: true
push: true
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
build_targets:
name: Build target-variant image
needs: build_target_bases
Expand All @@ -73,37 +92,40 @@ jobs:
matrix:
target:
- win32
- win64
variant:
- gpl 4.4
- gpl 5.0
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
with:
config: .github/buildkit.toml
- name: Login to Docker
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Generate Dockerfile
run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }}
- name: Image Name
id: imagename
run: |
IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}"
echo "::set-output name=name::${IMG/ /-}:latest"
echo "::set-output name=cache_name::${IMG/ /-}:cache"
- name: Build variant image
run: |
T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
docker buildx build \
--pull \
--tag ${{ steps.imagename.outputs.name }} \
--cache-to=type=registry,mode=max,ref=${{ steps.imagename.outputs.cache_name }} \
--cache-from=type=registry,ref=${{ steps.imagename.outputs.cache_name }} \
--output=type=image,push=true,name=${{ steps.imagename.outputs.name }} \
.
echo "::set-output name=name::${IMG/ /-}"
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
uses: docker/build-push-action@v2
with:
context: .
pull: true
push: true
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
build_ffmpeg:
name: Build ffmpeg
needs: build_targets
Expand All @@ -115,8 +137,9 @@ jobs:
matrix:
target:
- win32
- win64
variant:
- gpl 4.4
- gpl 5.0
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -133,7 +156,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ffmpeg
name: ffmpeg-${{ matrix.target }}
path: artifacts/*
publish_release:
name: Publish release
Expand All @@ -148,9 +171,8 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ffmpeg
path: artifacts
- name: Deploy
run: ./deploy.sh ./artifacts/*
run: ./deploy.sh ./artifacts/**/*
env:
RELEASES_API_KEY: ${{ github.token }}
55 changes: 4 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,9 @@
# streamlink / FFmpeg-Builds
streamlink/FFmpeg-Builds
====

This is a fork of [`BtbN/FFmpeg-Builds`](https://github.com/BtbN/FFmpeg-Builds) with modifications
of the build and deploy config.

The goal of this fork is to have win32 builds of FFmpeg for inclusion in
[Streamlink](https://github.com/streamlink/streamlink)'s Windows installer.
The goal of this fork is to have both win32+win64 builds of FFmpeg for inclusion in [Streamlink](https://github.com/streamlink/streamlink)'s Windows installers.

----

# FFmpeg Static Auto-Builds

Static Windows (x86_64) and Linux (x86_64) Builds of ffmpeg master and latest release branch.

Windows builds are targetting Windows 7 and newer.

Linux builds are targetting Ubuntu 16.04 (glibc-2.23 + linux-4.4) and anything more recent.

## Package List

For a list of included dependencies check the scripts.d directory.
Every file corresponds to its respective package.

## How to make a build

### Prerequisites

* bash
* docker

### Build Image

* `./makeimage.sh target variant [addins]`

### Build FFmpeg

* `./build.sh target variant [addins]`

On success, the resulting zip file will be in the `artifacts` subdir.

### Targets, Variants and Addins

Available targets:
* `win64` (x86_64 Windows)
* `win32` (x86 Windows)
* `linux64` (x86_64 Linux, glibc>=2.23, linux>=4.4)

Available:
* `gpl` Includes all dependencies, even those that require full GPL instead of just LGPL.
* `lgpl` Lacking libraries that are GPL-only. Most prominently libx264 and libx265.
* `gpl-shared` Same as gpl, but comes with the libav* family of shared libs instead of pure static executables.
* `lgpl-shared` Same again, but with the lgpl set of dependencies.

All of those can be optionally combined with any combination of addins.
* `4.4` to build from the 4.4 release branch instead of master.
* `debug` to not strip debug symbols from the binaries. This increases the output size by about 250MB.
Please see the upstream readme for more information.
2 changes: 2 additions & 0 deletions addins/5.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
GIT_BRANCH="release/5.0"
8 changes: 6 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ rm -f "$TESTFILE"
rm -rf ffbuild
mkdir ffbuild

FFMPEG_REPO="${FFMPEG_REPO:-https://github.com/FFmpeg/FFmpeg.git}"
FFMPEG_REPO="${FFMPEG_REPO_OVERRIDE:-$FFMPEG_REPO}"
GIT_BRANCH="${GIT_BRANCH:-master}"
GIT_BRANCH="${GIT_BRANCH_OVERRIDE:-$GIT_BRANCH}"

BUILD_SCRIPT="$(mktemp)"
trap "rm -f -- '$BUILD_SCRIPT'" EXIT

Expand All @@ -58,9 +63,8 @@ cat <<EOF >"$BUILD_SCRIPT"
cd /ffbuild
rm -rf ffmpeg prefix
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
git clone --filter=blob:none --branch='$GIT_BRANCH' '$FFMPEG_REPO' ffmpeg
cd ffmpeg
git checkout $GIT_BRANCH
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
--extra-cflags='$FF_CFLAGS' --extra-cxxflags='$FF_CXXFLAGS' \
Expand Down
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -xe
set -e
cd "$(dirname "$0")"
source util/vars.sh

Expand Down
18 changes: 14 additions & 4 deletions images/base-linux64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
ARG GH_REPO=btbn/ffmpeg-builds
FROM ghcr.io/$GH_REPO/base:latest

ENV PATH="/opt/ct-ng/bin:${PATH}"
RUN --mount=src=ct-ng-config,dst=/.config \
git clone https://github.com/crosstool-ng/crosstool-ng.git /ct-ng && cd /ct-ng && \
git clone --filter=blob:none https://github.com/crosstool-ng/crosstool-ng.git /ct-ng && cd /ct-ng && \
./bootstrap && \
./configure --enable-local && \
make -j$(nproc) && \
Expand All @@ -20,17 +19,28 @@ RUN \
-and -not -name 'libdl.*' \
-and -not -name 'libc.*' \
-and -not -name 'libm.*' \
-and -not -name 'libmvec.*' \
-and -not -name 'librt.*' \
-and -not -name 'libpthread.*' \
-delete && \
find /opt/ct-ng \
-name 'libdl.a' \
-or -name 'libc.a' \
-or -name 'libm.a' \
-delete
-or -name 'libmvec.a' \
-or -name 'librt.a' \
-or -name 'libpthread.a' \
-delete && \
mkdir /opt/ffbuild

ADD toolchain.cmake /toolchain.cmake
ADD cross.meson /cross.meson

ENV FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux" \
ADD gen-implib.sh /usr/bin/gen-implib
RUN git clone --filter=blob:none --depth=1 https://github.com/yugr/Implib.so /opt/implib

ENV PATH="/opt/ct-ng/bin:${PATH}" \
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux" \
FFBUILD_TOOLCHAIN=x86_64-ffbuild-linux-gnu \
FFBUILD_CROSS_PREFIX="x86_64-ffbuild-linux-gnu-" \
FFBUILD_RUST_TARGET="x86_64-unknown-linux-gnu" \
Expand Down
Loading

0 comments on commit 737a827

Please sign in to comment.