Fix soname to work on OSX.

pull/795/head
Jussi Pakkanen 8 years ago
parent 3a002709f4
commit f0fee2e542
  1. 3
      mesonbuild/backend/ninjabackend.py
  2. 23
      mesonbuild/compilers.py

@ -1827,8 +1827,7 @@ rule FORTRAN_DEP_HACK
soversion = target.soversion
else:
soversion = None
soname = target.prefix + target.name + '.' + target.suffix
commands += linker.get_soname_args(soname, abspath, soversion)
commands += linker.get_soname_args(target.prefix, target.name, target.suffix, abspath, soversion)
# This is only visited when using the Visual Studio toolchain
if target.vs_module_defs and hasattr(linker, 'gen_vs_module_defs_args'):
commands += linker.gen_vs_module_defs_args(target.vs_module_defs.rel_to_builddir(self.build_to_src))

@ -469,7 +469,7 @@ class CCompiler(Compiler):
def get_warn_args(self, level):
return self.warn_args[level]
def get_soname_args(self, shlib_name, path, soversion):
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return []
def split_shlib_to_parts(self, fname):
@ -1104,7 +1104,7 @@ class MonoCompiler(Compiler):
def get_link_args(self, fname):
return ['-r:' + fname]
def get_soname_args(self, shlib_name, path, soversion):
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return []
def get_werror_args(self):
@ -1191,7 +1191,7 @@ class JavaCompiler(Compiler):
self.id = 'unknown'
self.javarunner = 'java'
def get_soname_args(self, shlib_name, path, soversion):
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return []
def get_werror_args(self):
@ -1466,7 +1466,7 @@ class DCompiler(Compiler):
def get_std_shared_lib_link_args(self):
return ['-shared']
def get_soname_args(self, shlib_name, path, soversion):
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return []
def get_unittest_args(self):
@ -1887,13 +1887,14 @@ CLANG_OSX = 1
CLANG_WIN = 2
# Possibly clang-cl?
def get_gcc_soname_args(gcc_type, shlib_name, path, soversion):
def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion):
if soversion is None:
sostr = ''
else:
sostr = '.' + soversion
if gcc_type == GCC_STANDARD or gcc_type == GCC_MINGW:
# Might not be correct for mingw but seems to work.
return ['-Wl,-soname,%s%s.%s%s' % (prefix, shlib_name, suffix, sostr)]
return ['-Wl,-soname,%s%s' % (shlib_name, sostr)]
elif gcc_type == GCC_OSX:
return ['-install_name', os.path.join(path, 'lib' + shlib_name + '.dylib')]
@ -1953,8 +1954,8 @@ class GnuCompiler:
def split_shlib_to_parts(self, fname):
return (os.path.split(fname)[0], fname)
def get_soname_args(self, shlib_name, path, soversion):
return get_gcc_soname_args(self.gcc_type, shlib_name, path, soversion)
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion)
class GnuCCompiler(GnuCompiler, CCompiler):
def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None):
@ -2079,7 +2080,7 @@ class ClangCompiler():
# so it might change semantics at any time.
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))]
def get_soname_args(self, shlib_name, path, soversion):
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
if self.clang_type == CLANG_STANDARD:
gcc_type = GCC_STANDARD
elif self.clang_type == CLANG_OSX:
@ -2088,7 +2089,7 @@ class ClangCompiler():
gcc_type = GCC_MINGW
else:
raise MesonException('Unreachable code when converting clang type to gcc type.')
return get_gcc_soname_args(gcc_type, shlib_name, path, soversion)
return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion)
class ClangCCompiler(ClangCompiler, CCompiler):
def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None):
@ -2226,8 +2227,8 @@ end program prog
def split_shlib_to_parts(self, fname):
return (os.path.split(fname)[0], fname)
def get_soname_args(self, shlib_name, path, soversion):
return get_gcc_soname_args(self.gcc_type, shlib_name, path, soversion)
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion)
def get_dependency_gen_args(self, outtarget, outfile):
# Disabled until this is fixed:

Loading…
Cancel
Save