Revamp CI and add linux-arm64
Signed-off-by: Mary Guillemard <mary@mary.zone>
This commit is contained in:
parent
508e6d473d
commit
660a268329
4 changed files with 175 additions and 54 deletions
79
.github/workflows/ci.yml
vendored
79
.github/workflows/ci.yml
vendored
|
@ -6,10 +6,6 @@ on:
|
|||
description: 'FFmpeg/FFmpeg commit to build'
|
||||
required: true
|
||||
|
||||
env:
|
||||
DECODERS: "h264,vp8"
|
||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.platform.name }}
|
||||
|
@ -18,60 +14,37 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: win-x64, os: ubuntu-20.04, flags: "--arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --disable-w32threads --extra-ldflags=\"-static-libgcc -static-libstdc++ -static\"" }
|
||||
- { name: linux-x64, os: ubuntu-20.04, flags: "--arch=x86_64 --extra-ldflags=\"-static-libgcc -static-libstdc++\"" }
|
||||
- { name: osx-x64, os: macos-latest, flags: "--arch=x86_64 --install-name-dir=\"@rpath\" --enable-cross-compile --cc=\"clang -arch x86_64\" --disable-xlib" }
|
||||
- { name: osx-arm64, os: macos-latest, flags: "--arch=arm64 --install-name-dir=\"@rpath\" --enable-neon --enable-cross-compile --cc=\"clang -arch arm64\" --disable-xlib" }
|
||||
- { name: win-x64, os: ubuntu-20.04, arch: x86_64, target_os: win }
|
||||
- { name: linux-x64, os: ubuntu-20.04, arch: x86_64, target_os: linux }
|
||||
- { name: linux-arm64, os: ubuntu-20.04, arch: arm64, target_os: linux }
|
||||
- { name: osx-x64, os: macos-latest, arch: x86_64, target_os: macos }
|
||||
- { name: osx-arm64, os: macos-latest, arch: arm64, target_os: macos }
|
||||
steps:
|
||||
- name: Setup Linux common dependencies
|
||||
- name: Setup qemu static
|
||||
uses: docker/setup-qemu-action@v3
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get install yasm \
|
||||
make \
|
||||
automake \
|
||||
autoconf \
|
||||
git \
|
||||
pkg-config \
|
||||
libtool-bin \
|
||||
nasm
|
||||
- name: Setup MinGW64 dependencies
|
||||
if: ${{ matrix.platform.name == 'win-x64' }}
|
||||
run: |
|
||||
sudo apt-get install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
- name: Setup nasm for osx-x64 dependencies
|
||||
if: ${{ matrix.platform.name == 'osx-x64' }}
|
||||
run: |
|
||||
brew install nasm
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: FFmpeg/FFmpeg
|
||||
ref: ${{ github.event.inputs.rev }}
|
||||
- name: Configure FFmpeg build
|
||||
run: |
|
||||
./configure --disable-everything \
|
||||
--disable-static \
|
||||
--disable-doc \
|
||||
--disable-programs \
|
||||
--disable-swscale \
|
||||
--disable-avformat \
|
||||
--disable-swresample \
|
||||
--disable-avdevice \
|
||||
--disable-avfilter \
|
||||
--disable-debug \
|
||||
--enable-avcodec \
|
||||
--enable-shared \
|
||||
--enable-decoder=${{ env.DECODERS }} \
|
||||
--enable-lto \
|
||||
--enable-stripping \
|
||||
${{ matrix.platform.flags }} \
|
||||
--prefix=release_output
|
||||
- name: "Build FFmpeg"
|
||||
run: |
|
||||
make -j4 && make install
|
||||
- name: Upload artifact
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'nvdec_deps'
|
||||
- name: Build and prepare release
|
||||
run: nvdec_deps/ci/run.sh $PWD $PWD/nvdec_deps/native/${{ matrix.platform.name }} ${{ matrix.platform.arch }} ${{ matrix.platform.target_os }}
|
||||
shell: bash
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform.name }}-binaries
|
||||
path: |
|
||||
release_output/*
|
||||
path: install_output
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
commit-message: Update ${{ matrix.platform.name }} binaries
|
||||
title: Update ${{ matrix.platform.name }} binaries
|
||||
body: This PR has been auto-generated to update the ${{ matrix.platform.name }} binaries.
|
||||
branch: update-${{ matrix.platform.name }}-binaries
|
||||
path: 'nvdec_deps'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
</metadata>
|
||||
<files>
|
||||
<file src="native\linux-x64\**" target="runtimes\linux-x64\native" />
|
||||
<file src="native\linux-arm64\**" target="runtimes\linux-arm64\native" />
|
||||
<file src="native\osx-arm64\**" target="runtimes\osx-arm64\native" />
|
||||
<file src="native\osx-x64\**" target="runtimes\osx-x64\native" />
|
||||
<file src="native\win-x64\**" target="runtimes\win-x64\native" />
|
||||
|
|
108
ci/compile.sh
Executable file
108
ci/compile.sh
Executable file
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DECODERS="h264,vp8"
|
||||
LIBAVCODEC_VERSION=59
|
||||
LIBAVUTIL_VERSION=57
|
||||
|
||||
if [ "$#" -le 3 ]; then
|
||||
echo "usage: <src_dir> <output_path> <build_arch> <target_system_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
src_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
target_system_name=$4
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if command -v sudo &> /dev/null
|
||||
then
|
||||
SUDO=sudo
|
||||
fi
|
||||
|
||||
if [[ $system_name == "linux" ]]; then
|
||||
$SUDO apt-get update -y
|
||||
$SUDO apt-get install -y \
|
||||
yasm \
|
||||
build-essential \
|
||||
clang \
|
||||
llvm \
|
||||
make \
|
||||
automake \
|
||||
autoconf \
|
||||
pkg-config \
|
||||
libtool-bin \
|
||||
nasm
|
||||
fi
|
||||
|
||||
if [[ $target_system_name == "linux" ]]; then
|
||||
export LDFLAGS="-static-libgcc -static-libstdc++"
|
||||
extra_configure_flags="--enable-cross-compile"
|
||||
elif [[ $target_system_name == "macos" ]]; then
|
||||
brew install nasm
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET="11.0"
|
||||
export cc="clang -arch $build_arch"
|
||||
extra_configure_flags="--install-name-dir=\"@rpath\" --enable-cross-compile --disable-xlib"
|
||||
elif [[ $target_system_name == "win" ]] && [[ $build_arch == "x86_64" ]]; then
|
||||
$SUDO apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
|
||||
export LDFLAGS="-static-libgcc -static-libstdc++ -static"
|
||||
extra_configure_flags="--target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --disable-w32threads"
|
||||
fi
|
||||
|
||||
if [[ $build_arch == "arm64" ]]; then
|
||||
extra_configure_flags="$extra_configure_flags --enable-neon"
|
||||
fi
|
||||
|
||||
pushd $src_dir
|
||||
./configure --arch=$build_arch \
|
||||
--disable-everything \
|
||||
--disable-static \
|
||||
--disable-doc \
|
||||
--disable-programs \
|
||||
--disable-swscale \
|
||||
--disable-avformat \
|
||||
--disable-swresample \
|
||||
--disable-avdevice \
|
||||
--disable-avfilter \
|
||||
--disable-debug \
|
||||
--enable-avcodec \
|
||||
--enable-shared \
|
||||
--enable-decoder="$DECODERS" \
|
||||
--enable-lto \
|
||||
--enable-stripping \
|
||||
$extra_configure_flags \
|
||||
--prefix="install_output"
|
||||
|
||||
make -j$(nproc) && make install
|
||||
|
||||
mkdir -p $output_path
|
||||
rm -f $output_path/*
|
||||
|
||||
if [[ $target_system_name == "linux" ]]; then
|
||||
cp -L install_output/lib/libavcodec.so.$LIBAVCODEC_VERSION $output_path
|
||||
cp -L install_output/lib/libavutil.so.$LIBAVUTIL_VERSION $output_path
|
||||
elif [[ $target_system_name == "macos" ]]; then
|
||||
cp -L install_output/lib/libavcodec.$LIBAVCODEC_VERSION.dylib $output_path
|
||||
cp -L install_output/lib/libavutil.$LIBAVUTIL_VERSION.dylib $output_path
|
||||
elif [[ $target_system_name == "win" ]]; then
|
||||
cp -L install_output/bin/avcodec-$LIBAVCODEC_VERSION.dll $output_path
|
||||
cp -L install_output/bin/avutil-$LIBAVUTIL_VERSION.dll $output_path
|
||||
fi
|
||||
popd
|
39
ci/run.sh
Executable file
39
ci/run.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -le 3 ]; then
|
||||
echo "usage: <src_dir> <output_path> <build_arch> <target_system_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
src_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
target_system_name=$4
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if command -v podman &> /dev/null; then
|
||||
DOCKER=podman
|
||||
elif command -v docker &> /dev/null; then
|
||||
DOCKER=docker
|
||||
fi
|
||||
|
||||
if [ $target_system_name == "linux" ] && [ $build_arch == "arm64" ]; then
|
||||
$DOCKER run --rm -v $SCRIPT_DIR:/scripts -v $output_path:/output -v $src_dir:/source -t arm64v8/ubuntu:focal bash /scripts/compile.sh /source /output $build_arch "$target_system_name"
|
||||
else
|
||||
$SCRIPT_DIR/compile.sh "$src_dir" "$output_path" "$build_arch" "$target_system_name"
|
||||
fi
|
Loading…
Reference in a new issue