Use correct shared library naming for Cygwin

Use correct shared library naming for Cygwin when building and installing
pull/1567/head
Jon Turney 8 years ago
parent 600f16f9f8
commit 5af98a5ee8
  1. 14
      mesonbuild/build.py
  2. 24
      mesonbuild/environment.py
  3. 15
      run_project_tests.py
  4. 8
      test cases/windows/7 mingw dll versioning/installed_files.txt

@ -21,7 +21,7 @@ from . import mlog
from .mesonlib import File, MesonException
from .mesonlib import flatten, stringlistify, classify_unity_sources
from .mesonlib import get_filenames_templates_dict, substitute_values
from .environment import for_windows, for_darwin
from .environment import for_windows, for_darwin, for_cygwin
from .compilers import is_object, clike_langs, sort_clike, lang_suffixes
known_basic_kwargs = {'install': True,
@ -1120,6 +1120,18 @@ class SharedLibrary(BuildTarget):
self.filename_tpl = '{0.prefix}{0.name}-{0.soversion}.{0.suffix}'
else:
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
elif for_cygwin(is_cross, env):
suffix = 'dll'
self.gcc_import_filename = 'lib{0}.dll.a'.format(self.name)
# Shared library is of the form cygfoo.dll
# (ld --dll-search-prefix=cyg is the default)
prefix = 'cyg'
# Import library is called libfoo.dll.a
self.import_filename = self.gcc_import_filename
if self.soversion:
self.filename_tpl = '{0.prefix}{0.name}-{0.soversion}.{0.suffix}'
else:
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
elif for_darwin(is_cross, env):
prefix = 'lib'
suffix = 'dylib'

@ -158,7 +158,10 @@ def detect_cpu(compilers):
return trial
def detect_system():
return platform.system().lower()
system = platform.system().lower()
if system.startswith('cygwin'):
return 'cygwin'
return system
def for_windows(is_cross, env):
@ -173,6 +176,20 @@ def for_windows(is_cross, env):
return env.cross_info.config['host_machine']['system'] == 'windows'
return False
def for_cygwin(is_cross, env):
"""
Host machine is cygwin?
Note: 'host' is the machine on which compiled binaries will run
"""
if not is_cross:
return mesonlib.is_cygwin()
elif env.cross_info.has_host():
return env.cross_info.config['host_machine']['system'] == 'cygwin'
return False
def for_darwin(is_cross, env):
"""
Host machine is Darwin (iOS/OS X)?
@ -257,6 +274,11 @@ class Environment:
self.exe_suffix = 'exe'
self.object_suffix = 'obj'
self.win_libdir_layout = True
elif (not cross and mesonlib.is_cygwin()) \
or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'cygwin'):
self.exe_suffix = 'exe'
self.object_suffix = 'o'
self.win_libdir_layout = True
else:
self.exe_suffix = ''
self.object_suffix = 'o'

@ -31,6 +31,7 @@ import xml.etree.ElementTree as ET
import time
import multiprocessing
import concurrent.futures as conc
import re
from mesonbuild.coredata import backendlist
@ -208,12 +209,18 @@ def get_relative_files_list_from_dir(fromdir):
paths.append(path)
return paths
def platform_fix_exe_name(fname):
if not fname.endswith('?exe'):
return fname
def platform_fix_name(fname):
if '?lib' in fname:
if mesonlib.is_cygwin():
fname = re.sub(r'\?lib(.*)\.dll$', r'cyg\1.dll', fname)
else:
fname = re.sub(r'\?lib', 'lib', fname)
if fname.endswith('?exe'):
fname = fname[:-4]
if mesonlib.is_windows():
return fname + '.exe'
return fname
def validate_install(srcdir, installdir):
@ -230,7 +237,7 @@ def validate_install(srcdir, installdir):
elif os.path.exists(info_file):
with open(info_file) as f:
for line in f:
expected[platform_fix_exe_name(line.strip())] = False
expected[platform_fix_name(line.strip())] = False
# Check if expected files were found
for fname in expected:
if os.path.exists(os.path.join(installdir, fname)):

@ -1,8 +1,8 @@
usr/bin/libsome-0.dll
usr/bin/?libsome-0.dll
usr/lib/libsome.dll.a
usr/bin/libnoversion.dll
usr/bin/?libnoversion.dll
usr/lib/libnoversion.dll.a
usr/bin/libonlyversion-1.dll
usr/bin/?libonlyversion-1.dll
usr/lib/libonlyversion.dll.a
usr/bin/libonlysoversion-5.dll
usr/bin/?libonlysoversion-5.dll
usr/lib/libonlysoversion.dll.a

Loading…
Cancel
Save