From a9a4d04f99f2a7259c9d5cb4a4e96e83d090cd62 Mon Sep 17 00:00:00 2001 From: Matt Jolly Date: Sat, 8 Aug 2026 09:54:30 +1000 Subject: [PATCH] media-video/ffmpeg-chromium: add 152 Signed-off-by: Matt Jolly --- media-video/ffmpeg-chromium/Manifest | 1 + .../ffmpeg-chromium-152.ebuild | 240 ++++++++++++++++++ ...hromium-152-configure-enable-libopus.patch | 61 +++++ 3 files changed, 302 insertions(+) create mode 100644 media-video/ffmpeg-chromium/ffmpeg-chromium-152.ebuild create mode 100644 media-video/ffmpeg-chromium/files/ffmpeg-chromium-152-configure-enable-libopus.patch diff --git a/media-video/ffmpeg-chromium/Manifest b/media-video/ffmpeg-chromium/Manifest index 1b9420b89d378..c20bb660638e4 100644 --- a/media-video/ffmpeg-chromium/Manifest +++ b/media-video/ffmpeg-chromium/Manifest @@ -13,3 +13,4 @@ DIST ffmpeg-chromium-149.tar.xz 11205008 BLAKE2B 335db3d049d8619a794b344d47d2863 DIST ffmpeg-chromium-150.0.7871.124.tar.xz 11330684 BLAKE2B 3c5341f3020304934daac23218dd4db50152ce4463d1572a63e1a903ed32f43226f8add835d2504370be83deb4a2b109e5049bb18b49fe3f8af0c18ba63451c7 SHA512 d57e15b0f4709f03155ca1128ec09655aa694f19d8264bec0f4b6631d3101ed2640b10960121f08ce8dd8985258295632b1bd3fa5be1adb7f57b934a3d79eb6b DIST ffmpeg-chromium-150.tar.xz 11206644 BLAKE2B 311dbca2958af510515b6639a00cd570e0b0395b5c0edb3df1e22e65302e24747eaff9c102488dbf309f001d137a75013cb818b1903bc8b36ecf3418602ec75c SHA512 fefb456b890c89020e0795be160f20dfb378b3353237a5ecd907b71ece548950ef29bb9352e2de6ab9ab84f3003d944af67f6bc12c0f978b5db49f6a5f0176dc DIST ffmpeg-chromium-151.tar.xz 11334732 BLAKE2B 2881c5264c0042575385730eaf0bae00c1065762d120f3db519d849204278f9326f5f8b262bf34cfa6f1e11cb79853bc6d5a282dfb4f2fe624bd876fe8d41e37 SHA512 51edddf7ed0618da896e3f4491434f5d0499d59696e66d580ee48244c4b979d5310cd5c78d1a8b97ab5555c4fb3b54e82d8e15b2130c06002ef1b8a2f5c2c39c +DIST ffmpeg-chromium-152.tar.xz 11574900 BLAKE2B 612f6b973a5900d54dfa04654ea71f07a5500760c7bfca084533f8076420044988642b09e78858fba7dc27009fb83a721a643cabb98e99d501d28e5ad8fe73e0 SHA512 506a1f394e828639f406aba8e8ad7482f30a07934e8b8930735688f524ff13f3570fd535ee035f8682e8eca744356238ac181fc2113d883c2e44694ffef62237 diff --git a/media-video/ffmpeg-chromium/ffmpeg-chromium-152.ebuild b/media-video/ffmpeg-chromium/ffmpeg-chromium-152.ebuild new file mode 100644 index 0000000000000..74d166fd51919 --- /dev/null +++ b/media-video/ffmpeg-chromium/ffmpeg-chromium-152.ebuild @@ -0,0 +1,240 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=9 + +inherit flag-o-matic toolchain-funcs + +COMMIT=2b68d2babae73714846961fb0ee47e3b3d2e39a9 +DESCRIPTION="FFmpeg built specifically for codec support in Chromium-based browsers" +HOMEPAGE="https://ffmpeg.org/" +SRC_URI="https://deps.gentoo.zip/media-video/${P}.tar.xz" + +LICENSE=" + !gpl? ( LGPL-2.1 ) + gpl? ( GPL-2 ) +" +SLOT="${PV}" + +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64" + +# Options to use as use_enable in the foo[:bar] form. +# This will feed configure with $(use_enable foo bar) +# or $(use_enable foo foo) if no :bar is set. +# foo is added to IUSE. +FFMPEG_FLAG_MAP=( + cpudetection:runtime-cpudetect debug + +gpl + vaapi vdpau vulkan + nvenc:ffnvcodec + # Threads; we only support pthread for now but ffmpeg supports more + +threads:pthreads +) + +IUSE=" + ${FFMPEG_FLAG_MAP[@]%:*} +" + +# Strings for CPU features in the useflag[:configure_option] form +# if :configure_option isn't set, it will use 'useflag' as configure option +ARM_CPU_FEATURES=( + cpu_flags_arm_thumb:armv5te + cpu_flags_arm_v6:armv6 + cpu_flags_arm_thumb2:armv6t2 + cpu_flags_arm_neon:neon + cpu_flags_arm_vfp:vfp + cpu_flags_arm_vfpv3:vfpv3 + cpu_flags_arm_v8:armv8 + cpu_flags_arm_asimddp:dotprod + cpu_flags_arm_i8mm:i8mm +) +ARM_CPU_REQUIRED_USE=" + arm64? ( cpu_flags_arm_v8 ) + cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon ) + cpu_flags_arm_neon? ( + cpu_flags_arm_vfp + arm? ( cpu_flags_arm_thumb2 ) + ) + cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp ) + cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 ) + cpu_flags_arm_v6? ( + arm? ( cpu_flags_arm_thumb ) + ) +" +X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx + mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop ) +X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} ) +X86_CPU_REQUIRED_USE=" + cpu_flags_x86_avx2? ( cpu_flags_x86_avx ) + cpu_flags_x86_fma4? ( cpu_flags_x86_avx ) + cpu_flags_x86_fma3? ( cpu_flags_x86_avx ) + cpu_flags_x86_xop? ( cpu_flags_x86_avx ) + cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 ) + cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 ) + cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 ) + cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 ) + cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 ) + cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 ) + cpu_flags_x86_sse2? ( cpu_flags_x86_sse ) + cpu_flags_x86_sse? ( cpu_flags_x86_mmxext ) + cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx ) + cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow ) + cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx ) +" + +CPU_FEATURES_MAP=( + ${ARM_CPU_FEATURES[@]} + ${X86_CPU_FEATURES[@]} +) +IUSE="${IUSE} + ${CPU_FEATURES_MAP[@]%:*}" + +CPU_REQUIRED_USE=" + ${ARM_CPU_REQUIRED_USE} + ${X86_CPU_REQUIRED_USE} +" + +RDEPEND=" + >=media-libs/opus-1.0.2-r2 + vaapi? ( >=media-libs/libva-1.2.1-r1:0= ) + nvenc? ( >=media-libs/nv-codec-headers-11.1.5.3 ) + vdpau? ( >=x11-libs/libvdpau-0.7 ) + vulkan? ( >=media-libs/vulkan-loader-1.3.277:= ) +" + +DEPEND="${RDEPEND} + vulkan? ( >=dev-util/vulkan-headers-1.3.277 ) +" +BDEPEND=" + >=dev-build/make-3.81 + virtual/pkgconfig + cpu_flags_x86_mmx? ( >=dev-lang/nasm-2.13 ) +" + +REQUIRED_USE=" + vulkan? ( threads ) + ${CPU_REQUIRED_USE}" +RESTRICT=" + test +" + +PATCHES=( + "${FILESDIR}"/${PN}-152-configure-enable-libopus.patch + "${FILESDIR}"/chromium.patch +) + +src_prepare() { + export revision=git-N-g${COMMIT:0:10} + default + + echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die +} + +src_configure() { + local myconf=( ) + + # Bug #918997. Will probably be fixed upstream in the next release. + use vulkan && append-ldflags -Wl,-z,muldefs + + local ffuse=( "${FFMPEG_FLAG_MAP[@]}" ) + + for i in "${ffuse[@]#+}" ; do + myconf+=( $(use_enable ${i%:*} ${i#*:}) ) + done + + # CPU features + for i in "${CPU_FEATURES_MAP[@]}" ; do + use ${i%:*} || myconf+=( --disable-${i#*:} ) + done + + # Try to get cpu type based on CFLAGS. + # Bug #172723 + # We need to do this so that features of that CPU will be better used + # If they contain an unknown CPU it will not hurt since ffmpeg's configure + # will just ignore it. + for i in $(get-flag mcpu) $(get-flag march) ; do + [[ ${i} = native ]] && i="host" # bug #273421 + if use arm64; then # 830165 - 'host' explicitly not supported on arm64 + [[ ${i} != host ]] && myconf+=( --cpu=${i} ) + else + myconf+=( --cpu=${i} ) + fi + break + done + + # LTO support, bug #566282, bug #754654, bug #772854 + if [[ ${ABI} != x86 ]] && tc-is-lto; then + # Respect -flto value, e.g -flto=thin + local v="$(get-flag flto)" + [[ -n ${v} ]] && myconf+=( "--enable-lto=${v}" ) || myconf+=( "--enable-lto" ) + fi + filter-lto + + # Mandatory configuration + myconf=( + --disable-stripping + # This is only for hardcoded cflags; those are used in configure checks that may + # interfere with proper detections, bug #671746 and bug #645778 + # We use optflags, so that overrides them anyway. + --disable-optimizations + "${myconf[@]}" + ) + + # cross compile support + if tc-is-cross-compiler ; then + myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" ) + case ${CHOST} in + *mingw32*) + myconf+=( --target-os=mingw32 ) + ;; + *linux*) + myconf+=( --target-os=linux ) + ;; + esac + fi + + # Use --extra-libs if needed for LIBS + set -- "${S}/configure" \ + --prefix="${EPREFIX}/usr" \ + --libdir="${EPREFIX}/usr/$(get_libdir)" \ + --shlibdir="${EPREFIX}/usr/$(get_libdir)" \ + --cc="$(tc-getCC)" \ + --cxx="$(tc-getCXX)" \ + --ar="$(tc-getAR)" \ + --nm="$(tc-getNM)" \ + --strip="$(tc-getSTRIP)" \ + --ranlib="$(tc-getRANLIB)" \ + --pkg-config="$(tc-getPKG_CONFIG)" \ + --optflags="${CFLAGS}" \ + --extra-cflags="-DCHROMIUM_NO_LOGGING" \ + --disable-all \ + --disable-autodetect \ + --disable-error-resilience \ + --disable-everything \ + --disable-faan \ + --disable-iamf \ + --disable-iconv \ + --disable-network \ + --enable-avcodec \ + --enable-avformat \ + --enable-avutil \ + --enable-libopus \ + --enable-decoder=aac,flac,h264,libopus,mp3,pcm_alaw,pcm_f32le,pcm_mulaw,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_s32le,pcm_u8,vorbis \ + --enable-demuxer=aac,flac,matroska,mov,mp3,ogg,wav \ + --enable-parser=aac,flac,h264,mpegaudio,opus,vorbis,vp9 \ + --enable-pic \ + --enable-static \ + "${myconf[@]}" \ + ${EXTRA_FFMPEG_CONF} + + echo "${@}" + "${@}" || die +} + +src_compile() { + emake V=1 libffmpeg +} + +src_install() { + emake V=1 DESTDIR="${D}" install-libffmpeg +} diff --git a/media-video/ffmpeg-chromium/files/ffmpeg-chromium-152-configure-enable-libopus.patch b/media-video/ffmpeg-chromium/files/ffmpeg-chromium-152-configure-enable-libopus.patch new file mode 100644 index 0000000000000..b496a20073451 --- /dev/null +++ b/media-video/ffmpeg-chromium/files/ffmpeg-chromium-152-configure-enable-libopus.patch @@ -0,0 +1,61 @@ +From 03a23253cba4f13b993cbd5c0bfed8c7dbe0faaa Mon Sep 17 00:00:00 2001 +From: Matt Jolly +Date: Sat, 8 Aug 2026 09:50:12 +1000 +Subject: [PATCH] update chromium libopus patch for M152 + +Signed-off-by: Matt Jolly +--- a/configure ++++ b/configure +@@ -7446,14 +7446,14 @@ enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/ + { check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version || + require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } } + # Chromium uses a built in copy of libopus that is not visible to pkg-config. +-# enabled libopus && { +-# enabled libopus_decoder && { +-# require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create +-# } +-# enabled libopus_encoder && { +-# require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create +-# } +-# } ++enabled libopus && { ++ enabled libopus_decoder && { ++ require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create ++ } ++ enabled libopus_encoder && { ++ require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create ++ } ++} + enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 7.351.0" libplacebo/vulkan.h pl_vulkan_create + enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new + enabled libqrencode && require_pkg_config libqrencode libqrencode qrencode.h QRcode_encodeString +--- /dev/null ++++ b/configure.rej +@@ -0,0 +1,24 @@ ++diff a/configure b/configure (rejected hunks) ++@@ -7042,14 +7042,14 @@ enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/ ++ { check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version || ++ require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } } ++ # Chromium uses a built in copy of libopus that is not visible to pkg-config. ++-# enabled libopus && { ++-# enabled libopus_decoder && { ++-# require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create ++-# } ++-# enabled libopus_encoder && { ++-# require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create ++-# } ++-# } +++enabled libopus && { +++ enabled libopus_decoder && { +++ require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create +++ } +++ enabled libopus_encoder && { +++ require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create +++ } +++} ++ enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 5.229.0" libplacebo/vulkan.h pl_vulkan_create ++ enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new ++ enabled libqrencode && require_pkg_config libqrencode libqrencode qrencode.h QRcode_encodeString +-- +2.55.0 +