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.
pull/11730/head
Dylan Baker 1 year ago committed by Xavier Claessens
parent 54950544c2
commit fa7c7d919a
  1. 5
      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'):

Loading…
Cancel
Save