aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-09-21 20:45:22 -0700
committerXavier Claessens <xclaesse@gmail.com>2023-09-22 07:53:33 -0400
commitfa7c7d919a8dbac8f09ef7a043e23116d655033d (patch)
tree05d4177c0f10f8f701cd78f85464e76e7020e1db
parent54950544c2a3e36a827144c82df5dbbc5c51c6c3 (diff)
downloadmeson-fa7c7d919a8dbac8f09ef7a043e23116d655033d.zip
meson-fa7c7d919a8dbac8f09ef7a043e23116d655033d.tar.gz
meson-fa7c7d919a8dbac8f09ef7a043e23116d655033d.tar.bz2
rust: properly rematerialize static dependencies as well as dynamic ones
Rustc expects to be provided both a search path `-L`, and a link arg `-l kind=libname`, but we don't handle that correctly. Because we combine -L and -l arguments from pkg-config the backend must rematerialize the -L and -l split. We currently don't do this for static archives.
-rw-r--r--mesonbuild/backend/ninjabackend.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 3d3eefd..a57b249 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2090,13 +2090,14 @@ class NinjaBackend(backends.Backend):
if a in rustc.native_static_libs:
# Exclude link args that rustc already add by default
continue
- if a.endswith(('.dll', '.so', '.dylib')):
+ if a.endswith(('.dll', '.so', '.dylib', '.a', '.lib')):
dir_, lib = os.path.split(a)
linkdirs.add(dir_)
lib, ext = os.path.splitext(lib)
if lib.startswith('lib'):
lib = lib[3:]
- args.extend(['-l', f'dylib={lib}'])
+ _type = 'static' if a.endswith(('.a', '.lib')) else 'dylib'
+ args.extend(['-l', f'{_type}={lib}'])
elif a.startswith('-L'):
args.append(a)
elif a.startswith('-l'):