meson/megadriver: support various lib suffixes

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32333>
(cherry picked from commit ffd02b8ad8)

Conflicts:
	bin/install_megadrivers.py
This commit is contained in:
Eric Engestrom
2024-11-25 18:16:11 +01:00
committed by Dylan Baker
parent 6865204891
commit 95dd4c1992
8 changed files with 19 additions and 8 deletions

View File

@@ -2714,7 +2714,7 @@
"description": "meson/megadriver: support various lib suffixes",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -42,8 +42,13 @@ def main():
parser.add_argument('libdir')
parser.add_argument('drivers', nargs='+')
parser.add_argument('--megadriver_libdir')
parser.add_argument('--libname-suffix', required=True)
args = parser.parse_args()
# Not neccesarily at the end, there might be a version suffix, but let's
# make sure that the same suffix is in the megadriver lib name.
assert '.' + args.libname_suffix in args.megadriver
to = resolve_libdir(args.libdir)
if args.megadriver_libdir:
md_to = resolve_libdir(args.megadriver_libdir)
@@ -74,7 +79,7 @@ def main():
os.chdir(to)
name, ext = os.path.splitext(driver)
while ext != '.so':
while ext != '.' + args.libname_suffix:
if os.path.lexists(name):
os.unlink(name)
os.symlink(driver, name)
@@ -82,9 +87,9 @@ def main():
finally:
os.chdir(ret)
# Remove meson-created .so symlinks
# Remove meson-created symlinks
name, ext = os.path.splitext(master)
while ext != '.so':
while ext != '.' + args.libname_suffix:
if os.path.lexists(name):
os.unlink(name)
name, ext = os.path.splitext(name)

View File

@@ -13,4 +13,5 @@ symbols_check = find_program('symbols-check.py')
install_megadrivers_py = find_program('install_megadrivers.py')
install_megadrivers = [
install_megadrivers_py.full_path(),
'--libname-suffix', libname_suffix,
]

View File

@@ -20,6 +20,11 @@ project(
if host_machine.system() == 'darwin'
add_languages('objc', native : false)
add_project_arguments('-fobjc-arc', language : 'objc')
libname_suffix = 'dylib'
elif host_machine.system() == 'windows'
libname_suffix = 'dll'
else
libname_suffix = 'so'
endif
cc = meson.get_compiler('c')

View File

@@ -67,7 +67,7 @@ libgallium_dri = shared_library(
driver_asahi, driver_crocus
],
install : true,
name_suffix : 'so',
name_suffix : libname_suffix,
)
if with_gallium_va or with_gallium_vdpau

View File

@@ -59,7 +59,7 @@ dril_dri = shared_library(
# Will be deleted during installation, see install_megadrivers.py
install : true,
install_dir : dri_drivers_path,
name_suffix : 'so',
name_suffix : libname_suffix,
)
foreach d : [[with_gallium_kmsro, [

View File

@@ -84,7 +84,7 @@ else
link_depends : va_link_depends,
install : true,
install_dir : va_drivers_path,
name_suffix : 'so',
name_suffix : libname_suffix,
)
foreach d : [[with_gallium_r600, 'r600'],

View File

@@ -47,7 +47,7 @@ libvdpau_gallium = shared_library(
soversion : '@0@.@1@.0'.format(VDPAU_MAJOR, VDPAU_MINOR),
install : true,
install_dir : vdpau_drivers_path,
name_suffix : 'so',
name_suffix : libname_suffix,
)
foreach d : [[with_gallium_r600, 'r600'],
[with_gallium_radeonsi, 'radeonsi'],