mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-23 16:49:10 -07:00
ffmpeg-compat.eclass: add ffmpeg_compat_add_flags helper
Most packages are fine, but then there's cmake. Also some others doing -L/usr/lib64 *before* pkg-config flags. Not great, but adding to CPPFLAGS/LDFLAGS directly tend to workaround most issues and helper will spare repeating this. Also emphasize on importance to verify libraries, e.g. it can build against ffmpeg-compat:6 but the -L/usr/lib64 will make it use ffmpeg-7 and this sometimes succeed even if package was broken with ffmpeg-7 assuming no missing symbols. -rpath could also have been lost and libraries be not found. Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
# To use this, run ``ffmpeg_compat_setup <slot>`` before packages use
|
||||
# pkg-config, depend on media-video/ffmpeg-compat:<slot>=, and ensure
|
||||
# usage of both pkg-config --cflags and --libs (which adds -Wl,-rpath
|
||||
# to find libraries at runtime).
|
||||
# to find libraries at runtime). Always verify that it is linked with
|
||||
# the right libraries after.
|
||||
#
|
||||
# This eclass is intended as a quick-to-setup alternative to setting
|
||||
# an upper bound on ffmpeg for packages broken with the latest version,
|
||||
@@ -41,6 +42,27 @@ esac
|
||||
if [[ -z ${_FFMPEG_COMPAT_ECLASS} ]]; then
|
||||
_FFMPEG_COMPAT_ECLASS=1
|
||||
|
||||
inherit flag-o-matic toolchain-funcs
|
||||
|
||||
# @FUNCTION: ffmpeg_compat_add_flags
|
||||
# @DESCRIPTION:
|
||||
# Append ``pkg-config --cflags libavcodec`` to CPPFLAGS and
|
||||
# --libs-only-{L,other} to LDFLAGS for the current ABI.
|
||||
#
|
||||
# Must run ``ffmpeg_compat_setup <slot>`` first.
|
||||
#
|
||||
# Ideally this function should not be used, but can be useful when
|
||||
# packages do not use pkg-config properly or drop some flags (common
|
||||
# with cmake).
|
||||
#
|
||||
# For multilib, ebuild should preserve previous flags by doing e.g.
|
||||
# ``local -x CPPFLAGS=${CPPFLAGS} LDFLAGS=${LDFLAGS}`` first.
|
||||
ffmpeg_compat_add_flags() {
|
||||
# should be no real need to check anything but libavcodec's flags
|
||||
append-cppflags $($(tc-getPKG_CONFIG) --cflags libavcodec || die)
|
||||
append-ldflags $($(tc-getPKG_CONFIG) --libs-only-{L,other} libavcodec || die)
|
||||
}
|
||||
|
||||
# @FUNCTION: ffmpeg_compat_get_prefix
|
||||
# @USAGE: <slot>
|
||||
# @DESCRIPTION:
|
||||
|
||||
Reference in New Issue
Block a user