3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{10..12} )
|
|
6 |
PYTHON_COMPAT=( python3_{10..13} )
|
7 |
7 |
|
8 |
|
inherit autotools edo flag-o-matic python-any-r1 toolchain-funcs xdg
|
|
8 |
inherit edo flag-o-matic multiprocessing python-any-r1 toolchain-funcs xdg
|
|
9 |
|
|
10 |
DESCRIPTION="Open-source, GPL-licensed, multiplatform, multithreaded video transcoder"
|
|
11 |
HOMEPAGE="https://handbrake.fr/ https://github.com/HandBrake/HandBrake"
|
9 |
12 |
|
10 |
13 |
if [[ ${PV} == *9999* ]]; then
|
11 |
14 |
EGIT_REPO_URI="https://github.com/HandBrake/HandBrake.git"
|
... | ... | |
14 |
17 |
MY_P="HandBrake-${PV}"
|
15 |
18 |
SRC_URI="https://github.com/HandBrake/HandBrake/releases/download/${PV}/${MY_P}-source.tar.bz2 -> ${P}.tar.bz2"
|
16 |
19 |
S="${WORKDIR}/${MY_P}"
|
17 |
|
KEYWORDS="amd64 ~arm64 ~x86"
|
|
20 |
KEYWORDS="~amd64 ~arm64 ~x86"
|
18 |
21 |
fi
|
19 |
22 |
|
20 |
|
DESCRIPTION="Open-source, GPL-licensed, multiplatform, multithreaded video transcoder"
|
21 |
|
HOMEPAGE="https://handbrake.fr/ https://github.com/HandBrake/HandBrake"
|
|
23 |
# contrib/<project>/module.defs
|
|
24 |
declare -A BUNDLED=(
|
|
25 |
# Heavily patched in an incompatible way.
|
|
26 |
# Issues related to using system ffmpeg historically.
|
|
27 |
# See bug #829595 and #922828
|
|
28 |
[ffmpeg]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/ffmpeg-7.1.tar.bz2;"
|
|
29 |
# Patched in an incompatible way
|
|
30 |
[x265]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265"
|
|
31 |
[x265_8bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265"
|
|
32 |
[x265_10bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265"
|
|
33 |
[x265_12bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265"
|
|
34 |
)
|
|
35 |
|
|
36 |
bundle_src_uri() {
|
|
37 |
for name in "${!BUNDLED[@]}"; do
|
|
38 |
IFS=$';' read -r uri use <<< ${BUNDLED[${name}]}
|
|
39 |
local tarball=${uri##*/}
|
|
40 |
if [[ -n ${use} ]]; then
|
|
41 |
SRC_URI+=" ${use}? ( ${uri} -> handbrake-${tarball} )"
|
|
42 |
else
|
|
43 |
SRC_URI+=" ${uri} -> handbrake-${tarball}"
|
|
44 |
fi
|
|
45 |
done
|
|
46 |
}
|
|
47 |
|
|
48 |
bundle_src_uri
|
22 |
49 |
|
23 |
50 |
LICENSE="GPL-2"
|
24 |
51 |
SLOT="0"
|
25 |
|
IUSE="+fdk gstreamer gtk numa nvenc x265" # TODO: qsv vce
|
|
52 |
IUSE="amf +fdk gui libdovi numa nvenc qsv x265"
|
26 |
53 |
|
27 |
54 |
REQUIRED_USE="numa? ( x265 )"
|
28 |
55 |
|
29 |
|
RDEPEND="
|
|
56 |
COMMON_DEPEND="
|
|
57 |
app-arch/bzip2
|
30 |
58 |
>=app-arch/xz-utils-5.2.6
|
31 |
59 |
dev-libs/jansson:=
|
32 |
|
>=dev-libs/libxml2-2.10.3
|
33 |
|
media-libs/a52dec
|
34 |
60 |
>=media-libs/dav1d-1.0.0:=
|
35 |
61 |
>=media-libs/libjpeg-turbo-2.1.4:=
|
36 |
62 |
>=media-libs/libass-0.16.0:=
|
37 |
63 |
>=media-libs/libbluray-1.3.4:=
|
38 |
64 |
media-libs/libdvdnav
|
39 |
65 |
>=media-libs/libdvdread-6.1.3:=
|
40 |
|
media-libs/libsamplerate
|
41 |
66 |
media-libs/libtheora
|
42 |
67 |
media-libs/libvorbis
|
43 |
68 |
>=media-libs/libvpx-1.12.0:=
|
... | ... | |
47 |
72 |
>=media-libs/x264-0.0.20220222:=
|
48 |
73 |
>=media-libs/zimg-3.0.4
|
49 |
74 |
media-sound/lame
|
50 |
|
>=media-video/ffmpeg-5.1.2:=[postproc,fdk?]
|
51 |
75 |
sys-libs/zlib
|
52 |
76 |
fdk? ( media-libs/fdk-aac:= )
|
53 |
|
gstreamer? (
|
54 |
|
media-libs/gstreamer:1.0
|
55 |
|
media-libs/gst-plugins-base:1.0
|
56 |
|
media-libs/gst-plugins-good:1.0
|
57 |
|
media-libs/gst-plugins-bad:1.0
|
58 |
|
media-libs/gst-plugins-ugly:1.0
|
59 |
|
media-plugins/gst-plugins-a52dec:1.0
|
60 |
|
media-plugins/gst-plugins-libav:1.0
|
61 |
|
media-plugins/gst-plugins-x264:1.0
|
62 |
|
media-plugins/gst-plugins-gdkpixbuf:1.0
|
63 |
|
)
|
64 |
|
gtk? (
|
65 |
|
>=x11-libs/gtk+-3.10
|
66 |
|
dev-libs/dbus-glib
|
|
77 |
libdovi? ( media-libs/libdovi:= )
|
|
78 |
gui? (
|
|
79 |
>=gui-libs/gtk-4.4:4[gstreamer]
|
67 |
80 |
dev-libs/glib:2
|
68 |
|
dev-libs/libgudev:=
|
69 |
|
x11-libs/cairo
|
|
81 |
>=dev-libs/libxml2-2.10.3
|
70 |
82 |
x11-libs/gdk-pixbuf:2
|
71 |
|
x11-libs/libnotify
|
72 |
83 |
x11-libs/pango
|
73 |
84 |
)
|
74 |
|
nvenc? (
|
75 |
|
media-libs/nv-codec-headers
|
76 |
|
media-video/ffmpeg[nvenc]
|
|
85 |
numa? ( sys-process/numactl )
|
|
86 |
nvenc? ( media-libs/nv-codec-headers )
|
|
87 |
qsv? (
|
|
88 |
media-libs/libva:=
|
|
89 |
media-libs/libvpl:=
|
77 |
90 |
)
|
78 |
|
x265? ( >=media-libs/x265-3.5-r2:=[10bit,12bit,numa?] )
|
79 |
91 |
"
|
80 |
|
DEPEND="${RDEPEND}"
|
|
92 |
RDEPEND="
|
|
93 |
${COMMON_DEPEND}
|
|
94 |
amf? ( media-video/amdgpu-pro-amf )
|
|
95 |
"
|
|
96 |
DEPEND="
|
|
97 |
${COMMON_DEPEND}
|
|
98 |
amf? ( media-libs/amf-headers )
|
|
99 |
"
|
81 |
100 |
# cmake needed for custom script: bug #852701
|
82 |
101 |
BDEPEND="
|
83 |
102 |
${PYTHON_DEPS}
|
84 |
103 |
dev-build/cmake
|
85 |
104 |
dev-lang/nasm
|
|
105 |
gui? (
|
|
106 |
dev-build/meson
|
|
107 |
sys-devel/gettext
|
|
108 |
)
|
86 |
109 |
"
|
87 |
110 |
|
88 |
111 |
PATCHES=(
|
89 |
|
# Remove libdvdnav duplication and call it on the original instead.
|
90 |
|
# It may work this way; if not, we should try to mimic the duplication.
|
91 |
|
"${FILESDIR}/${PN}-9999-remove-dvdnav-dup.patch"
|
92 |
|
|
93 |
|
# Detect system tools - bug 738110
|
94 |
|
"${FILESDIR}/${PN}-9999-system-tools.patch"
|
|
112 |
"${FILESDIR}"/handbrake-1.9.0-link-libdovi-properly.patch
|
|
113 |
"${FILESDIR}"/handbrake-1.9.0-include-vpl-properly.patch
|
|
114 |
)
|
95 |
115 |
|
96 |
|
# Use whichever python is set by portage
|
97 |
|
"${FILESDIR}/${PN}-9999-dont-search-for-python.patch"
|
|
116 |
src_unpack() {
|
|
117 |
if [[ ${PV} == 9999 ]]; then
|
|
118 |
git-r3_src_unpack
|
|
119 |
else
|
|
120 |
unpack ${P}.tar.bz2
|
|
121 |
fi
|
|
122 |
}
|
98 |
123 |
|
99 |
|
# Fix x265 linkage... again again #730034
|
100 |
|
"${FILESDIR}/${PN}-1.3.3-x265-link.patch"
|
|
124 |
src_prepare() {
|
|
125 |
mkdir download || die
|
|
126 |
for name in "${!BUNDLED[@]}"; do
|
|
127 |
IFS=$';' read -r uri use <<< ${BUNDLED[${name}]}
|
|
128 |
local tarball="${uri##*/}"
|
|
129 |
if [[ -n ${use} ]]; then
|
|
130 |
use ${use} || continue
|
|
131 |
fi
|
|
132 |
cp "${DISTDIR}/handbrake-${tarball}" download/${tarball} || die
|
|
133 |
done
|
|
134 |
|
|
135 |
# Get rid of leftover bundled library build definitions
|
|
136 |
sed -i -E \
|
|
137 |
-e "/MODULES \+= contrib\// { /($(IFS=$'|'; echo "${!BUNDLED[*]}"))$/! d }" \
|
|
138 |
"${S}"/make/include/main.defs || die
|
|
139 |
|
|
140 |
# noop fetching
|
|
141 |
sed -i -e '/DF..*.exe/ { s/= .*/= true/ }' make/include/tool.defs || die
|
|
142 |
|
|
143 |
# noop strip
|
|
144 |
sed -i \
|
|
145 |
-e "s/\(strip\s*= ToolProbe( 'STRIP.exe',\s*'strip',\s*\)'strip'/\1'true'/" \
|
|
146 |
make/configure.py || die
|
101 |
147 |
|
102 |
|
"${FILESDIR}/${PN}-1.6.1-missing-include.patch"
|
103 |
|
)
|
|
148 |
# Use whichever python is set by portage
|
|
149 |
sed -i -e "s/for p in .*/for p in ${EPYTHON}/" configure || die
|
104 |
150 |
|
105 |
|
src_prepare() {
|
106 |
|
# Get rid of leftover bundled library build definitions,
|
107 |
|
sed -i 's:.*\(/contrib\|contrib/\).*::g' \
|
108 |
|
"${S}"/make/include/main.defs \
|
109 |
|
|| die "Contrib removal failed."
|
|
151 |
for tool in ar ranlib libtool; do
|
|
152 |
# Detect system tools - bug 738110
|
|
153 |
sed -i \
|
|
154 |
-e "s/\(${tool}\s*= ToolProbe( '${tool^^}.exe',\s*'${tool}',\s*\)'${tool}'/\1os.environ.get('${tool^^}', '${tool}')/" \
|
|
155 |
make/configure.py || die
|
|
156 |
done
|
110 |
157 |
|
111 |
158 |
default
|
112 |
|
|
113 |
|
cd "${S}/gtk" || die
|
114 |
|
eautoreconf
|
115 |
159 |
}
|
116 |
160 |
|
117 |
161 |
src_configure() {
|
118 |
|
tc-export AR RANLIB STRIP
|
|
162 |
tc-export AR RANLIB
|
119 |
163 |
|
120 |
164 |
# ODR violations, lto-type-mismatches
|
121 |
165 |
# bug #878899
|
122 |
166 |
filter-lto
|
123 |
167 |
|
124 |
|
# Libav was replaced in 1.2 with ffmpeg by default
|
125 |
|
# but I've elected to not make people change their use flags for AAC
|
126 |
|
# as its the same code anyway
|
127 |
168 |
local myconfargs=(
|
128 |
169 |
--force
|
129 |
170 |
--verbose
|
|
171 |
--disable-df-fetch
|
|
172 |
--disable-df-verify
|
|
173 |
--launch-jobs=$(get_makeopts_jobs)
|
130 |
174 |
--prefix="${EPREFIX}/usr"
|
131 |
175 |
--disable-flatpak
|
132 |
176 |
--no-harden #bug #890279
|
133 |
|
$(usex !gtk --disable-gtk)
|
134 |
|
--disable-gtk4
|
135 |
|
$(usex !gstreamer --disable-gst)
|
136 |
|
$(use_enable x265)
|
137 |
|
$(use_enable numa)
|
|
177 |
$(use_enable amf vce)
|
138 |
178 |
$(use_enable fdk fdk-aac)
|
139 |
|
--enable-ffmpeg-aac # Forced on
|
|
179 |
$(use_enable gui gtk)
|
|
180 |
$(use_enable libdovi)
|
|
181 |
$(use_enable numa)
|
140 |
182 |
$(use_enable nvenc)
|
141 |
|
# TODO: $(use_enable qsv)
|
142 |
|
# TODO: $(use_enable vce)
|
|
183 |
$(use_enable x265)
|
|
184 |
$(use_enable qsv)
|
143 |
185 |
)
|
144 |
186 |
|
145 |
|
edo ./configure "${myconfargs[@]}"
|
|
187 |
edo ./configure ${myconfargs[@]}
|
146 |
188 |
}
|
147 |
189 |
|
148 |
190 |
src_compile() {
|
... | ... | |
162 |
204 |
einfo "report bugs to Gentoo's bugzilla or Multimedia forum instead."
|
163 |
205 |
|
164 |
206 |
einfo "For the CLI version of HandBrake, you can use \`HandBrakeCLI\`."
|
165 |
|
if use gtk ; then
|
166 |
|
einfo "For the GTK+ version of HandBrake, you can run \`ghb\`."
|
|
207 |
if use gui ; then
|
|
208 |
einfo "For the GUI version of HandBrake, you can run \`ghb\`."
|
167 |
209 |
fi
|
168 |
210 |
|
169 |
211 |
xdg_pkg_postinst
|