aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-11-20 18:41:06 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-12-04 17:56:03 -0500
commit48f08a7c4988f5200ea1e39da9db7fe05b65a7a2 (patch)
tree41429411b2eede68cc250838f0c18b821ae8fcf6 /mesonbuild/dependencies
parentda23630a97a2999faef42a68a631105a3556054c (diff)
downloadmeson-48f08a7c4988f5200ea1e39da9db7fe05b65a7a2.zip
meson-48f08a7c4988f5200ea1e39da9db7fe05b65a7a2.tar.gz
meson-48f08a7c4988f5200ea1e39da9db7fe05b65a7a2.tar.bz2
hdf5 dependency: correctly use machine files and respect cross
We do some magic to figure out what names of pkg-config dependencies to even search for. This magic simply checked for `pkg-config` the $PATH executable, which was broken in a variety of ways and had a comment to that effect.
Diffstat (limited to 'mesonbuild/dependencies')
-rw-r--r--mesonbuild/dependencies/hdf5.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/hdf5.py b/mesonbuild/dependencies/hdf5.py
index 47ef5fe..27f127d 100644
--- a/mesonbuild/dependencies/hdf5.py
+++ b/mesonbuild/dependencies/hdf5.py
@@ -17,11 +17,11 @@
import functools
import os
import re
-import shutil
import subprocess
from pathlib import Path
from ..mesonlib import Popen_safe, OrderedSet, join_args
+from ..programs import ExternalProgram
from .base import DependencyException, DependencyMethods
from .configtool import ConfigToolDependency
from .pkgconfig import PkgConfigDependency
@@ -159,11 +159,12 @@ def hdf5_factory(env: 'Environment', for_machine: 'MachineChoice',
if DependencyMethods.PKGCONFIG in methods:
# Use an ordered set so that these remain the first tried pkg-config files
pkgconfig_files = OrderedSet(['hdf5', 'hdf5-serial'])
- # FIXME: This won't honor pkg-config paths, and cross-native files
- PCEXE = shutil.which('pkg-config')
+ PCEXE = PkgConfigDependency._detect_pkgbin(False, env, for_machine)
+ pcenv = PkgConfigDependency.setup_env(os.environ, env, for_machine)
if PCEXE:
+ assert isinstance(PCEXE, ExternalProgram)
# some distros put hdf5-1.2.3.pc with version number in .pc filename.
- ret, stdout, _ = Popen_safe([PCEXE, '--list-all'], stderr=subprocess.DEVNULL)
+ ret, stdout, _ = Popen_safe(PCEXE.get_command() + ['--list-all'], stderr=subprocess.DEVNULL, env=pcenv)
if ret.returncode == 0:
for pkg in stdout.split('\n'):
if pkg.startswith('hdf5'):