allow overriding nm with NM

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
pull/1086/head
Marc-Antoine Perennou 8 years ago
parent 4d3cce1532
commit a70f39f815
  1. 7
      mesonbuild/scripts/symbolextractor.py

@ -54,13 +54,18 @@ def linux_syms(libfilename, outfilename):
readelfbin = os.environ[evar].strip() readelfbin = os.environ[evar].strip()
else: else:
readelfbin = 'readelf' readelfbin = 'readelf'
evar = 'NM'
if evar in os.environ:
nmbin = os.environ[evar].strip()
else:
nmbin = 'nm'
pe = subprocess.Popen([readelfbin, '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) pe = subprocess.Popen([readelfbin, '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = pe.communicate()[0].decode() output = pe.communicate()[0].decode()
if pe.returncode != 0: if pe.returncode != 0:
raise RuntimeError('Readelf does not work') raise RuntimeError('Readelf does not work')
result = [x for x in output.split('\n') if 'SONAME' in x] result = [x for x in output.split('\n') if 'SONAME' in x]
assert(len(result) <= 1) assert(len(result) <= 1)
pnm = subprocess.Popen(['nm', '--dynamic', '--extern-only', '--defined-only', '--format=posix', libfilename], pnm = subprocess.Popen([nmbin, '--dynamic', '--extern-only', '--defined-only', '--format=posix', libfilename],
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = pnm.communicate()[0].decode() output = pnm.communicate()[0].decode()
if pnm.returncode != 0: if pnm.returncode != 0:

Loading…
Cancel
Save