diff --git a/.github/workflows/build-ffmpeg.yml b/.github/workflows/build-ffmpeg.yml index dbb13b42..0c30ef42 100644 --- a/.github/workflows/build-ffmpeg.yml +++ b/.github/workflows/build-ffmpeg.yml @@ -43,24 +43,32 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.13" - - 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: Set deployment target for macOS 13 + if: matrix.os == 'macos-13' + run: echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV + - name: Set deployment target for macOS 14 + if: matrix.os == 'macos-14' + run: echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV + - name: Install packages for macOS if: matrix.os == 'macos-13' || matrix.os == 'macos-14' run: | brew update + brew install pkg-config srt brew unlink gettext libidn2 libpng libtiff libunistring libx11 libxau libxcb libxdmcp little-cms2 unbound - 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 env: CIBW_ARCHS: ${{ matrix.arch }} - CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl + CIBW_BEFORE_BUILD_LINUX: | + yum update + yum install -y tcl cmake gcc gcc-c++ + python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl + CIBW_BEFORE_BUILD_MACOS: python scripts/build-ffmpeg.py /tmp/vendor --enable-gpl CIBW_BEFORE_BUILD_WINDOWS: python scripts\build-ffmpeg.py C:\cibw\vendor --enable-gpl CIBW_BUILD: cp39-* CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair -w {dest_dir} {wheel} @@ -71,6 +79,12 @@ jobs: pip install cibuildwheel delvewheel cibuildwheel --output-dir output rm -f output/*.whl + - name: Print config.log + if: ${{ failure() }} + run: cat /d/a/pyav-ffmpeg/pyav-ffmpeg/build/ffmpeg/build/ffbuild/config.log + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 - name: Upload FFmpeg uses: actions/upload-artifact@v4 with: diff --git a/scripts/build-ffmpeg.py b/scripts/build-ffmpeg.py index a45a1161..0b47225b 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 = [ @@ -172,6 +173,12 @@ 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 [""], + ), ] openh264 = Package( @@ -323,6 +330,7 @@ def main(): "--enable-libopencore-amrwb", "--enable-libopus", "--enable-libspeex", + "--enable-libsrt", "--enable-libtwolame", "--enable-libvorbis", "--enable-libvpx", @@ -426,3 +434,4 @@ def main(): if __name__ == "__main__": main() + diff --git a/scripts/cibuildpkg.py b/scripts/cibuildpkg.py index 63117756..0aa881e6 100644 --- a/scripts/cibuildpkg.py +++ b/scripts/cibuildpkg.py @@ -238,6 +238,7 @@ 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")) + # build package os.makedirs(package_build_path, exist_ok=True) @@ -273,6 +274,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) @@ -429,7 +433,13 @@ def _environment(self, *, for_builder: bool) -> dict[str, str]: self._mangle_path(os.path.join(prefix, "lib", "pkgconfig")), separator=":", ) - + prepend_env( + env, + "PKG_CONFIG_PATH", + "/c/msys64/usr/lib/pkgconfig", + separator=":", + ) + if platform.system() == "Darwin" and not for_builder: arch_flags = os.environ["ARCHFLAGS"] for var in ["CFLAGS", "CXXFLAGS", "LDFLAGS"]: