From 4d3cce1532ccd6cbd5cdb6a3d12b076effedd6bd Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Tue, 22 Nov 2016 16:54:42 +0100 Subject: allow overriding readelf with READELF Signed-off-by: Marc-Antoine Perennou --- mesonbuild/scripts/symbolextractor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index c117301..2d1a428 100755 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -22,7 +22,7 @@ # This file is basically a reimplementation of # http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c -import sys, subprocess +import os, sys, subprocess from mesonbuild import mesonlib import argparse @@ -49,7 +49,12 @@ def write_if_changed(text, outfilename): f.write(text) def linux_syms(libfilename, outfilename): - pe = subprocess.Popen(['readelf', '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + evar = 'READELF' + if evar in os.environ: + readelfbin = os.environ[evar].strip() + else: + readelfbin = 'readelf' + pe = subprocess.Popen([readelfbin, '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = pe.communicate()[0].decode() if pe.returncode != 0: raise RuntimeError('Readelf does not work') -- cgit v1.1 From a70f39f815a66885cabc118d077634095b2b0878 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Tue, 22 Nov 2016 17:08:01 +0100 Subject: allow overriding nm with NM Signed-off-by: Marc-Antoine Perennou --- mesonbuild/scripts/symbolextractor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mesonbuild/scripts') diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index 2d1a428..9d28028 100755 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -54,13 +54,18 @@ def linux_syms(libfilename, outfilename): readelfbin = os.environ[evar].strip() else: 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) output = pe.communicate()[0].decode() if pe.returncode != 0: raise RuntimeError('Readelf does not work') result = [x for x in output.split('\n') if 'SONAME' in x] 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) output = pnm.communicate()[0].decode() if pnm.returncode != 0: -- cgit v1.1