meson: extend install_megadrivers script to handle symmlinking
authorDylan Baker <dylan@pnwbakers.com>
Fri, 10 Nov 2017 01:52:31 +0000 (17:52 -0800)
committerDylan Baker <dylan@pnwbakers.com>
Mon, 4 Dec 2017 22:36:26 +0000 (14:36 -0800)
Which is required for the gallium media state trackers.

v2: - Make symlinks local instead of absolute

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
bin/install_megadrivers.py

index a98d7dd177bd3bc29a8643b65491cc348da3ec1a..86bfa3591888945a193686c0b22a1a0ca12418b8 100755 (executable)
@@ -44,10 +44,24 @@ def main():
 
     for each in args.drivers:
         driver = os.path.join(to, each)
+
         if os.path.exists(driver):
             os.unlink(driver)
         print('installing {} to {}'.format(args.megadriver, driver))
         os.link(master, driver)
+
+        try:
+            ret = os.getcwd()
+            os.chdir(to)
+
+            name, ext = os.path.splitext(each)
+            while ext != '.so':
+                if os.path.exists(name):
+                    os.unlink(name)
+                os.symlink(driver, name)
+                name, ext = os.path.splitext(name)
+        finally:
+            os.chdir(ret)
     os.unlink(master)