aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2017-04-04 12:35:24 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2017-04-06 22:47:15 +0100
commit5af98a5ee8e8065932e9ebcaa45dd6fd42a54bdf (patch)
tree5b2dccd4e43de6fa1f7314490bd2b9b92fc2aef5 /mesonbuild
parent600f16f9f834f14ff411b477674b6112cbac33d1 (diff)
downloadmeson-5af98a5ee8e8065932e9ebcaa45dd6fd42a54bdf.zip
meson-5af98a5ee8e8065932e9ebcaa45dd6fd42a54bdf.tar.gz
meson-5af98a5ee8e8065932e9ebcaa45dd6fd42a54bdf.tar.bz2
Use correct shared library naming for Cygwin
Use correct shared library naming for Cygwin when building and installing
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/build.py14
-rw-r--r--mesonbuild/environment.py24
2 files changed, 36 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 1246f3e..895cc7f 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -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'
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 7ae53fc..7861612 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -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'