summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-04-04 11:24:22 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2023-04-11 20:28:23 +0300
commit4cf9aab35719470fa71fdfa561ad0921f577f3bb (patch)
treeb61f3de75205cd7250c9caf6aaf08335503b6220
parent439a61affab391d44341ac3113592698abd4143b (diff)
downloadmeson-4cf9aab35719470fa71fdfa561ad0921f577f3bb.tar.gz
Revert "find dll path on Windows"
This reverts commit 3968b84696a9034233c2fd64ef7d8e078982afe3.
-rw-r--r--mesonbuild/backend/backends.py44
1 files changed, 10 insertions, 34 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 408cd0a6c..f1ac4a5d8 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -737,20 +737,6 @@ class Backend:
def rpaths_for_non_system_absolute_shared_libraries(self, target: build.BuildTarget, exclude_system: bool = True) -> 'ImmutableListProtocol[str]':
paths: OrderedSet[str] = OrderedSet()
srcdir = self.environment.get_source_dir()
-
- def add_path(libdir: str) -> None:
- try:
- commonpath = os.path.commonpath((libdir, srcdir))
- except ValueError: # when paths are on different drives on Windows
- commonpath = ''
-
- if commonpath == srcdir:
- rel_to_src = libdir[len(srcdir) + 1:]
- assert not os.path.isabs(rel_to_src), f'rel_to_src: {rel_to_src} is absolute'
- paths.add(os.path.join(self.build_to_src, rel_to_src))
- else:
- paths.add(libdir)
-
for dep in target.external_deps:
if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
continue
@@ -770,27 +756,17 @@ class Backend:
if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so', '.dylib']:
continue
- if mesonlib.is_windows() and libpath.endswith('.lib'):
-
- if isinstance(dep, dependencies.PkgConfigDependency):
- # If by chance pkg-config knows the bin dir...
- bindir = dep.get_pkgconfig_variable('bindir', [], default='')
- if bindir:
- add_path(bindir)
- continue
-
- # If the dll is not in the same dir, try to replace 'lib' with 'bin' in the path.
- # This is not 100% proof, since the bin dir could be elsewhere or with a different
- # name, and the DLL could have a different name as well, but this is better than nothing.
- p = Path(libpath).with_suffix('.dll')
- if not p.exists():
- # replace last occurence:
- binpath = '/bin/'.join(p.as_posix().rsplit('/lib/', maxsplit=1))
- if Path(binpath).exists():
- libdir = os.path.dirname(binpath)
-
- add_path(libdir)
+ try:
+ commonpath = os.path.commonpath((libdir, srcdir))
+ except ValueError: # when paths are on different drives on Windows
+ commonpath = ''
+ if commonpath == srcdir:
+ rel_to_src = libdir[len(srcdir) + 1:]
+ assert not os.path.isabs(rel_to_src), f'rel_to_src: {rel_to_src} is absolute'
+ paths.add(os.path.join(self.build_to_src, rel_to_src))
+ else:
+ paths.add(libdir)
# Don't remove rpaths specified by the dependency
paths.difference_update(self.get_rpath_dirs_from_link_args(dep.link_args))
for i in chain(target.link_targets, target.link_whole_targets):