blob: fab28bf6a6d5dd5a066bf8d87bd7060be5a5a97c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{13..14} )
inherit edo flag-o-matic multiprocessing python-any-r1 toolchain-funcs xdg
DESCRIPTION="Open-source, GPL-licensed, multiplatform, multithreaded video transcoder"
HOMEPAGE="https://handbrake.fr/ https://github.com/HandBrake/HandBrake"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/HandBrake/HandBrake.git"
else
inherit verify-sig
MY_P="HandBrake-${PV}"
SRC_URI="
https://github.com/HandBrake/HandBrake/releases/download/${PV}/${MY_P}-source.tar.bz2
-> ${P}.tar.bz2
verify-sig? (
https://github.com/HandBrake/HandBrake/releases/download/${PV}/${MY_P}-source.tar.bz2.sig
-> ${P}.tar.bz2.sig
)
"
S="${WORKDIR}/${MY_P}"
KEYWORDS="~amd64 ~arm64 ~x86"
fi
# contrib/<project>/module.defs
declare -A BUNDLED=(
# Heavily patched in an incompatible way.
# Issues related to using system ffmpeg historically.
# See bug #829595 and #922828
[ffmpeg]="https://ffmpeg.org/releases/ffmpeg-9.0.2.tar.bz2;"
# Patched in an incompatible way
[x265]="https://github.com/Multicorewareinc/x265/releases/download/4.3/x265_4.3.tar.gz;x265"
[x265_8bit]="https://github.com/Multicorewareinc/x265/releases/download/4.3/x265_4.3.tar.gz;x265"
[x265_10bit]="https://github.com/Multicorewareinc/x265/releases/download/4.3/x265_4.3.tar.gz;x265"
[x265_12bit]="https://github.com/Multicorewareinc/x265/releases/download/4.3/x265_4.3.tar.gz;x265"
)
bundle_src_uri() {
local name
for name in "${!BUNDLED[@]}"; do
local OLDIFS splitted tarball uri use
OLDIFS=$IFS; IFS=';'; splitted=( ${BUNDLED[${name}]} ); IFS=$OLDIFS
uri=${splitted[0]}
use=${splitted[1]}
tarball=${uri##*/}
if [[ -n ${use} ]]; then
SRC_URI+=" ${use}? ( ${uri} )"
else
SRC_URI+=" ${uri}"
fi
done
}
bundle_src_uri
LICENSE="GPL-2"
SLOT="0"
IUSE="amf +fdk gui libdovi numa nvdec nvenc qsv vaapi x265"
REQUIRED_USE="
numa? ( x265 )
nvdec? ( nvenc )
"
# >=media-libs/libvpl-1.13.0: bug #957811 (check libhb/qsvcommon.h for new platform codenames)
COMMON_DEPEND="
app-arch/bzip2
>=app-arch/xz-utils-5.2.6
dev-libs/jansson:=
>=media-libs/dav1d-1.0.0:=
>=media-libs/libjpeg-turbo-2.1.4:=
>=media-libs/libass-0.16.0:=
>=media-libs/libbluray-1.3.4:=
media-libs/libdvdnav
>=media-libs/libdvdread-6.1.3:=
media-libs/libtheora:=
media-libs/libvorbis
>=media-libs/libvpx-1.12.0:=
media-libs/opus
>=media-libs/speex-1.2.1
>=media-libs/svt-av1-4.0.0:=
>=media-libs/x264-0.0.20220222:=
>=media-libs/zimg-3.0.4
media-sound/lame
virtual/zlib:=
fdk? ( media-libs/fdk-aac:= )
libdovi? ( media-libs/libdovi:= )
gui? (
>=gui-libs/gtk-4.6:4[gstreamer]
dev-libs/glib:2
>=dev-libs/libxml2-2.10.3:=
x11-libs/gdk-pixbuf:2
x11-libs/pango
)
numa? ( sys-process/numactl )
nvenc? ( media-libs/nv-codec-headers )
qsv? (
media-libs/libva:=
>=media-libs/libvpl-1.13.0:=
)
vaapi? (
media-libs/libva:=[X]
x11-libs/libX11
x11-libs/libdrm
)
"
RDEPEND="
${COMMON_DEPEND}
amf? ( media-video/amdgpu-pro-amf )
"
DEPEND="
${COMMON_DEPEND}
amf? ( >=media-libs/amf-headers-1.5.2 )
"
# cmake needed for custom script: bug #852701
BDEPEND="
${PYTHON_DEPS}
dev-build/cmake
dev-lang/nasm
gui? (
dev-build/meson
sys-devel/gettext
)
nvdec? ( llvm-core/clang:*[llvm_targets_NVPTX] )
"
if [[ ${PV} != 9999 ]]; then
BDEPEND+=" verify-sig? ( >=sec-keys/openpgp-keys-handbrake-20260311 )"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/handbrake.asc
fi
PATCHES=(
"${FILESDIR}"/handbrake-1.9.0-link-libdovi-properly.patch
"${FILESDIR}"/handbrake-1.9.0-include-vpl-properly.patch
"${FILESDIR}"/handbrake-1.12.0-set-ffmpeg-toolchain-explicitly.patch
"${FILESDIR}"/handbrake-1.9.2-allow-overriding-tools-via-env.patch
)
src_unpack() {
if [[ ${PV} == 9999 ]]; then
git-r3_src_unpack
else
use verify-sig && verify-sig_verify_detached "${DISTDIR}"/${P}.tar.bz2{,.sig}
unpack ${P}.tar.bz2
fi
}
src_prepare() {
default
mkdir download || die
for name in "${!BUNDLED[@]}"; do
IFS=$';' read -r uri use <<< ${BUNDLED[${name}]}
local tarball="${uri##*/}"
if [[ -n ${use} ]]; then
use ${use} || continue
fi
cp "${DISTDIR}/${tarball}" download/${tarball} || die
done
# Get rid of leftover bundled library build definitions
sed -i -E \
-e "/MODULES \+= contrib\// { /($(IFS=$'|'; echo "${!BUNDLED[*]}"))$/! d }" \
"${S}"/make/include/main.defs || die
# noop fetching
sed -i -e '/DF..*.exe/ { s/= .*/= true/ }' make/include/tool.defs || die
# Use whichever python is set by portage
sed -i -e "s/for p in .*/for p in ${EPYTHON}/" configure || die
}
src_configure() {
tc-export CC CXX AR RANLIB NM
# noop strip
local -x STRIP="true"
# ODR violations, lto-type-mismatches
# bug #878899
filter-lto
local myconfargs=(
--force
--verbose
--disable-df-fetch
--disable-df-verify
--launch-jobs=$(get_makeopts_jobs)
--prefix="${EPREFIX}/usr"
--disable-flatpak
--no-harden #bug #890279
--optimize=none
--cpu=none
--lto=none
$(use_enable amf vce)
$(use_enable fdk fdk-aac)
$(use_enable gui gtk)
$(use_enable libdovi)
$(use_enable numa)
$(use_enable nvdec)
$(use_enable nvenc)
$(use_enable qsv)
$(use_enable vaapi)
$(use_enable x265)
)
edo ./configure ${myconfargs[@]}
}
src_compile() {
emake -C build
}
src_install() {
emake -C build DESTDIR="${D}" install
dodoc README.markdown AUTHORS.markdown NEWS.markdown THANKS.markdown
}
pkg_postinst() {
einfo "Gentoo builds of HandBrake are NOT SUPPORTED by upstream as they"
einfo "do not use the bundled (and often patched) upstream libraries."
einfo ""
einfo "Please do not raise bugs with upstream because of these ebuilds,"
einfo "report bugs to Gentoo's bugzilla or Multimedia forum instead."
einfo "For the CLI version of HandBrake, you can use \`HandBrakeCLI\`."
if use gui ; then
einfo "For the GUI version of HandBrake, you can run \`ghb\`."
fi
xdg_pkg_postinst
}
|