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...
pull/4480/head
Jon Turney 6 years ago
parent 7a959ffbba
commit b17f6dae54
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 35
      run_project_tests.py
  2. 10
      test cases/common/207 install name_prefix name_suffix/installed_files.txt
  3. 14
      test cases/common/207 install name_prefix name_suffix/libfile.c
  4. 7
      test cases/common/207 install name_prefix name_suffix/meson.build

@ -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):

@ -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

@ -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;
}

@ -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)
Loading…
Cancel
Save