diff options
author | Alfred Wingate <parona@protonmail.com> | 2024-12-16 04:49:55 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-12-22 06:20:28 +0000 |
commit | 2fb2bc441587f09e800e554f06c20925ba22fc76 (patch) | |
tree | db6b53413d8b9a7b3664f3729775cf3af0153f72 /media-video | |
parent | media-video/handbrake: filter lto and disable build system hardening (diff) | |
download | gentoo-2fb2bc441587f09e800e554f06c20925ba22fc76.tar.gz gentoo-2fb2bc441587f09e800e554f06c20925ba22fc76.tar.bz2 gentoo-2fb2bc441587f09e800e554f06c20925ba22fc76.zip |
media-video/handbrake: add 1.9.0
* Add support for amf, libdovi and qsv.
* Bundle ffmpeg and x265 notably due heavy upstream patching.
* Rename gtk use flag to gui.
https://projects.gentoo.org/qa/policy-guide/use-flags.html#pg0802
Closes: https://bugs.gentoo.org/917591
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-video')
-rw-r--r-- | media-video/handbrake/Manifest | 3 | ||||
-rw-r--r-- | media-video/handbrake/files/handbrake-1.9.0-include-vpl-properly.patch | 18 | ||||
-rw-r--r-- | media-video/handbrake/files/handbrake-1.9.0-link-libdovi-properly.patch | 28 | ||||
-rw-r--r-- | media-video/handbrake/handbrake-1.9.0.ebuild | 212 | ||||
-rw-r--r-- | media-video/handbrake/metadata.xml | 5 |
5 files changed, 265 insertions, 1 deletions
diff --git a/media-video/handbrake/Manifest b/media-video/handbrake/Manifest index eee2cfadc435..88e1268ee53e 100644 --- a/media-video/handbrake/Manifest +++ b/media-video/handbrake/Manifest @@ -1 +1,4 @@ DIST handbrake-1.6.1.tar.bz2 15934833 BLAKE2B 027457c874bd49ff8a625233a5d09d70bdf76c45e6f2664f3ca65efcd0e1705d5575a81c5ac8f2237b8add7025314f12f0a19d6cc7337e2b0edd28c30ee3334b SHA512 e5cc0fee5bf063c4cdb8f64a772dac6800a7214bfdc65042c121e0e81878599fe615b499ebf6466bb78740314374ad8b8fa364fb24ff86852183e7dbbf565617 +DIST handbrake-1.9.0.tar.bz2 9427823 BLAKE2B 5e7c4aa054957dc61582956b7e2b9916f6746fac164e0f4a0ed85f863fe3b2aa2fd485761b1381e17ab39d9d3ed42de28266b2f664dad2b8dd0cd7d961886d5e SHA512 6d09a8fea8505dce665fa2d1b03ca2b21c9e0dc4cbb5f8e0b736d6eae39017b13ee48cd4bea172a6a3b8be9bb5deb6467584dadf9c15ce81e7b7a96d3322a179 +DIST handbrake-ffmpeg-7.1.tar.bz2 13260188 BLAKE2B 32466fbefdeb30796a329869bf6fe547a0d3285ae8d9505758e5bff5103f5edf1bebd2dd8595822d0cd25e3754929ed47878ab42c420e248fb2d6ea51747145a SHA512 3f28af9a0c0779b4a7f4e5fbfd94616eb83265856ef060a8bb8afbb9f1b899885a218f15b7ac2c48f724d961dd2742ef6544b237118cb94563ecf49fbd740e3b +DIST handbrake-x265_4.1.tar.gz 1722231 BLAKE2B 5950cc5361da88a8db5403b2837081347980cd31848ce77802e8a29cfb70f6b321d14ffa08c20270e80435076e36428c7de8293c3db9b6b2e8837aa512300126 SHA512 72798265423b605b0ca5f5541f3cc39f62dae7560a5a4023f8d38f6977ded80b1911ef8154c485fbe62ef97a051d938412934c9a00f3df010f11d83ffc650e7e diff --git a/media-video/handbrake/files/handbrake-1.9.0-include-vpl-properly.patch b/media-video/handbrake/files/handbrake-1.9.0-include-vpl-properly.patch new file mode 100644 index 000000000000..7f744e14b783 --- /dev/null +++ b/media-video/handbrake/files/handbrake-1.9.0-include-vpl-properly.patch @@ -0,0 +1,18 @@ +diff --git a/libhb/module.defs b/libhb/module.defs +index 177ddefe4..dd3f274a6 100644 +--- a/libhb/module.defs ++++ b/libhb/module.defs +@@ -52,11 +52,7 @@ LIBHB.GCC.D += __LIBHB__ + LIBHB.GCC.I += $(LIBHB.build/) $(CONTRIB.build/)include + + ifeq (1,$(FEATURE.qsv)) +- ifeq ($(HOST.system),freebsd) +- LIBHB.GCC.I += $(LOCALBASE)/include/vpl +- else +- LIBHB.GCC.I += $(CONTRIB.build/)include/vpl +- endif ++ LIBHB.GCC.I += $(PREFIX)/include/vpl + endif + + ifneq (,$(filter $(HOST.system),freebsd netbsd openbsd)) + diff --git a/media-video/handbrake/files/handbrake-1.9.0-link-libdovi-properly.patch b/media-video/handbrake/files/handbrake-1.9.0-link-libdovi-properly.patch new file mode 100644 index 000000000000..2c19423070e4 --- /dev/null +++ b/media-video/handbrake/files/handbrake-1.9.0-link-libdovi-properly.patch @@ -0,0 +1,28 @@ +https://bugs.gentoo.org/917591#c47 + +diff -Nuar a/libhb/module.defs b/libhb/module.defs +--- a/libhb/module.defs 2024-03-20 13:17:37.833999294 +0000 ++++ b/libhb/module.defs 2024-03-20 13:17:18.693999469 +0000 +@@ -151,6 +151,7 @@ + + ifeq (1,$(FEATURE.libdovi)) + LIBHB.dll.libs += $(CONTRIB.build/)lib/libdovi.a ++LIBHB.GCC.l += dovi + endif + + ifneq ($(HAS.iconv),1) +diff -Nuar a/test/module.defs b/test/module.defs +--- a/test/module.defs 2024-03-20 13:19:11.869998433 +0000 ++++ b/test/module.defs 2024-03-20 13:19:42.761998150 +0000 +@@ -34,6 +34,10 @@ + TEST.pkgconfig_libs += glib-2.0 + endif + ++ifeq (1,$(FEATURE.libdovi)) ++ TEST.pkgconfig_libs += dovi ++endif ++ + TEST.GCC.pkgconfig = $(shell $(TEST.PKGCONFIG.exe) --libs $(TEST.pkgconfig_libs)) + + TEST.install.exe = $(DESTDIR)$(PREFIX/)bin/$(notdir $(TEST.exe)) + diff --git a/media-video/handbrake/handbrake-1.9.0.ebuild b/media-video/handbrake/handbrake-1.9.0.ebuild new file mode 100644 index 000000000000..87d75de6700c --- /dev/null +++ b/media-video/handbrake/handbrake-1.9.0.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..13} ) + +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 + EGIT_REPO_URI="https://github.com/HandBrake/HandBrake.git" + inherit git-r3 +else + MY_P="HandBrake-${PV}" + SRC_URI="https://github.com/HandBrake/HandBrake/releases/download/${PV}/${MY_P}-source.tar.bz2 -> ${P}.tar.bz2" + 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://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/ffmpeg-7.1.tar.bz2;" + # Patched in an incompatible way + [x265]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265" + [x265_8bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265" + [x265_10bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265" + [x265_12bit]="https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/x265_4.1.tar.gz;x265" +) + +bundle_src_uri() { + for name in "${!BUNDLED[@]}"; do + IFS=$';' read -r uri use <<< ${BUNDLED[${name}]} + local tarball=${uri##*/} + if [[ -n ${use} ]]; then + SRC_URI+=" ${use}? ( ${uri} -> handbrake-${tarball} )" + else + SRC_URI+=" ${uri} -> handbrake-${tarball}" + fi + done +} + +bundle_src_uri + +LICENSE="GPL-2" +SLOT="0" +IUSE="amf +fdk gui libdovi numa nvenc qsv x265" + +REQUIRED_USE="numa? ( x265 )" + +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-1.4.1:= + >=media-libs/x264-0.0.20220222:= + >=media-libs/zimg-3.0.4 + media-sound/lame + sys-libs/zlib + fdk? ( media-libs/fdk-aac:= ) + libdovi? ( media-libs/libdovi:= ) + gui? ( + >=gui-libs/gtk-4.4: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:= + ) +" +RDEPEND=" + ${COMMON_DEPEND} + amf? ( media-video/amdgpu-pro-amf ) +" +DEPEND=" + ${COMMON_DEPEND} + amf? ( media-libs/amf-headers ) +" +# cmake needed for custom script: bug #852701 +BDEPEND=" + ${PYTHON_DEPS} + dev-build/cmake + dev-lang/nasm + gui? ( + dev-build/meson + sys-devel/gettext + ) +" + +PATCHES=( + "${FILESDIR}"/handbrake-1.9.0-link-libdovi-properly.patch + "${FILESDIR}"/handbrake-1.9.0-include-vpl-properly.patch +) + +src_unpack() { + if [[ ${PV} == 9999 ]]; then + git-r3_src_unpack + else + unpack ${P}.tar.bz2 + fi +} + +src_prepare() { + 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}/handbrake-${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 + + # noop strip + sed -i \ + -e "s/\(strip\s*= ToolProbe( 'STRIP.exe',\s*'strip',\s*\)'strip'/\1'true'/" \ + make/configure.py || die + + # Use whichever python is set by portage + sed -i -e "s/for p in .*/for p in ${EPYTHON}/" configure || die + + for tool in ar ranlib libtool; do + # Detect system tools - bug 738110 + sed -i \ + -e "s/\(${tool}\s*= ToolProbe( '${tool^^}.exe',\s*'${tool}',\s*\)'${tool}'/\1os.environ.get('${tool^^}', '${tool}')/" \ + make/configure.py || die + done + + default +} + +src_configure() { + tc-export AR RANLIB + + # 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 + $(use_enable amf vce) + $(use_enable fdk fdk-aac) + $(use_enable gui gtk) + $(use_enable libdovi) + $(use_enable numa) + $(use_enable nvenc) + $(use_enable x265) + $(use_enable qsv) + ) + + 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 +} diff --git a/media-video/handbrake/metadata.xml b/media-video/handbrake/metadata.xml index eb829c9a924c..ef5eae4a0bd1 100644 --- a/media-video/handbrake/metadata.xml +++ b/media-video/handbrake/metadata.xml @@ -3,10 +3,13 @@ <pkgmetadata> <!-- maintainer-needed --> <use> + <flag name="amf">Support for encoding h265 using AMD VCE encoder.</flag> + <flag name="fdk">Support for encoding AAC using <pkg>media-libs/fdk-aac</pkg>.</flag> <flag name="gstreamer">Support for the streaming media framework from <pkg>media-libs/gstreamer</pkg>.</flag> <flag name="gtk">Install the GTK UI, ghb.</flag> - <flag name="fdk">Support for encoding AAC using <pkg>media-libs/fdk-aac</pkg>.</flag> + <flag name="libdovi">Support for Dolby Vision using <pkg>media-libs/libdovi</pkg>.</flag> <flag name="numa">Adds support for x265's NUMA capabilities.</flag> + <flag name="qsv">Support for encoding h264 using Intel Quick Sync Video.</flag> <flag name="x265">Support for encoding h265 using <pkg>media-libs/x265</pkg>.</flag> </use> <upstream> |