Skip to content

Commit

Permalink
ffmpeg: obey pkg_config configuration (#26447)
Browse files Browse the repository at this point in the history
* ffmpeg: obey pkg_config configuration

* use version range for pkgconf

* use pkgconf package when not on Linux
  • Loading branch information
jcar87 authored Jan 23, 2025
1 parent 104ed87 commit a9b270f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions recipes/ffmpeg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ def build_requirements(self):
self.tool_requires("nasm/2.16.01")
else:
self.tool_requires("yasm/1.3.0")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.1.0")
if self.settings.os != "Linux" and not self.conf.get("tools.gnu:pkg_config", check_type=str):
# See https://github.com/conan-io/conan-center-index/pull/26447#discussion_r1926682155
self.tool_requires("pkgconf/[>=2.1 <3]")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
Expand Down Expand Up @@ -642,11 +643,12 @@ def opt_append_disable_if_set(args, what, v):
ranlib = buildenv_vars.get("RANLIB")
if ranlib:
args.append(f"--ranlib={unix_path(self, ranlib)}")
# for some reason pkgconf from conan can't find .pc files on Linux in the context of ffmpeg configure...
if self._settings_build.os != "Linux":
pkg_config = self.conf.get("tools.gnu:pkg_config", default=buildenv_vars.get("PKG_CONFIG"), check_type=str)
if pkg_config:
args.append(f"--pkg-config={unix_path(self, pkg_config)}")
pkg_config = self.conf.get("tools.gnu:pkg_config", default=buildenv_vars.get("PKG_CONFIG"), check_type=str)
if pkg_config:
# the ffmpeg configure script hardcodes the name of the executable,
# unlike other tools that use the PKG_CONFIG environment variable
# if we are aware the user has requested a specific pkg-config, we pass it to the configure script
args.append(f"--pkg-config={unix_path(self, pkg_config)}")
if is_msvc(self):
args.append("--toolchain=msvc")
if not check_min_vs(self, "190", raise_invalid=False):
Expand Down

0 comments on commit a9b270f

Please sign in to comment.