diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-24 00:30:13 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-24 00:30:13 +0300 |
commit | 6536354cc31a8a9aee45affaedae7c2919e4204e (patch) | |
tree | 7123a0f115b58f0cb4189ffaf3df9ccb9cf9b5df /symbolextractor.py | |
parent | 4b9d873b0317a5b91c2e2a938463804c7d8a87b1 (diff) | |
download | meson-6536354cc31a8a9aee45affaedae7c2919e4204e.zip meson-6536354cc31a8a9aee45affaedae7c2919e4204e.tar.gz meson-6536354cc31a8a9aee45affaedae7c2919e4204e.tar.bz2 |
Updated symbolextractor to work with cross builds.
Diffstat (limited to 'symbolextractor.py')
-rwxr-xr-x | symbolextractor.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/symbolextractor.py b/symbolextractor.py index a652b5d..a1c390d 100755 --- a/symbolextractor.py +++ b/symbolextractor.py @@ -23,6 +23,14 @@ # http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c import sys, subprocess, platform +from optparse import OptionParser + +usage_info = '%prog [options] <shared library> <symbol file>' + +parser = OptionParser(usage=usage_info) + +parser.add_option('--cross-host', default=None, dest='cross_host', + help='cross compilation host platform') def dummy_syms(outfilename): """Just touch it so relinking happens always.""" @@ -70,8 +78,14 @@ def osx_syms(libfilename, outfilename): result += [' '.join(x.split()[0:2]) for x in output.split('\n') if len(x) > 0 and not x.endswith('U')] write_if_changed('\n'.join(result) + '\n', outfilename) -def gen_symbols(libfilename, outfilename): - if platform.system() == 'Linux': +def gen_symbols(libfilename, outfilename, cross_host): + if cross_host is not None: + # In case of cross builds just always relink. + # In theory we could determine the correct + # toolset but there are more important things + # to do. + dummy_syms(outfilename) + elif platform.system() == 'Linux': linux_syms(libfilename, outfilename) elif platform.system() == 'Darwin': osx_syms(libfilename, outfilename) @@ -79,9 +93,10 @@ def gen_symbols(libfilename, outfilename): dummy_syms(outfilename) if __name__ == '__main__': - if len(sys.argv) != 3: + (options, args) = parser.parse_args(sys.argv) + if len(args) != 3: print(sys.argv[0], '<shared library file> <output file>') sys.exit(1) libfile = sys.argv[1] outfile = sys.argv[2] - gen_symbols(libfile, outfile) + gen_symbols(libfile, outfile, options.cross_host) |