aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-10-31 12:31:10 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2018-11-06 13:17:12 +0000
commitb17f6dae541ec9744e82c2cb6f1c31c9a76b45f5 (patch)
treee5b59a95a1e9a83965d66a8d284cebda01b594c1
parent7a959ffbba6a410a25ec4fef6a6ff039d8c604e2 (diff)
downloadmeson-b17f6dae541ec9744e82c2cb6f1c31c9a76b45f5.zip
meson-b17f6dae541ec9744e82c2cb6f1c31c9a76b45f5.tar.gz
meson-b17f6dae541ec9744e82c2cb6f1c31c9a76b45f5.tar.bz2
Add a test of installed library names when name_{suf,pre}fix: is used
Extend platform_fix_name() to handle this case We avoid using library(version:), so we don't have to teach platform_fix_name() all the platform details of versioned shared library naming. Hopefully that's exercised by platform-specific tests...
-rwxr-xr-xrun_project_tests.py35
-rw-r--r--test cases/common/207 install name_prefix name_suffix/installed_files.txt10
-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.build7
4 files changed, 65 insertions, 1 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index c73567e..6f7d9d7 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -119,8 +119,14 @@ def get_relative_files_list_from_dir(fromdir):
def platform_fix_name(fname, compiler, env):
if '?lib' in fname:
- if mesonlib.for_cygwin(env.is_cross_build(), env):
+ if mesonlib.for_windows(env.is_cross_build(), env) and compiler == 'msvc':
+ fname = re.sub(r'lib/\?lib(.*)\.', r'bin/\1.', 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)
+ 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)
else:
fname = re.sub(r'\?lib', 'lib', fname)
@@ -145,6 +151,33 @@ def platform_fix_name(fname, compiler, env):
if compiler == 'msvc' or 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'):
+ if mesonlib.for_windows(env.is_cross_build(), env) and compiler == 'msvc':
+ return re.sub(r'/(?:lib|)([^/]*?)\?implib$', r'/\1.lib', fname)
+ elif mesonlib.for_windows(env.is_cross_build(), env) or mesonlib.for_cygwin(env.is_cross_build(), env):
+ return fname[:-7] + '.dll.a'
+ else:
+ return None
+
return fname
def validate_install(srcdir, installdir, compiler, env):
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..d590591
--- /dev/null
+++ b/test cases/common/207 install name_prefix name_suffix/installed_files.txt
@@ -0,0 +1,10 @@
+?msvc:usr/bin/baz.pdb
+?msvc:usr/bin/foo.pdb
+?msvc:usr/lib/baz.pdb
+?msvc:usr/lib/foo.pdb
+usr/lib/?libbaz.cheese
+usr/lib/bar.a
+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..1ae98b6
--- /dev/null
+++ b/test cases/common/207 install name_prefix name_suffix/meson.build
@@ -0,0 +1,7 @@
+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)