[Mesa-dev] [PATCH] meson: strip rpath when installing megadrivers

Dylan Baker dylan at pnwbakers.com
Fri Nov 16 20:12:27 UTC 2018


I should test this on MacOS... I will do that before pushing.

Quoting Dylan Baker (2018-11-16 10:28:36)
> This is the script that meson uses to install megadrivers. Meson always
> sets rpath for in tree dependencies at build time, and normally rpaths
> are stripped at install time. The install megadrivers script breaks this
> by bypassing meson's normal install machinery.
> 
> To fix this I've imported the function that meson's install uses to
> strip the rpath and invoked it manually.
> 
> I still think the correct fix is to have meson do this for us
> preferably when passing the binary to `meson.add_install_script`, but
> that will not happen until meson 0.49.0 at the earliest (which is due
> out fairly soon, so it might slip till 0.50.0), and we are not going to
> stop supporting earlier versions than that for some time.
> 
> Fixes: 3218056e0eb375eeda470058d06add1532acd6d4
>        ("meson: Build i965 and dri stack")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108766
> CC: Emil Velikov <emil.l.velikov at gmail.com>
> CC: Eric Engestrom <eric.engestrom at intel.com>
> ---
>  bin/install_megadrivers.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/bin/install_megadrivers.py b/bin/install_megadrivers.py
> index d29b1911218..82a7086d0f2 100644
> --- a/bin/install_megadrivers.py
> +++ b/bin/install_megadrivers.py
> @@ -25,6 +25,17 @@ from __future__ import print_function
>  import argparse
>  import os
>  import shutil
> +import sys
> +
> +try:
> +    from mesonbuild.scripts.depfixer import Elf
> +except ImportError:
> +    # I don't think we'll hit this case, but just to be safe.
> +    print("WARNING: cannot find meson's fix_elf, rpath will not be stripped.",
> +          file=sys.stderr)
> +
> +    def fix_elf(*args, **kwargs):
> +        pass
>  
>  
>  def main():
> @@ -47,6 +58,11 @@ def main():
>          os.makedirs(to)
>      shutil.copy(args.megadriver, master)
>  
> +    # Strip rpath from the installed driver. Use Elf rather than the fix_elf
> +    # helper, as it was added in 0.46, and we only require 0.45
> +    with Elf(master) as e:
> +        e.fix_rpath('')
> +
>      for driver in args.drivers:
>          abs_driver = os.path.join(to, driver)
>  
> -- 
> 2.19.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181116/4c30bbc1/attachment.sig>


More information about the mesa-dev mailing list