diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-02-18 02:08:45 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-02-22 06:49:34 +0530 |
commit | 04e89d0867e358df347dbc8cb91e6df7bc365d9a (patch) | |
tree | 5a663a931a29bdc8743b1d27534bdd54ce1ac991 /mesonbuild/scripts | |
parent | cbd143844d54694fda90330e0d49c7ac408c532e (diff) | |
download | meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.zip meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.tar.gz meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.tar.bz2 |
symbolextractor: Add support for Cygwin
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/symbolextractor.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index 25416c6..65b2189 100644 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -139,6 +139,25 @@ def osx_syms(libfilename: str, outfilename: str): result += [' '.join(x.split()[0:2]) for x in output.split('\n')] write_if_changed('\n'.join(result) + '\n', outfilename) +def cygwin_syms(impfilename: str, outfilename: str): + # Get the name of the library + output = call_tool('dlltool', ['-I', impfilename]) + if not output: + dummy_syms(outfilename) + return + result = [output] + # Get the list of all symbols exported + output = call_tool('nm', ['--extern-only', '--defined-only', + '--format=posix', impfilename]) + if not output: + dummy_syms(outfilename) + return + for line in output.split('\n'): + if ' T ' not in line: + continue + result.append(line.split(maxsplit=1)[0]) + write_if_changed('\n'.join(result) + '\n', outfilename) + def _get_implib_dllname(impfilename: str) -> T.Tuple[T.List[str], str]: all_stderr = '' # First try lib.exe, which is provided by MSVC. Then llvm-lib.exe, by LLVM @@ -222,6 +241,13 @@ def gen_symbols(libfilename: str, impfilename: str, outfilename: str, cross_host # No import library. Not sure how the DLL is being used, so just # rebuild everything that links to it every time. dummy_syms(outfilename) + elif mesonlib.is_cygwin(): + if os.path.isfile(impfilename): + cygwin_syms(impfilename, outfilename) + else: + # No import library. Not sure how the DLL is being used, so just + # rebuild everything that links to it every time. + dummy_syms(outfilename) else: if not os.path.exists(TOOL_WARNING_FILE): mlog.warning('Symbol extracting has not been implemented for this ' |