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

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 17 17:03:00 UTC 2017


On Thursday, 2017-11-16 16:27:35 -0800, Dylan Baker wrote:
> 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:]:

I don't see why we would want to have a different major X for
`libfoo.so.X` and `libfoo.so.X.Y.Z`?  NVidia does it, but they also do
a lot of other things we don't want, so I'm not sure they can count as
an example for anything :P

How about replacing the line above with:

    versions = [None, args.so_version.split('.')[0]]
    for v in versions:

and making --so-version `action='store', default=None`, and dropping all
the partial versions when calling the script.

This will result in the behaviour we currently have with autotools.

> +                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