diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-11-12 14:38:24 -0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-11-19 10:48:48 -0800 |
| commit | 252faf5be8ffb23b5f335ebf10c7f1c3d3717ec5 (patch) | |
| tree | 38a529c3e1f96f3c88d7e01cbe84af1e14727a5c /mesonbuild/dependencies | |
| parent | 52d77090cbabd109f24b46cf13f51543bda08a3f (diff) | |
| download | meson-252faf5be8ffb23b5f335ebf10c7f1c3d3717ec5.tar.gz | |
compilers: Remove Environment parameter from Compiler.find_library
Diffstat (limited to 'mesonbuild/dependencies')
| -rw-r--r-- | mesonbuild/dependencies/__init__.py | 2 | ||||
| -rw-r--r-- | mesonbuild/dependencies/cuda.py | 2 | ||||
| -rw-r--r-- | mesonbuild/dependencies/dev.py | 14 | ||||
| -rw-r--r-- | mesonbuild/dependencies/misc.py | 18 | ||||
| -rw-r--r-- | mesonbuild/dependencies/pkgconfig.py | 5 | ||||
| -rw-r--r-- | mesonbuild/dependencies/python.py | 2 | ||||
| -rw-r--r-- | mesonbuild/dependencies/qt.py | 4 | ||||
| -rw-r--r-- | mesonbuild/dependencies/ui.py | 6 |
8 files changed, 26 insertions, 27 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index 00548e3ae..abe83351e 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.py @@ -78,7 +78,7 @@ class FooSystemDependency(ExternalDependency): self.is_found = False return - lib = self.clib_compiler.find_library('foo', environment, [os.path.join(root, 'lib')]) + lib = self.clib_compiler.find_library('foo', [os.path.join(root, 'lib')]) if lib is None: mlog.debug('Could not find lib.') self.is_found = False diff --git a/mesonbuild/dependencies/cuda.py b/mesonbuild/dependencies/cuda.py index b09a4378f..d80c62d8d 100644 --- a/mesonbuild/dependencies/cuda.py +++ b/mesonbuild/dependencies/cuda.py @@ -280,7 +280,7 @@ class CudaDependency(SystemDependency): # - libnvidia-ml.so in /usr/lib/ that is provided by the nvidia drivers # # Users should never link to the latter, since its ABI may change. - args = self.clib_compiler.find_library(module, self.env, [self.libdir, os.path.join(self.libdir, 'stubs')], self.libtype, ignore_system_dirs=True) + args = self.clib_compiler.find_library(module, [self.libdir, os.path.join(self.libdir, 'stubs')], self.libtype, ignore_system_dirs=True) if args is None: self._report_dependency_error(f'Couldn\'t find requested CUDA module \'{module}\'') diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index aa7c4686b..8da9ad7dc 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -59,8 +59,8 @@ class GTestDependencySystem(SystemDependency): self.detect() def detect(self) -> None: - gtest_detect = self.clib_compiler.find_library("gtest", self.env, []) - gtest_main_detect = self.clib_compiler.find_library("gtest_main", self.env, []) + gtest_detect = self.clib_compiler.find_library("gtest", []) + gtest_main_detect = self.clib_compiler.find_library("gtest_main", []) if gtest_detect and (not self.main or gtest_main_detect): self.is_found = True self.compile_args = [] @@ -135,8 +135,8 @@ class GMockDependencySystem(SystemDependency): # GMock may be a library or just source. # Work with both. - gmock_detect = self.clib_compiler.find_library("gmock", self.env, []) - gmock_main_detect = self.clib_compiler.find_library("gmock_main", self.env, []) + gmock_detect = self.clib_compiler.find_library("gmock", []) + gmock_main_detect = self.clib_compiler.find_library("gmock_main", []) if gmock_detect and (not self.main or gmock_main_detect): self.is_found = True self.link_args += gmock_detect @@ -540,7 +540,7 @@ class ZlibSystemDependency(SystemDependency): else: libs = ['z'] for lib in libs: - l = self.clib_compiler.find_library(lib, environment, [], self.libtype) + l = self.clib_compiler.find_library(lib, [], self.libtype) h = self.clib_compiler.has_header('zlib.h', '', environment, dependencies=[self]) if l and h[0]: self.is_found = True @@ -623,14 +623,14 @@ class JNISystemDependency(SystemDependency): java_home_lib_server = java_home_lib / 'server' if 'jvm' in modules: - jvm = self.clib_compiler.find_library('jvm', environment, extra_dirs=[str(java_home_lib_server)]) + jvm = self.clib_compiler.find_library('jvm', extra_dirs=[str(java_home_lib_server)]) if jvm is None: mlog.debug('jvm library not found.') self.is_found = False else: self.link_args.extend(jvm) if 'awt' in modules: - jawt = self.clib_compiler.find_library('jawt', environment, extra_dirs=[str(java_home_lib)]) + jawt = self.clib_compiler.find_library('jawt', extra_dirs=[str(java_home_lib)]) if jawt is None: mlog.debug('jawt library not found.') self.is_found = False diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index cae00844d..4b5d23b03 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -69,7 +69,7 @@ class AtomicSystemDependency(SystemDependency): self.feature_since = ('1.7.0', "consider checking for `atomic_flag_clear` with and without `find_library('atomic')`") h = self.clib_compiler.has_header('stdatomic.h', '', env) - self.link_args = self.clib_compiler.find_library('atomic', env, [], self.libtype) + self.link_args = self.clib_compiler.find_library('atomic', [], self.libtype) if h[0] and self.link_args: self.is_found = True @@ -90,7 +90,7 @@ class DlSystemDependency(SystemDependency): self.feature_since = ('0.62.0', "consider checking for `dlopen` with and without `find_library('dl')`") h = self.clib_compiler.has_header('dlfcn.h', '', env) - self.link_args = self.clib_compiler.find_library('dl', env, [], self.libtype) + self.link_args = self.clib_compiler.find_library('dl', [], self.libtype) if h[0] and self.link_args: self.is_found = True @@ -194,7 +194,7 @@ class BlocksDependency(SystemDependency): self.link_args = ['-lBlocksRuntime'] if not self.clib_compiler.has_header('Block.h', '', environment, disable_cache=True) or \ - not self.clib_compiler.find_library('BlocksRuntime', environment, []): + not self.clib_compiler.find_library('BlocksRuntime', []): mlog.log(mlog.red('ERROR:'), 'BlocksRuntime not found.') return @@ -317,7 +317,7 @@ class ShadercDependency(SystemDependency): cc = self.get_compiler() for lib in libs: - self.link_args = cc.find_library(lib, environment, []) + self.link_args = cc.find_library(lib, []) if self.link_args is not None: self.is_found = True @@ -372,7 +372,7 @@ class CursesSystemDependency(SystemDependency): # Not sure how else to elegantly break out of both loops for lib, headers in candidates: - l = self.clib_compiler.find_library(lib, env, []) + l = self.clib_compiler.find_library(lib, []) if l: for header in headers: h = self.clib_compiler.has_header(header, '', env) @@ -422,7 +422,7 @@ class IconvSystemDependency(SystemDependency): self.feature_since = ('0.60.0', "consider checking for `iconv_open` with and without find_library('iconv')") h = self.clib_compiler.has_header('iconv.h', '', env) - self.link_args = self.clib_compiler.find_library('iconv', env, [], self.libtype) + self.link_args = self.clib_compiler.find_library('iconv', [], self.libtype) if h[0] and self.link_args: self.is_found = True @@ -444,7 +444,7 @@ class IntlSystemDependency(SystemDependency): self.feature_since = ('0.59.0', "consider checking for `ngettext` with and without `find_library('intl')`") h = self.clib_compiler.has_header('libintl.h', '', env) - self.link_args = self.clib_compiler.find_library('intl', env, [], self.libtype) + self.link_args = self.clib_compiler.find_library('intl', [], self.libtype) if h[0] and self.link_args: self.is_found = True @@ -483,7 +483,7 @@ class OpensslSystemDependency(SystemDependency): self.is_found = True return else: - self.link_args = self.clib_compiler.find_library(name.lstrip('lib'), env, [], self.libtype) + self.link_args = self.clib_compiler.find_library(name.lstrip('lib'), [], self.libtype) if not self.link_args: return @@ -498,7 +498,7 @@ class OpensslSystemDependency(SystemDependency): if not use_threads or self._add_sub_dependency(threads_factory(env, self.for_machine, {})): self.is_found = True # only relevant on platforms where it is distributed with the libc, in which case it always succeeds - sublib = self.clib_compiler.find_library('dl', env, [], self.libtype) + sublib = self.clib_compiler.find_library('dl', [], self.libtype) if sublib: self.link_args.extend(sublib) diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py index 326ecb1b4..b628e005b 100644 --- a/mesonbuild/dependencies/pkgconfig.py +++ b/mesonbuild/dependencies/pkgconfig.py @@ -488,9 +488,8 @@ class PkgConfigDependency(ExternalDependency): if lib in libs_found: continue if self.clib_compiler: - args = self.clib_compiler.find_library(lib[2:], self.env, - libpaths, self.libtype, - lib_prefix_warning=False) + args = self.clib_compiler.find_library( + lib[2:], libpaths, self.libtype, lib_prefix_warning=False) # If the project only uses a non-clib language such as D, Rust, # C#, Python, etc, all we can do is limp along by adding the # arguments as-is and then adding the libpaths at the end. diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index c204a5197..93b915014 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -325,7 +325,7 @@ class _PythonDependencyBase(_Base): libname += self.variables['ABIFLAGS'] libdirs = [] - largs = self.clib_compiler.find_library(libname, environment, libdirs) + largs = self.clib_compiler.find_library(libname, libdirs) if largs is not None: self.link_args = largs self.is_found = True diff --git a/mesonbuild/dependencies/qt.py b/mesonbuild/dependencies/qt.py index 18e476338..c245e5c8c 100644 --- a/mesonbuild/dependencies/qt.py +++ b/mesonbuild/dependencies/qt.py @@ -146,7 +146,7 @@ class _QtBase: def _link_with_qt_winmain(self, is_debug: bool, libdir: T.Union[str, T.List[str]]) -> bool: libdir = mesonlib.listify(libdir) # TODO: shouldn't be necessary base_name = self.get_qt_winmain_base_name(is_debug) - qt_winmain = self.clib_compiler.find_library(base_name, self.env, libdir) + qt_winmain = self.clib_compiler.find_library(base_name, libdir) if qt_winmain: self.link_args.append(qt_winmain[0]) return True @@ -321,7 +321,7 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta): for directory in priv_inc: self.compile_args.append('-I' + directory) libfiles = self.clib_compiler.find_library( - self.qtpkgname + module + modules_lib_suffix, self.env, + self.qtpkgname + module + modules_lib_suffix, mesonlib.listify(libdir)) # TODO: shouldn't be necessary if libfiles: libfile = libfiles[0] diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index de2a4cf36..663345ee8 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -44,7 +44,7 @@ class GLDependencySystem(SystemDependency): # FIXME: Detect version using self.clib_compiler return else: - links = self.clib_compiler.find_library('GL', environment, []) + links = self.clib_compiler.find_library('GL', []) has_header = self.clib_compiler.has_header('GL/gl.h', '', environment)[0] if links and has_header: self.is_found = True @@ -199,7 +199,7 @@ class VulkanDependencySystem(SystemDependency): inc_path = os.path.join(self.vulkan_sdk, inc_dir) header = os.path.join(inc_path, 'vulkan', 'vulkan.h') lib_path = os.path.join(self.vulkan_sdk, lib_dir) - find_lib = self.clib_compiler.find_library(lib_name, environment, [lib_path]) + find_lib = self.clib_compiler.find_library(lib_name, [lib_path]) if not find_lib: raise DependencyException('VULKAN_SDK point to invalid directory (no lib)') @@ -215,7 +215,7 @@ class VulkanDependencySystem(SystemDependency): self.link_args.append('-l' + lib_name) else: # simply try to guess it, usually works on linux - libs = self.clib_compiler.find_library('vulkan', environment, []) + libs = self.clib_compiler.find_library('vulkan', []) if libs is not None and self.clib_compiler.has_header('vulkan/vulkan.h', '', environment, disable_cache=True)[0]: self.is_found = True for lib in libs: |
