From ba7a2c9f716af506838d399e6ed27ed6d64d2435 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 27 Apr 2024 01:56:57 +0300 Subject: [PATCH] setup.py: use PKG_CONFIG env var to get the pkg-config to use pkg-config may be prefixed when cross-compiling --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0b3ce00f7..9f43f5f27 100644 --- a/setup.py +++ b/setup.py @@ -72,16 +72,17 @@ def get_config_from_pkg_config(): """ Get distutils-compatible extension arguments using pkg-config. """ + pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') try: raw_cflags = subprocess.check_output( - ["pkg-config", "--cflags", "--libs"] + [pkg_config, "--cflags", "--libs"] + ["lib" + name for name in FFMPEG_LIBRARIES] ) except FileNotFoundError: - print("pkg-config is required for building PyAV") + print(f"{pkg_config} is required for building PyAV") exit(1) except subprocess.CalledProcessError: - print("pkg-config could not find libraries {}".format(FFMPEG_LIBRARIES)) + print(f"{pkg_config} could not find libraries {FFMPEG_LIBRARIES}") exit(1) known, unknown = parse_cflags(raw_cflags.decode("utf-8"))