mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
meson: Getting symbols-check.py works for mingw
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37289>
This commit is contained in:
parent
bd915eeb96
commit
57d273b55b
2 changed files with 34 additions and 4 deletions
|
|
@ -121,6 +121,23 @@ def get_symbols_dumpbin(dumpbin, lib):
|
||||||
symbols.append(symbol_name)
|
symbols.append(symbol_name)
|
||||||
return symbols
|
return symbols
|
||||||
|
|
||||||
|
def get_symbols_gendef(gendef, lib):
|
||||||
|
'''
|
||||||
|
List all the (non platform-specific) symbols exported by the library
|
||||||
|
using `gendef -`
|
||||||
|
'''
|
||||||
|
symbols = []
|
||||||
|
output = subprocess.check_output([gendef, '-', lib],
|
||||||
|
stderr=open(os.devnull, 'w')).decode("ascii")
|
||||||
|
ordinal_table_found = False
|
||||||
|
for line in output.splitlines():
|
||||||
|
if not ordinal_table_found:
|
||||||
|
if line.strip() == 'EXPORTS':
|
||||||
|
ordinal_table_found = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
symbols.append(line.strip())
|
||||||
|
return symbols
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
@ -138,15 +155,21 @@ def main():
|
||||||
parser.add_argument('--dumpbin',
|
parser.add_argument('--dumpbin',
|
||||||
action='store',
|
action='store',
|
||||||
help='path to binary (or name in $PATH)')
|
help='path to binary (or name in $PATH)')
|
||||||
|
parser.add_argument('--gendef',
|
||||||
|
action='store',
|
||||||
|
help='path to binary (or name in $PATH)')
|
||||||
parser.add_argument('--ignore-symbol',
|
parser.add_argument('--ignore-symbol',
|
||||||
action='append',
|
action='append',
|
||||||
help='do not process this symbol')
|
help='do not process this symbol')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
if not args.dumpbin:
|
if args.dumpbin:
|
||||||
parser.error('--dumpbin is mandatory')
|
lib_symbols = get_symbols_dumpbin(args.dumpbin, args.lib)
|
||||||
lib_symbols = get_symbols_dumpbin(args.dumpbin, args.lib)
|
elif args.gendef:
|
||||||
|
lib_symbols = get_symbols_gendef(args.gendef, args.lib)
|
||||||
|
else:
|
||||||
|
parser.error('--dumpbin is mandatory for msvc, --gendef is mandatory for mingw')
|
||||||
else:
|
else:
|
||||||
if not args.nm:
|
if not args.nm:
|
||||||
parser.error('--nm is mandatory')
|
parser.error('--nm is mandatory')
|
||||||
|
|
|
||||||
|
|
@ -2224,12 +2224,19 @@ endif
|
||||||
|
|
||||||
pkg = import('pkgconfig')
|
pkg = import('pkgconfig')
|
||||||
|
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows' and cc.get_argument_syntax() == 'msvc'
|
||||||
prog_dumpbin = find_program('dumpbin', required : false)
|
prog_dumpbin = find_program('dumpbin', required : false)
|
||||||
with_symbols_check = prog_dumpbin.found() and with_tests
|
with_symbols_check = prog_dumpbin.found() and with_tests
|
||||||
if with_symbols_check
|
if with_symbols_check
|
||||||
symbols_check_args = ['--dumpbin', prog_dumpbin.full_path()]
|
symbols_check_args = ['--dumpbin', prog_dumpbin.full_path()]
|
||||||
endif
|
endif
|
||||||
|
elif host_machine.system() == 'windows' and cc.get_argument_syntax() != 'msvc'
|
||||||
|
# mingw
|
||||||
|
prog_gendef = find_program('gendef', required : false)
|
||||||
|
with_symbols_check = prog_gendef.found() and with_tests
|
||||||
|
if with_symbols_check
|
||||||
|
symbols_check_args = ['--gendef', prog_gendef.full_path()]
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
prog_nm = find_program('nm')
|
prog_nm = find_program('nm')
|
||||||
with_symbols_check = prog_nm.found() and with_tests
|
with_symbols_check = prog_nm.found() and with_tests
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue