diff options
-rwxr-xr-x | mesonbuild/scripts/env2mfile.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/scripts/env2mfile.py b/mesonbuild/scripts/env2mfile.py index f03b61d..6eda79a 100755 --- a/mesonbuild/scripts/env2mfile.py +++ b/mesonbuild/scripts/env2mfile.py @@ -297,6 +297,14 @@ def detect_binaries_from_envvars(infos: MachineInfo, envvar_suffix: str = '') -> if binstr: infos.binaries[binname] = shlex.split(binstr) +def detect_properties_from_envvars(infos: MachineInfo, envvar_suffix: str = '') -> None: + var = os.environ.get('PKG_CONFIG_LIBDIR' + envvar_suffix) + if var is not None: + infos.properties['pkg_config_libdir'] = var + var = os.environ.get('PKG_CONFIG_SYSROOT_DIR' + envvar_suffix) + if var is not None: + infos.properties['sys_root'] = var + def detect_cross_system(infos: MachineInfo, options: T.Any) -> None: for optname in ('system', 'cpu', 'cpu_family', 'endian'): v = getattr(options, optname) @@ -314,6 +322,7 @@ def detect_cross_env(options: T.Any) -> MachineInfo: infos = detect_compilers_from_envvars() detect_cross_system(infos, options) detect_binaries_from_envvars(infos) + detect_properties_from_envvars(infos) return infos def add_compiler_if_missing(infos: MachineInfo, langname: str, exe_names: T.List[str]) -> None: @@ -359,6 +368,7 @@ def detect_native_env(options: T.Any) -> MachineInfo: detect_missing_native_compilers(infos) detect_binaries_from_envvars(infos, esuffix) detect_missing_native_binaries(infos) + detect_properties_from_envvars(infos, esuffix) return infos def run(options: T.Any) -> None: |