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 | |
parent | cbd143844d54694fda90330e0d49c7ac408c532e (diff) | |
download | meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.zip meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.tar.gz meson-04e89d0867e358df347dbc8cb91e6df7bc365d9a.tar.bz2 |
symbolextractor: Add support for Cygwin
-rw-r--r-- | mesonbuild/scripts/symbolextractor.py | 26 | ||||
-rwxr-xr-x | run_unittests.py | 4 |
2 files changed, 27 insertions, 3 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 ' diff --git a/run_unittests.py b/run_unittests.py index 51193f0..af2ca9d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1759,7 +1759,7 @@ class BasePlatformTests(unittest.TestCase): @staticmethod def get_target_from_filename(filename): base = os.path.splitext(filename)[0] - if base.startswith('lib'): + if base.startswith(('lib', 'cyg')): return base[3:] return base @@ -2591,8 +2591,6 @@ class AllPlatformTests(BasePlatformTests): Test that no-op changes to the build files such as mtime do not cause a rebuild of anything. ''' - if is_cygwin(): - raise unittest.SkipTest('symbolextractor has not been implemented for Cygwin yet') testdir = os.path.join(self.common_test_dir, '6 linkshared') self.init(testdir) self.build() |