Skip to content

Commit

Permalink
bundle srt
Browse files Browse the repository at this point in the history
  • Loading branch information
joepers committed Dec 8, 2024
1 parent c7376d2 commit dc5d507
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -71,6 +79,9 @@ jobs:
pip install cibuildwheel delvewheel
cibuildwheel --output-dir output
rm -f output/*.whl
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
- name: Upload FFmpeg
uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 9 additions & 0 deletions scripts/build-ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from cibuildpkg import Builder, Package, fetch, get_platform, log_group, run


plat = platform.system()

library_group = [
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -323,6 +330,7 @@ def main():
"--enable-libopencore-amrwb",
"--enable-libopus",
"--enable-libspeex",
"--enable-libsrt",
"--enable-libtwolame",
"--enable-libvorbis",
"--enable-libvpx",
Expand Down Expand Up @@ -426,3 +434,4 @@ def main():

if __name__ == "__main__":
main()

12 changes: 11 additions & 1 deletion scripts/cibuildpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"]:
Expand Down

0 comments on commit dc5d507

Please sign in to comment.