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.
1.2
Dylan Baker 1 year ago committed by Nirbheek Chauhan
parent dd1535f6a0
commit d6d210cef7
  1. 5
      mesonbuild/backend/ninjabackend.py

@ -2093,13 +2093,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