From d9ae1a1b19f08a200fa95f1c09b22a3cf82b47dc Mon Sep 17 00:00:00 2001 From: Joe Schiffler <41972063+JoeSchiff@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:44:46 -0500 Subject: [PATCH] bundle srt --- .github/workflows/build-ffmpeg.yml | 8 +++++--- README.rst | 1 + scripts/build-ffmpeg.py | 11 +++++++++++ scripts/cibuildpkg.py | 12 +++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-ffmpeg.yml b/.github/workflows/build-ffmpeg.yml index dbb13b42..8cd30520 100644 --- a/.github/workflows/build-ffmpeg.yml +++ b/.github/workflows/build-ffmpeg.yml @@ -46,7 +46,7 @@ jobs: - name: Set deployment target if: matrix.os == 'macos-13' || matrix.os == 'macos-14' run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV - - name: Install packages + - name: Install packages for macOS if: matrix.os == 'macos-13' || matrix.os == 'macos-14' run: | brew update @@ -54,7 +54,7 @@ jobs: - uses: msys2/setup-msys2@v2 if: matrix.os == 'windows-latest' with: - install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gperf mingw-w64-x86_64-nasm + install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gperf mingw-w64-x86_64-nasm openssl-devel path-type: inherit release: false - name: Build FFmpeg @@ -131,7 +131,9 @@ jobs: - name: Build FFmpeg env: CIBW_ARCHS: ${{ matrix.arch }} - CIBW_BEFORE_ALL_LINUX: cp -ar vendor /tmp + CIBW_BEFORE_ALL_LINUX: | + yum install -y openssl-devel + cp -ar vendor /tmp CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl --stage ${{ env.stage }} CIBW_BUILD: cp39-* CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair -w {dest_dir} {wheel} diff --git a/README.rst b/README.rst index 19d3c07b..6123798c 100644 --- a/README.rst +++ b/README.rst @@ -27,6 +27,7 @@ Currently FFmpeg 7.1 is built with the following packages enabled for all platfo - opus 1.4 - speex 1.2.1 - svt-av1 2.2.1 +- srt 1.5.4 (encryption disabled on macOS) - twolame 0.4.0 - vorbis 1.3.7 - vpx 1.14.0 diff --git a/scripts/build-ffmpeg.py b/scripts/build-ffmpeg.py index 34acf240..51d17525 100644 --- a/scripts/build-ffmpeg.py +++ b/scripts/build-ffmpeg.py @@ -7,6 +7,7 @@ from cibuildpkg import Builder, Package, fetch, get_platform, log_group, run + plat = platform.system() library_group = [ @@ -177,6 +178,15 @@ source_dir="source", gpl=True, ), + Package( + name="srt", + source_url="https://github.com/Haivision/srt/archive/refs/tags/v1.5.4.tar.gz", + build_system="cmake", + build_arguments = + [r"-DOPENSSL_ROOT_DIR=C:\Program Files\OpenSSL"] if plat == "Windows" + else ["-DENABLE_ENCRYPTION=OFF"] if plat == "Darwin" + else [""] + ), ] openh264 = Package( @@ -329,6 +339,7 @@ def main(): "--enable-libopus", "--enable-libspeex", "--enable-libsvtav1", + "--enable-libsrt", "--enable-libtwolame", "--enable-libvorbis", "--enable-libvpx", diff --git a/scripts/cibuildpkg.py b/scripts/cibuildpkg.py index 63117756..14ea2d08 100644 --- a/scripts/cibuildpkg.py +++ b/scripts/cibuildpkg.py @@ -238,7 +238,14 @@ def _build_with_autoconf(self, package: Package, for_builder: bool) -> None: if package.name == "ffmpeg" and platform.system() == "Windows": correct_configure(os.path.join(package_source_path, "configure")) - + prepend_env(env, "LDFLAGS", "-LC:/PROGRA~1/OpenSSL/lib") + prepend_env( + env, + "PKG_CONFIG_PATH", + "/c/msys64/usr/lib/pkgconfig", + separator=":", + ) + # build package os.makedirs(package_build_path, exist_ok=True) with chdir(package_build_path): @@ -274,6 +281,9 @@ def _build_with_cmake(self, package: Package, for_builder: bool) -> None: if platform.system() == "Darwin": cmake_args.append("-DCMAKE_INSTALL_NAME_DIR=" + os.path.join(prefix, "lib")) + if package.name == "srt" and platform.system() == "Linux": + run(["yum", "-y", "install", "openssl-devel"]) + # build package os.makedirs(package_build_path, exist_ok=True) with chdir(package_build_path):