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.veli...@gmail.com>
CC: Eric Engestrom <eric.engest...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to