Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,45 @@ jobs:
path: win-arm64

build-linux:
name: Build Linux (x64)
name: Build Linux
# Use 20.04 to target glibc 2.31 like the other native libs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]

steps:
- name: Install dependencies
- name: Install dependencies (x64)
if: matrix.arch == 'x64'
run: |
sudo apt-get update
sudo apt-get install nasm

- name: Install dependencies (arm64)
if: matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install \
make \
gcc-aarch64-linux-gnu \
libc-dev-arm64-cross \
binutils-aarch64-linux-gnu \
pkg-config-aarch64-linux-gnu

- name: Checkout
uses: actions/checkout@v4

- name: Build
run: osu.Framework.NativeLibs/scripts/ffmpeg/build-linux.sh
env:
arch: ${{ matrix.arch }}

- name: Upload
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: linux-x64
name: linux-${{ matrix.arch }}
path: linux-${{ matrix.arch }}

build-android:
name: Build Android
Expand Down Expand Up @@ -245,6 +264,10 @@ jobs:
with:
name: linux-x64
path: osu.Framework.NativeLibs/runtimes/linux-x64/native
- uses: actions/download-artifact@v4
with:
name: linux-arm64
path: osu.Framework.NativeLibs/runtimes/linux-arm64/native
- uses: actions/download-artifact@v4
with:
name: win-arm64
Expand Down
33 changes: 30 additions & 3 deletions osu.Framework.NativeLibs/scripts/ffmpeg/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,45 @@ SCRIPT_PATH=$(pwd)
popd > /dev/null
source "$SCRIPT_PATH/common.sh"

if [ -z "${arch-}" ]; then
PS3='Build for which arch? '
select arch in "x64" "arm64"; do
if [ -z "$arch" ]; then
echo "invalid option"
else
break
fi
done
fi

case $arch in
x64)
FFMPEG_FLAGS+=(
--arch=x86_64
)
;;

arm64)
FFMPEG_FLAGS+=(
--enable-cross-compile
--arch=aarch64
--cross-prefix=aarch64-linux-gnu-
)
;;
esac

FFMPEG_FLAGS+=(
--target-os=linux
)

pushd . > /dev/null
prep_ffmpeg linux-x64
prep_ffmpeg "linux-$arch"
build_ffmpeg
popd > /dev/null

# gcc creates multiple symlinks per .so file for versioning.
# We delete the symlinks and rename the real files to include the major library version
rm linux-x64/*.so
for f in linux-x64/*.so.*.*.*; do
rm linux-$arch/*.so
for f in linux-$arch/*.so.*.*.*; do
mv -vf "$f" "${f%.*.*}"
done
Loading