Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg-chromium/
Date: Wed, 03 Nov 2021 09:30:43
Message-Id: 1635931799.0a256457c9cd486f2f7664775ec05530a7b07067.chewi@gentoo
1 commit: 0a256457c9cd486f2f7664775ec05530a7b07067
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 3 09:26:56 2021 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 3 09:29:59 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a256457
7
8 media-video/ffmpeg-chromium: Version bump to 96, EAPI 8
9
10 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
11
12 media-video/ffmpeg-chromium/Manifest | 1 +
13 .../ffmpeg-chromium/ffmpeg-chromium-96.ebuild | 231 +++++++++++++++++++++
14 2 files changed, 232 insertions(+)
15
16 diff --git a/media-video/ffmpeg-chromium/Manifest b/media-video/ffmpeg-chromium/Manifest
17 index 3e1116a6ede..caf2ba51ace 100644
18 --- a/media-video/ffmpeg-chromium/Manifest
19 +++ b/media-video/ffmpeg-chromium/Manifest
20 @@ -1 +1,2 @@
21 DIST ffmpeg-chromium-94.tar.gz 14709687 BLAKE2B 06dedbd86befd8caed4c6cb34755b52cf70630f8fbd712f89d42e5b63e498f9d2a77935fbd7c87194f6d56fb0f83ff26beba00357dd51b3ac3e2e4480ff4351e SHA512 a6cf5404c892c878c50e3ba8369456db587e327bc3d77e857b9d34f3665ecfee7d3865b20e9871ccda570b30d9d34c03fd981cdc7f495809ea8f12cb8f15937e
22 +DIST ffmpeg-chromium-96.tar.gz 14782341 BLAKE2B 686f5e0970ab49663e43d54cdb9b0216560dabc676711666c9e51840af64d2c78d47b55bcf36625751676839869e1b1f3b65516499646db00fd29f5ed2ff90d3 SHA512 169a1bf58000be0799b05b1d3f3a63b5a93ec66023d31f1ac6f5d9cd77408a390a9308fb626e94c3f1d4e1170638c1c81ac68b248e06c28d318d731ddda8e4d2
23
24 diff --git a/media-video/ffmpeg-chromium/ffmpeg-chromium-96.ebuild b/media-video/ffmpeg-chromium/ffmpeg-chromium-96.ebuild
25 new file mode 100644
26 index 00000000000..8dafc5bbbac
27 --- /dev/null
28 +++ b/media-video/ffmpeg-chromium/ffmpeg-chromium-96.ebuild
29 @@ -0,0 +1,231 @@
30 +# Copyright 1999-2021 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +inherit flag-o-matic toolchain-funcs
36 +
37 +COMMIT="d772086c1ec3d79dbf7098f0ba96beffc501e16f"
38 +DESCRIPTION="FFmpeg built specifically for codec support in Chromium-based browsers"
39 +HOMEPAGE="https://ffmpeg.org/"
40 +SRC_URI="https://dev.gentoo.org/~chewi/distfiles/${P}.tar.gz"
41 +
42 +SLOT="${PV}"
43 +LICENSE="
44 + !gpl? ( LGPL-2.1 )
45 + gpl? ( GPL-2 )
46 +"
47 +
48 +KEYWORDS="~amd64 ~arm ~arm64"
49 +
50 +# Options to use as use_enable in the foo[:bar] form.
51 +# This will feed configure with $(use_enable foo bar)
52 +# or $(use_enable foo foo) if no :bar is set.
53 +# foo is added to IUSE.
54 +FFMPEG_FLAG_MAP=(
55 + cpudetection:runtime-cpudetect debug
56 + +gpl
57 + vaapi vdpau vulkan
58 + # decoders
59 + mmal +opus:libopus
60 + video_cards_nvidia:ffnvcodec
61 + # Threads; we only support pthread for now but ffmpeg supports more
62 + +threads:pthreads
63 +)
64 +
65 +IUSE="
66 + ${FFMPEG_FLAG_MAP[@]%:*}
67 +"
68 +
69 +# Strings for CPU features in the useflag[:configure_option] form
70 +# if :configure_option isn't set, it will use 'useflag' as configure option
71 +ARM_CPU_FEATURES=(
72 + cpu_flags_arm_thumb:armv5te
73 + cpu_flags_arm_v6:armv6
74 + cpu_flags_arm_thumb2:armv6t2
75 + cpu_flags_arm_neon:neon
76 + cpu_flags_arm_vfp:vfp
77 + cpu_flags_arm_vfpv3:vfpv3
78 + cpu_flags_arm_v8:armv8
79 +)
80 +ARM_CPU_REQUIRED_USE="
81 + arm64? ( cpu_flags_arm_v8 )
82 + cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
83 + cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
84 + cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
85 + cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
86 + cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
87 +"
88 +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 )
89 +X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
90 +X86_CPU_REQUIRED_USE="
91 + cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
92 + cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
93 + cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
94 + cpu_flags_x86_xop? ( cpu_flags_x86_avx )
95 + cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
96 + cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
97 + cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
98 + cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
99 + cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
100 + cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
101 + cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
102 + cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
103 + cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
104 + cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
105 + cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
106 +"
107 +
108 +CPU_FEATURES_MAP=(
109 + ${ARM_CPU_FEATURES[@]}
110 + ${X86_CPU_FEATURES[@]}
111 +)
112 +IUSE="${IUSE}
113 + ${CPU_FEATURES_MAP[@]%:*}"
114 +
115 +CPU_REQUIRED_USE="
116 + ${ARM_CPU_REQUIRED_USE}
117 + ${X86_CPU_REQUIRED_USE}
118 +"
119 +
120 +RDEPEND="
121 + mmal? ( media-libs/raspberrypi-userland )
122 + opus? ( >=media-libs/opus-1.0.2-r2 )
123 + vaapi? ( >=x11-libs/libva-1.2.1-r1:0= )
124 + video_cards_nvidia? ( >=media-libs/nv-codec-headers-9.1.23.1 )
125 + vdpau? ( >=x11-libs/libvdpau-0.7 )
126 + vulkan? ( >=media-libs/vulkan-loader-1.1.97:= )
127 +"
128 +
129 +DEPEND="${RDEPEND}
130 +"
131 +BDEPEND="
132 + >=sys-devel/make-3.81
133 + virtual/pkgconfig
134 + cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
135 +"
136 +
137 +REQUIRED_USE="
138 + ${CPU_REQUIRED_USE}"
139 +RESTRICT="
140 + test
141 +"
142 +
143 +S="${WORKDIR}"
144 +
145 +PATCHES=(
146 + "${FILESDIR}"/${PN}-94.patch
147 + "${FILESDIR}"/chromium.patch
148 +)
149 +
150 +src_prepare() {
151 + export revision=git-N-g${COMMIT:0:10}
152 + default
153 + echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
154 +}
155 +
156 +src_configure() {
157 + local myconf=( )
158 +
159 + local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
160 +
161 + for i in "${ffuse[@]#+}" ; do
162 + myconf+=( $(use_enable ${i%:*} ${i#*:}) )
163 + done
164 +
165 + # CPU features
166 + for i in "${CPU_FEATURES_MAP[@]}" ; do
167 + use ${i%:*} || myconf+=( --disable-${i#*:} )
168 + done
169 +
170 + # Try to get cpu type based on CFLAGS.
171 + # Bug #172723
172 + # We need to do this so that features of that CPU will be better used
173 + # If they contain an unknown CPU it will not hurt since ffmpeg's configure
174 + # will just ignore it.
175 + for i in $(get-flag mcpu) $(get-flag march) ; do
176 + [[ ${i} = native ]] && i="host" # bug #273421
177 + myconf+=( --cpu=${i} )
178 + break
179 + done
180 +
181 + # LTO support, bug #566282, bug #754654
182 + is-flagq "-flto*" && myconf+=( "--enable-lto" )
183 + filter-flags "-flto*"
184 +
185 + # Mandatory configuration
186 + myconf=(
187 + --disable-stripping
188 + # This is only for hardcoded cflags; those are used in configure checks that may
189 + # interfere with proper detections, bug #671746 and bug #645778
190 + # We use optflags, so that overrides them anyway.
191 + --disable-optimizations
192 + --disable-libcelt # bug #664158
193 + "${myconf[@]}"
194 + )
195 +
196 + # cross compile support
197 + if tc-is-cross-compiler ; then
198 + myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
199 + case ${CHOST} in
200 + *freebsd*)
201 + myconf+=( --target-os=freebsd )
202 + ;;
203 + *mingw32*)
204 + myconf+=( --target-os=mingw32 )
205 + ;;
206 + *linux*)
207 + myconf+=( --target-os=linux )
208 + ;;
209 + esac
210 + fi
211 +
212 + local extra_libs
213 + if use arm || use ppc ; then
214 + # bug #782811
215 + # bug #790590
216 + extra_libs+="$(test-flags-CCLD -latomic) "
217 + fi
218 +
219 + set -- "${S}/configure" \
220 + --prefix="${EPREFIX}/usr" \
221 + --libdir="${EPREFIX}/usr/$(get_libdir)" \
222 + --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
223 + --cc="$(tc-getCC)" \
224 + --cxx="$(tc-getCXX)" \
225 + --ar="$(tc-getAR)" \
226 + --nm="$(tc-getNM)" \
227 + --ranlib="$(tc-getRANLIB)" \
228 + --pkg-config="$(tc-getPKG_CONFIG)" \
229 + --optflags="${CFLAGS}" \
230 + --extra-libs="${extra_libs}" \
231 + --disable-all \
232 + --disable-autodetect \
233 + --disable-error-resilience \
234 + --disable-everything \
235 + --disable-faan \
236 + --disable-iconv \
237 + --disable-lzo \
238 + --disable-network \
239 + --enable-avcodec \
240 + --enable-avformat \
241 + --enable-avutil \
242 + --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,theora,vorbis,vp8 \
243 + --enable-demuxer=aac,flac,matroska,mov,mp3,ogg,wav \
244 + --enable-parser=aac,flac,h264,mpegaudio,opus,vorbis,vp3,vp8,vp9 \
245 + --enable-pic \
246 + --enable-static \
247 + "${myconf[@]}" \
248 + ${EXTRA_FFMPEG_CONF}
249 +
250 + echo "${@}"
251 + "${@}" || die
252 +}
253 +
254 +src_compile() {
255 + emake V=1 libffmpeg
256 +}
257 +
258 +src_install() {
259 + emake V=1 DESTDIR="${D}" install-libffmpeg
260 +}