Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/build-ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ jobs:
- name: Build FFmpeg
env:
CIBW_ARCHS: ${{ matrix.msys_prefix && 'AMD64' || matrix.arch }}
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --community
CIBW_BEFORE_BUILD_WINDOWS: python scripts\build-ffmpeg.py C:\cibw\vendor --community
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor
CIBW_BEFORE_BUILD_WINDOWS: python scripts\build-ffmpeg.py C:\cibw\vendor
CIBW_BUILD: cp311-*
CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair --exclude libmvec.so.1 --exclude libmvec-2.so --exclude libmvec.so --exclude libmvec -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_ALL_LINUX: ./scripts/install-static-clang.sh
CIBW_BEFORE_BUILD_LINUX: python scripts/build-ffmpeg.py /tmp/vendor --community
CIBW_BEFORE_BUILD_LINUX: python scripts/build-ffmpeg.py /tmp/vendor
CIBW_BUILD: cp311-${{ matrix.build }}${{ matrix.arch }}
CIBW_ENVIRONMENT_LINUX: >
CC="/opt/clang/bin/clang"
Expand Down
33 changes: 6 additions & 27 deletions scripts/build-ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import subprocess
import sys

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

plat = platform.system()
is_musllinux = plat == "Linux" and platform.libc_ver()[0] != "glibc"
Expand Down Expand Up @@ -40,8 +40,6 @@ def calculate_sha256(filename: str) -> str:
sha256="fe9ff51cb1f2abb5e65a6b8c10a92da0ab5ab6eaf26e7fc2b675c45f1fb519b5",
requires=["gmp"],
build_arguments=["--disable-documentation"],
# build randomly fails with "*** missing separator. Stop."
build_parallel=False,
),
Package(
name="gnutls",
Expand Down Expand Up @@ -155,7 +153,6 @@ def calculate_sha256(filename: str) -> str:
source_url="https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz",
sha256="483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1",
build_arguments=["--disable-dependency-tracking"],
when=When.community_only,
),
Package(
name="x264",
Expand Down Expand Up @@ -277,20 +274,12 @@ def make_tarball_name() -> str:
def main():
parser = argparse.ArgumentParser("build-ffmpeg")
parser.add_argument("destination")
parser.add_argument("--community", action="store_true")

args = parser.parse_args()

dest_dir = os.path.abspath(args.destination)
community = args.community

# Use ALSA only on Linux.
use_alsa = plat == "Linux"

# Use CUDA if supported.
use_cuda = plat in {"Linux", "Windows"}

# Use AMD AMF if supported.
use_amf = plat in {"Linux", "Windows"}

# Use Intel VPL (Video Processing Library) if supported to enable Intel QSV (Quick Sync Video)
Expand Down Expand Up @@ -355,8 +344,8 @@ def main():
"--enable-gnutls" if use_gnutls else "--disable-gnutls",
"--enable-libdav1d",
"--enable-libmp3lame",
"--enable-libopencore-amrnb" if community else "--disable-libopencore-amrnb",
"--enable-libopencore-amrwb" if community else "--disable-libopencore-amrwb",
"--enable-libopencore-amrnb",
"--enable-libopencore-amrwb",
"--enable-libopus",
"--enable-libspeex",
"--enable-libsvtav1",
Expand Down Expand Up @@ -423,18 +412,10 @@ def main():
packages += codec_group
packages += [ffmpeg_package]

filtered_packages = []
for package in packages:
if package.when == When.community_only and not community:
continue
if package.when == When.commercial_only and community:
continue
filtered_packages.append(package)

download_tars(build_tools + filtered_packages)
download_tars(build_tools + packages)
for tool in build_tools:
builder.build(tool, for_builder=True)
for package in filtered_packages:
for package in packages:
builder.build(package)

if plat == "Windows":
Expand Down Expand Up @@ -479,10 +460,8 @@ def main():
elif plat == "Windows":
libraries = glob.glob(os.path.join(dest_dir, "bin", "*.dll"))

# strip libraries
if plat == "Darwin":
run(["strip", "-S"] + libraries)
run(["otool", "-L"] + libraries)
run(["strip", "-x", "-S"] + libraries)
else:
run(["strip", "-s"] + libraries)

Expand Down
8 changes: 0 additions & 8 deletions scripts/cibuildpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import time
from collections.abc import Iterator
from dataclasses import dataclass, field, replace
from enum import IntEnum


def fetch(url: str, path: str) -> None:
Expand Down Expand Up @@ -78,12 +77,6 @@ def run(cmd: list[str], env=None) -> None:
raise e


class When(IntEnum):
always = 0
community_only = 1
commercial_only = 2


@dataclass(slots=True)
class Package:
name: str
Expand All @@ -96,7 +89,6 @@ class Package:
requires: list[str] = field(default_factory=list)
source_dir: str = ""
source_filename: str = ""
when: When = When.always

def __lt__(self, other):
return self.name < other.name
Expand Down
3 changes: 0 additions & 3 deletions scripts/sbom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def main():
f"Currently FFmpeg {get_version(ffmpeg_package)} is built with the following packages enabled for all platforms:\n"
)

for package in sorted(library_group):
print(f"- {package.name} {get_version(package)}")

for package in codec_group:
print(f"- {package.name} {get_version(package)}")

Expand Down