|
Igor Gnatenko |
ef6081 |
From 507ba31cfa4c33d5e853d8be57cbe42374aa7acf Mon Sep 17 00:00:00 2001
|
|
Igor Gnatenko |
ef6081 |
From: Martin Hostettler <textshell@uchuujin.de>
|
|
Igor Gnatenko |
ef6081 |
Date: Thu, 26 Apr 2018 20:49:44 +0200
|
|
Igor Gnatenko |
ef6081 |
Subject: [PATCH 01/16] guess_external_link_dependencies: deduplicate search
|
|
Igor Gnatenko |
ef6081 |
dirs and libraries.
|
|
Igor Gnatenko |
ef6081 |
|
|
Igor Gnatenko |
ef6081 |
Reduce speed impact of duplicated libs and pathes in the link command
|
|
Igor Gnatenko |
ef6081 |
line. (fixes #3465)
|
|
Igor Gnatenko |
ef6081 |
---
|
|
Igor Gnatenko |
ef6081 |
mesonbuild/backend/ninjabackend.py | 13 +++++++------
|
|
Igor Gnatenko |
ef6081 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
Igor Gnatenko |
ef6081 |
|
|
Igor Gnatenko |
ef6081 |
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
|
|
Igor Gnatenko |
ef6081 |
index eeac388c..267f0301 100644
|
|
Igor Gnatenko |
ef6081 |
--- a/mesonbuild/backend/ninjabackend.py
|
|
Igor Gnatenko |
ef6081 |
+++ b/mesonbuild/backend/ninjabackend.py
|
|
Igor Gnatenko |
ef6081 |
@@ -2429,8 +2429,8 @@ rule FORTRAN_DEP_HACK%s
|
|
Igor Gnatenko |
ef6081 |
# https://sourceware.org/bugzilla/show_bug.cgi?id=22843
|
|
Igor Gnatenko |
ef6081 |
# * Meson optimizes libraries from the same build using the symbol extractor.
|
|
Igor Gnatenko |
ef6081 |
# Just letting ninja use ld generated dependencies would undo this optimization.
|
|
Igor Gnatenko |
ef6081 |
- search_dirs = []
|
|
Igor Gnatenko |
ef6081 |
- libs = []
|
|
Igor Gnatenko |
ef6081 |
+ search_dirs = OrderedSet()
|
|
Igor Gnatenko |
ef6081 |
+ libs = OrderedSet()
|
|
Igor Gnatenko |
ef6081 |
absolute_libs = []
|
|
Igor Gnatenko |
ef6081 |
|
|
Igor Gnatenko |
ef6081 |
build_dir = self.environment.get_build_dir()
|
|
Igor Gnatenko |
ef6081 |
@@ -2451,23 +2451,24 @@ rule FORTRAN_DEP_HACK%s
|
|
Igor Gnatenko |
ef6081 |
break
|
|
Igor Gnatenko |
ef6081 |
if not os.path.isabs(path):
|
|
Igor Gnatenko |
ef6081 |
path = os.path.join(build_dir, path)
|
|
Igor Gnatenko |
ef6081 |
- search_dirs.append(path)
|
|
Igor Gnatenko |
ef6081 |
+ search_dirs.add(path)
|
|
Igor Gnatenko |
ef6081 |
elif item.startswith('-l'):
|
|
Igor Gnatenko |
ef6081 |
if len(item) > 2:
|
|
Igor Gnatenko |
ef6081 |
- libs.append(item[2:])
|
|
Igor Gnatenko |
ef6081 |
+ lib = item[2:]
|
|
Igor Gnatenko |
ef6081 |
else:
|
|
Igor Gnatenko |
ef6081 |
try:
|
|
Igor Gnatenko |
ef6081 |
- libs.append(next(it))
|
|
Igor Gnatenko |
ef6081 |
+ lib = next(it)
|
|
Igor Gnatenko |
ef6081 |
except StopIteration:
|
|
Igor Gnatenko |
ef6081 |
mlog.warning("Generated linker command has '-l' argument without following library name")
|
|
Igor Gnatenko |
ef6081 |
break
|
|
Igor Gnatenko |
ef6081 |
+ libs.add(lib)
|
|
Igor Gnatenko |
ef6081 |
elif os.path.isabs(item) and self.environment.is_library(item) and os.path.isfile(item):
|
|
Igor Gnatenko |
ef6081 |
absolute_libs.append(item)
|
|
Igor Gnatenko |
ef6081 |
|
|
Igor Gnatenko |
ef6081 |
guessed_dependencies = []
|
|
Igor Gnatenko |
ef6081 |
# TODO The get_library_naming requirement currently excludes link targets that use d or fortran as their main linker
|
|
Igor Gnatenko |
ef6081 |
if hasattr(linker, 'get_library_naming'):
|
|
Igor Gnatenko |
ef6081 |
- search_dirs += linker.get_library_dirs()
|
|
Igor Gnatenko |
ef6081 |
+ search_dirs = list(search_dirs) + linker.get_library_dirs()
|
|
Igor Gnatenko |
ef6081 |
prefixes_static, suffixes_static = linker.get_library_naming(self.environment, 'static', strict=True)
|
|
Igor Gnatenko |
ef6081 |
prefixes_shared, suffixes_shared = linker.get_library_naming(self.environment, 'shared', strict=True)
|
|
Igor Gnatenko |
ef6081 |
for libname in libs:
|
|
Igor Gnatenko |
ef6081 |
--
|
|
Igor Gnatenko |
ef6081 |
2.17.0
|
|
Igor Gnatenko |
ef6081 |
|