aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/build.py12
-rwxr-xr-xrun_project_tests.py57
-rw-r--r--test cases/common/122 shared module/installed_files.txt5
-rw-r--r--test cases/common/122 shared module/meson.build8
-rw-r--r--test cases/common/207 install name_prefix name_suffix/installed_files.txt15
-rw-r--r--test cases/common/207 install name_prefix name_suffix/libfile.c14
-rw-r--r--test cases/common/207 install name_prefix name_suffix/meson.build10
-rw-r--r--test cases/common/25 library versions/installed_files.txt1
-rw-r--r--test cases/common/25 library versions/lib.c13
-rw-r--r--test cases/windows/7 dll versioning/installed_files.txt10
-rw-r--r--test cases/windows/7 dll versioning/meson.build4
11 files changed, 119 insertions, 30 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 814b6bb..03a1f64 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1549,13 +1549,9 @@ class SharedLibrary(BuildTarget):
prefix = ''
suffix = ''
self.filename_tpl = self.basic_filename_tpl
- # If the user already provided the prefix and suffix to us, we don't
- # need to do any filename suffix/prefix detection.
# NOTE: manual prefix/suffix override is currently only tested for C/C++
- if self.prefix is not None and self.suffix is not None:
- pass
# C# and Mono
- elif 'cs' in self.compilers:
+ if 'cs' in self.compilers:
prefix = ''
suffix = 'dll'
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
@@ -1564,8 +1560,8 @@ class SharedLibrary(BuildTarget):
# For all other targets/platforms import_filename stays None
elif for_windows(is_cross, env):
suffix = 'dll'
- self.vs_import_filename = '{0}.lib'.format(self.name)
- self.gcc_import_filename = 'lib{0}.dll.a'.format(self.name)
+ self.vs_import_filename = '{0}{1}.lib'.format(self.prefix if self.prefix is not None else '', self.name)
+ self.gcc_import_filename = '{0}{1}.dll.a'.format(self.prefix if self.prefix is not None else 'lib', self.name)
if self.get_using_msvc():
# Shared library is of the form foo.dll
prefix = ''
@@ -1584,7 +1580,7 @@ class SharedLibrary(BuildTarget):
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)
+ self.gcc_import_filename = '{0}{1}.dll.a'.format(self.prefix if self.prefix is not None else 'lib', self.name)
# Shared library is of the form cygfoo.dll
# (ld --dll-search-prefix=cyg is the default)
prefix = 'cyg'
diff --git a/run_project_tests.py b/run_project_tests.py
index c73567e..0d64f47 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -118,10 +118,25 @@ def get_relative_files_list_from_dir(fromdir):
return paths
def platform_fix_name(fname, compiler, env):
+ # canonicalize compiler
+ if compiler == 'clang-cl':
+ canonical_compiler = 'msvc'
+ else:
+ canonical_compiler = compiler
+
if '?lib' in fname:
- if mesonlib.for_cygwin(env.is_cross_build(), env):
+ if mesonlib.for_windows(env.is_cross_build(), env) and canonical_compiler == 'msvc':
+ fname = re.sub(r'lib/\?lib(.*)\.', r'bin/\1.', fname)
+ fname = re.sub(r'/\?lib/', r'/bin/', fname)
+ elif mesonlib.for_windows(env.is_cross_build(), env):
+ fname = re.sub(r'lib/\?lib(.*)\.', r'bin/lib\1.', fname)
+ fname = re.sub(r'\?lib(.*)\.dll$', r'lib\1.dll', fname)
+ fname = re.sub(r'/\?lib/', r'/bin/', fname)
+ elif mesonlib.for_cygwin(env.is_cross_build(), env):
fname = re.sub(r'lib/\?lib(.*)\.so$', r'bin/cyg\1.dll', fname)
+ fname = re.sub(r'lib/\?lib(.*)\.', r'bin/cyg\1.', fname)
fname = re.sub(r'\?lib(.*)\.dll$', r'cyg\1.dll', fname)
+ fname = re.sub(r'/\?lib/', r'/bin/', fname)
else:
fname = re.sub(r'\?lib', 'lib', fname)
@@ -132,17 +147,47 @@ def platform_fix_name(fname, compiler, env):
if fname.startswith('?msvc:'):
fname = fname[6:]
- if compiler != 'msvc':
+ if canonical_compiler != 'msvc':
return None
if fname.startswith('?gcc:'):
fname = fname[5:]
- if compiler == 'msvc':
+ if canonical_compiler == 'msvc':
return None
if fname.startswith('?cygwin:'):
fname = fname[8:]
- if compiler == 'msvc' or not mesonlib.for_cygwin(env.is_cross_build(), env):
+ if not mesonlib.for_cygwin(env.is_cross_build(), env):
+ return None
+
+ if fname.endswith('?so'):
+ if mesonlib.for_windows(env.is_cross_build(), env) and canonical_compiler == 'msvc':
+ fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
+ fname = re.sub(r'/(?:lib|)([^/]*?)\?so$', r'/\1.dll', fname)
+ return fname
+ elif mesonlib.for_windows(env.is_cross_build(), env):
+ fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
+ fname = re.sub(r'/([^/]*?)\?so$', r'/\1.dll', fname)
+ return fname
+ elif mesonlib.for_cygwin(env.is_cross_build(), env):
+ fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
+ fname = re.sub(r'/lib([^/]*?)\?so$', r'/cyg\1.dll', fname)
+ fname = re.sub(r'/([^/]*?)\?so$', r'/\1.dll', fname)
+ return fname
+ elif mesonlib.for_darwin(env.is_cross_build(), env):
+ return fname[:-3] + '.dylib'
+ else:
+ return fname[:-3] + '.so'
+
+ if fname.endswith('?implib') or fname.endswith('?implibempty'):
+ if mesonlib.for_windows(env.is_cross_build(), env) and canonical_compiler == 'msvc':
+ # only MSVC doesn't generate empty implibs
+ if fname.endswith('?implibempty') and compiler == 'msvc':
+ return None
+ return re.sub(r'/(?:lib|)([^/]*?)\?implib(?:empty|)$', r'/\1.lib', fname)
+ elif mesonlib.for_windows(env.is_cross_build(), env) or mesonlib.for_cygwin(env.is_cross_build(), env):
+ return re.sub(r'\?implib(?:empty|)$', r'.dll.a', fname)
+ else:
return None
return fname
@@ -696,10 +741,6 @@ def detect_system_compiler():
raise RuntimeError("Could not find C compiler.")
system_compiler = comp.get_id()
- # canonicalize for platform_fix_name()
- if system_compiler == 'clang-cl':
- system_compiler = 'msvc'
-
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
parser.add_argument('extra_args', nargs='*',
diff --git a/test cases/common/122 shared module/installed_files.txt b/test cases/common/122 shared module/installed_files.txt
index 4542a55..d46527c 100644
--- a/test cases/common/122 shared module/installed_files.txt
+++ b/test cases/common/122 shared module/installed_files.txt
@@ -1,2 +1,3 @@
-usr/lib/libnosyms.so
-?msvc:usr/lib/libnosyms.pdb
+usr/lib/modules/libnosyms?so
+usr/lib/modules/libnosyms?implibempty
+?msvc:usr/lib/modules/nosyms.pdb
diff --git a/test cases/common/122 shared module/meson.build b/test cases/common/122 shared module/meson.build
index 9f9ad63..3d52300 100644
--- a/test cases/common/122 shared module/meson.build
+++ b/test cases/common/122 shared module/meson.build
@@ -13,8 +13,6 @@ e = executable('prog', 'prog.c',
test('import test', e, args : m)
# Shared module that does not export any symbols
-shared_module('nosyms', 'nosyms.c', install : true,
- # Because we don't have cross-platform library support in
- # installed_files.txt
- name_suffix : 'so',
- name_prefix : 'lib')
+shared_module('nosyms', 'nosyms.c',
+ install : true,
+ install_dir : join_paths(get_option('libdir'), 'modules'))
diff --git a/test cases/common/207 install name_prefix name_suffix/installed_files.txt b/test cases/common/207 install name_prefix name_suffix/installed_files.txt
new file mode 100644
index 0000000..240a8be
--- /dev/null
+++ b/test cases/common/207 install name_prefix name_suffix/installed_files.txt
@@ -0,0 +1,15 @@
+?msvc:usr/bin/baz.pdb
+?msvc:usr/bin/bowcorge.pdb
+?msvc:usr/bin/foo.pdb
+?msvc:usr/lib/baz.pdb
+?msvc:usr/lib/bowcorge.pdb
+?msvc:usr/lib/foo.pdb
+usr/?lib/bowcorge.stern
+usr/lib/?libbaz.cheese
+usr/lib/bar.a
+usr/lib/bowcorge?implib
+usr/lib/bowgrault.stern
+usr/lib/foo?implib
+usr/lib/foo?so
+usr/lib/libbaz?implib
+usr/lib/libqux.cheese
diff --git a/test cases/common/207 install name_prefix name_suffix/libfile.c b/test cases/common/207 install name_prefix name_suffix/libfile.c
new file mode 100644
index 0000000..44f7667
--- /dev/null
+++ b/test cases/common/207 install name_prefix name_suffix/libfile.c
@@ -0,0 +1,14 @@
+#if defined _WIN32 || defined __CYGWIN__
+ #define DLL_PUBLIC __declspec(dllexport)
+#else
+ #if defined __GNUC__
+ #define DLL_PUBLIC __attribute__ ((visibility("default")))
+ #else
+ #pragma message ("Compiler does not support symbol visibility.")
+ #define DLL_PUBLIC
+ #endif
+#endif
+
+int DLL_PUBLIC func() {
+ return 0;
+}
diff --git a/test cases/common/207 install name_prefix name_suffix/meson.build b/test cases/common/207 install name_prefix name_suffix/meson.build
new file mode 100644
index 0000000..4539999
--- /dev/null
+++ b/test cases/common/207 install name_prefix name_suffix/meson.build
@@ -0,0 +1,10 @@
+project('library with name_prefix name_suffix test', 'c')
+
+shared_library('foo', 'libfile.c', name_prefix: '', install : true)
+static_library('bar', 'libfile.c', name_prefix: '', install : true)
+
+shared_library('baz', 'libfile.c', name_suffix: 'cheese', install : true)
+static_library('qux', 'libfile.c', name_suffix: 'cheese', install : true)
+
+shared_library('corge', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true)
+static_library('grault', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true)
diff --git a/test cases/common/25 library versions/installed_files.txt b/test cases/common/25 library versions/installed_files.txt
index c842ed8..938e063 100644
--- a/test cases/common/25 library versions/installed_files.txt
+++ b/test cases/common/25 library versions/installed_files.txt
@@ -1,2 +1,3 @@
usr/lib/prefixsomelib.suffix
+usr/lib/prefixsomelib?implib
?msvc:usr/lib/prefixsomelib.pdb
diff --git a/test cases/common/25 library versions/lib.c b/test cases/common/25 library versions/lib.c
index 67b6f4d..10019dc 100644
--- a/test cases/common/25 library versions/lib.c
+++ b/test cases/common/25 library versions/lib.c
@@ -1,3 +1,14 @@
-int myFunc() {
+#if defined _WIN32 || defined __CYGWIN__
+ #define DLL_PUBLIC __declspec(dllexport)
+#else
+ #if defined __GNUC__
+ #define DLL_PUBLIC __attribute__ ((visibility("default")))
+ #else
+ #pragma message ("Compiler does not support symbol visibility.")
+ #define DLL_PUBLIC
+ #endif
+#endif
+
+int DLL_PUBLIC myFunc() {
return 55;
}
diff --git a/test cases/windows/7 dll versioning/installed_files.txt b/test cases/windows/7 dll versioning/installed_files.txt
index 517620e..62b5c9a 100644
--- a/test cases/windows/7 dll versioning/installed_files.txt
+++ b/test cases/windows/7 dll versioning/installed_files.txt
@@ -14,9 +14,9 @@
?msvc:usr/libexec/customdir.dll
?msvc:usr/libexec/customdir.lib
?msvc:usr/libexec/customdir.pdb
-?msvc:usr/lib/module.dll
-?msvc:usr/lib/module.lib
-?msvc:usr/lib/module.pdb
+?msvc:usr/lib/modules/module.dll
+?msvc:usr/lib/modules/module.lib
+?msvc:usr/lib/modules/module.pdb
?gcc:usr/bin/?libsome-0.dll
?gcc:usr/lib/libsome.dll.a
?gcc:usr/bin/?libnoversion.dll
@@ -27,5 +27,5 @@
?gcc:usr/lib/libonlysoversion.dll.a
?gcc:usr/libexec/?libcustomdir.dll
?gcc:usr/libexec/libcustomdir.dll.a
-?gcc:usr/lib/?libmodule.dll
-?gcc:usr/lib/libmodule.dll.a
+?gcc:usr/lib/modules/?libmodule.dll
+?gcc:usr/lib/modules/libmodule.dll.a
diff --git a/test cases/windows/7 dll versioning/meson.build b/test cases/windows/7 dll versioning/meson.build
index 80acf88..983c2c4 100644
--- a/test cases/windows/7 dll versioning/meson.build
+++ b/test cases/windows/7 dll versioning/meson.build
@@ -49,4 +49,6 @@ shared_library('customdir', 'lib.c',
install : true,
install_dir : get_option('libexecdir'))
-shared_module('module', 'lib.c', install : true)
+shared_module('module', 'lib.c',
+ install : true,
+ install_dir: join_paths(get_option('libdir'), 'modules'))