[Mesa-dev] [PATCH v4 07/13] meson: extend install_megadrivers script to handle symmlinking

Dylan Baker dylan at pnwbakers.com
Fri Nov 17 00:27:35 UTC 2017


Which is required for the gallium media state trackers.

v4: - Make the full version the hard link and the partial so versiions
      the symlinks

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 bin/install_megadrivers.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/install_megadrivers.py b/bin/install_megadrivers.py
index a98d7dd177b..0415e5829eb 100755
--- a/bin/install_megadrivers.py
+++ b/bin/install_megadrivers.py
@@ -33,6 +33,7 @@ def main():
     parser.add_argument('megadriver')
     parser.add_argument('libdir')
     parser.add_argument('drivers', nargs='+')
+    parser.add_argument('--so-version', action='append', default=[])
     args = parser.parse_args()
 
     to = os.path.join(os.environ.get('MESON_INSTALL_DESTDIR_PREFIX'), args.libdir)
@@ -43,11 +44,27 @@ def main():
     shutil.copy(args.megadriver, master)
 
     for each in args.drivers:
-        driver = os.path.join(to, each)
+        driver_name = os.path.join(to, each)
+
+        if args.so_version:
+            driver = '{}.{}'.format(driver_name, args.so_version[0])
+        else:
+            driver = driver_name
+
         if os.path.exists(driver):
             os.unlink(driver)
         print('installing {} to {}'.format(args.megadriver, driver))
         os.link(master, driver)
+
+        if args.so_version:
+            for v in args.so_version[1:]:
+                if v:
+                    name = '{}.{}'.format(driver_name, v)
+                else:
+                    name = driver_name
+                if os.path.exists(name):
+                    os.unlink(name)
+                os.symlink(driver, name)
     os.unlink(master)
 
 
-- 
2.15.0



More information about the mesa-dev mailing list