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

Dylan Baker dylan at pnwbakers.com
Fri Nov 16 20:10:28 UTC 2018


Quoting Eric Engestrom (2018-11-16 11:46:02)
> 
> 
> On November 16, 2018 6:29:55 PM UTC, Dylan Baker <dylan at pnwbakers.com> wrote:
> > 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
> 
> I'm assuming this dummy fix_elf() was part of your first draft of this patch?
> Anyway, I think we can just drop the whole `except` branch, this script is only
> used by meson and it has had Elf since 0.25.0, so we're safe.

Yeah, fix_elf was added in 0.46.0 of course :)
I 'll drop the try/except.

> 
> Reviewed-by: Eric Engestrom <eric at engestrom.ch>
> 
> >  
> >  
> >  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
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> 
> Cheers,
>   Eric
-------------- 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/dac003b3/attachment.sig>


More information about the mesa-dev mailing list