Merge pull request #680 from centricular/osx-dylib-soversion
Add a test to find libfoo.X.dylib via -lfoo
This commit is contained in:
commit
6ae40344e0
|
@ -825,12 +825,10 @@ class SharedLibrary(BuildTarget):
|
||||||
elif for_darwin(is_cross, env):
|
elif for_darwin(is_cross, env):
|
||||||
prefix = 'lib'
|
prefix = 'lib'
|
||||||
suffix = 'dylib'
|
suffix = 'dylib'
|
||||||
if self.soversion:
|
# libfoo.dylib
|
||||||
# libfoo.X.dylib
|
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
|
||||||
self.filename_tpl = '{0.prefix}{0.name}.{0.soversion}.{0.suffix}'
|
# On OS X, the filename should never have the soversion
|
||||||
else:
|
# See: https://github.com/mesonbuild/meson/pull/680
|
||||||
# libfoo.dylib
|
|
||||||
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
|
|
||||||
else:
|
else:
|
||||||
prefix = 'lib'
|
prefix = 'lib'
|
||||||
suffix = 'so'
|
suffix = 'so'
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
usr/lib/libsome.0.dylib
|
usr/lib/libsome.dylib
|
||||||
usr/lib/libnoversion.dylib
|
usr/lib/libnoversion.dylib
|
||||||
usr/lib/libonlyversion.1.dylib
|
usr/lib/libonlyversion.dylib
|
||||||
usr/lib/libonlysoversion.5.dylib
|
usr/lib/libonlysoversion.dylib
|
||||||
|
|
|
@ -1,18 +1,41 @@
|
||||||
project('library versions', 'c')
|
project('library versions', 'c')
|
||||||
|
|
||||||
shared_library('some', 'lib.c',
|
some = shared_library('some', 'lib.c',
|
||||||
version : '1.2.3',
|
version : '1.2.3',
|
||||||
soversion : '0',
|
soversion : '0',
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
shared_library('noversion', 'lib.c',
|
noversion = shared_library('noversion', 'lib.c',
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
shared_library('onlyversion', 'lib.c',
|
onlyversion = shared_library('onlyversion', 'lib.c',
|
||||||
version : '1.4.5',
|
version : '1.4.5',
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
shared_library('onlysoversion', 'lib.c',
|
onlysoversion = shared_library('onlysoversion', 'lib.c',
|
||||||
# Also test that int soversion is acceptable
|
# Also test that int soversion is acceptable
|
||||||
soversion : 5,
|
soversion : 5,
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
|
# Hack to make the executables below depend on the shared libraries above
|
||||||
|
# without actually adding them as `link_with` dependencies since we want to try
|
||||||
|
# linking to them with -lfoo linker arguments.
|
||||||
|
out = custom_target('library-dependency-hack',
|
||||||
|
input : 'exe.orig.c',
|
||||||
|
output : 'exe.c',
|
||||||
|
depends : [some, noversion, onlyversion, onlysoversion],
|
||||||
|
command : ['cp', '@INPUT@', '@OUTPUT@'])
|
||||||
|
|
||||||
|
# Manually test if the linker can find the above libraries
|
||||||
|
# i.e., whether they were generated with the right naming scheme
|
||||||
|
executable('manuallink1', out,
|
||||||
|
link_args : ['-L.', '-lsome'])
|
||||||
|
|
||||||
|
executable('manuallink2', out,
|
||||||
|
link_args : ['-L.', '-lnoversion'])
|
||||||
|
|
||||||
|
executable('manuallink3', out,
|
||||||
|
link_args : ['-L.', '-lonlyversion'])
|
||||||
|
|
||||||
|
executable('manuallink4', out,
|
||||||
|
link_args : ['-L.', '-lonlysoversion'])
|
||||||
|
|
Loading…
Reference in New Issue