Files
gentoo/media-libs/nv-codec-headers/nv-codec-headers-12.1.14.0.ebuild
Ionen Wolkens 78f3d3e1ad media-libs/nv-codec-headers: explain driver support handling
Mostly repeats commit 917dce846463e4ae33067da3284c606517c3ffbd's
message that added it. Situation is not ideal so it may be
confusing to some.

An alternative to the postinst message would be to mask/unkeyword
the recent/latest nv-codec-headers and only expose the one that
works for all (non-masked/legacy) drivers.

^ as a bit of a middle ground, this changes the ebuild's stabilization
comment to only stabilize versions that work for all driver versions.
So only ~arch users using bleeding headers but old drivers will need to
juggle.

The other (messier) alternative would be to put nv-codec-headers:=
in RDEPEND for revdeps, depend on >=nvidia-${min} here, and do
SLOT="0/${min}":

Pros:
- ensures nvdec/nvenc will work
- no need to think about rebuilds when downgrading

Cons (not *major* issues except maybe the last one):
- confusing to have nv-codec-*headers* in RDEPEND for revdeps
- installs headers for nothing on binhosts (not that these are huge)
- rebuilds are not essential for using latest drivers, and ffmpeg
  is not that trivial to rebuild
- prevents binhost from giving optional support without also pulling
  the (big) nvidia-drivers even on e.g. amdgpu machines -- fwiw most
  binary distros can (should) just enable this for everyone
- portage may give confusing conflicts if users mask latest drivers,
  good to ensure nvenc/nvdec keeps working but that's often a low
  priority for users trying to debug (other) issues with drivers
  that often have nothing to do with nvenc/nvdec, rebuilds when
  just testing drivers back&forth would also be *very* annoying

Note that in the past this did depend on >=nvidia-${min} (without
subslot), and revdeps were using USE=video_cards_nvidia to enable
support. This caused a lot of headaches for users of legacy drivers
that lost support without having explicitly opted in.

Eventually USE was renamed, and later someone (imo rightfully)
thought the dependency in a header-only package was weird and
dropped that too.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
2025-03-24 21:23:57 -04:00

38 lines
1.5 KiB
Bash

# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# ideally only stabilize versions that work for all non-masked nvidia-drivers
NV_MIN_VERSION=530.41.03 # see README
DESCRIPTION="FFmpeg version of headers required to interface with Nvidias codec APIs"
HOMEPAGE="https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git"
SRC_URI="https://github.com/FFmpeg/nv-codec-headers/releases/download/n${PV}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm64"
src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr LIBDIR=share install
einstalldocs
}
pkg_postinst() {
# prefer not to depend on nvidia-drivers given this package is depended
# on as header-only and drivers are optfeature'ish which can be better
# for e.g. binhosts to provide support (binding operators also not really
# suitable in DEPEND-only wrt rebuilds, rebuilds are not currently needed
# to work with *newer* drivers, and would be annoying for users switching
# driver versions only to troubleshoot non-nvenc issues)
if ! has_version ">=x11-drivers/nvidia-drivers-${NV_MIN_VERSION}"; then
ewarn
ewarn "Be warned that packages built using this version of ${PN}"
ewarn "will require x11-drivers/nvidia-drivers of version ${NV_MIN_VERSION} or"
ewarn "higher for NVDEC/NVENC to function properly. If switch to an older"
ewarn "${PN} version, remember to rebuild packages that are using"
ewarn "this such as ffmpeg or mpv."
fi
}