mesonbuild / meson-python

Meson PEP 517 Python build backend
https://mesonbuild.com/meson-python/
MIT License
120 stars 59 forks source link

Handle rpath for dependency across sub-directories #509

Closed metab0t closed 9 months ago

metab0t commented 9 months ago

If a project has two directories: dirA and dirB

meson.build

_link_to = []

subdir('dirA')
_linkto += libA

subdir('dirB')

dirB\meson.build

meson.build

py = import('python').find_installation()
py.extension_module(
    'libB',
    'libB.c',
    link_with: _linkto,
    install: true,
)

Then the libB.so will have rpath=['$ORIGIN/../dirA'], which cannot be fixed by current mechanism (only applicable to $ORIGIN/) https://github.com/mesonbuild/meson-python/blob/36e8205ee97af275f0a2c4bf0614b583962c4415/mesonpy/_rpath.py#L30

Sample folder: link-against-local-lib.tar.gz