aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-10-06 00:22:44 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-10-06 00:22:44 +0300
commit6694d01a16d7c87546fa80614a86072342ce3742 (patch)
tree93af932c8337658b47c38cf9598463ae9017da59
parent0f2d43669d9c34dcce8f4ec754396538254893af (diff)
downloadmeson-6694d01a16d7c87546fa80614a86072342ce3742.zip
meson-6694d01a16d7c87546fa80614a86072342ce3742.tar.gz
meson-6694d01a16d7c87546fa80614a86072342ce3742.tar.bz2
Fixed OSX.
-rw-r--r--backends.py3
-rw-r--r--environment.py36
2 files changed, 31 insertions, 8 deletions
diff --git a/backends.py b/backends.py
index 32bec62..203fe86 100644
--- a/backends.py
+++ b/backends.py
@@ -845,13 +845,14 @@ class NinjaBackend(Backend):
if target.is_cross:
crstr = '_CROSS'
linker_rule = linker_base + crstr + '_LINKER'
+ abspath = os.path.join(self.environment.get_build_dir(), target.subdir)
commands = []
if isinstance(target, build.Executable):
commands += linker.get_std_exe_link_flags()
elif isinstance(target, build.SharedLibrary):
commands += linker.get_std_shared_lib_link_flags()
commands += linker.get_pic_flags()
- commands += linker.get_soname_flags(target.name)
+ commands += linker.get_soname_flags(target.name, abspath)
elif isinstance(target, build.StaticLibrary):
commands += linker.get_std_link_flags()
else:
diff --git a/environment.py b/environment.py
index da2faca..94290c1 100644
--- a/environment.py
+++ b/environment.py
@@ -56,7 +56,7 @@ class CCompiler():
def get_always_flags(self):
return []
- def get_soname_flags(self, shlib_name):
+ def get_soname_flags(self, shlib_name, path):
return []
def split_shlib_to_parts(self, fname):
@@ -495,13 +495,26 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler):
if pe.returncode != 0:
raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
+GCC_STANDARD = 0
+GCC_OSX = 1
+GCC_MINGW = 2
+
+def get_gcc_soname_flags(gcc_type, shlib_name, path):
+ if gcc_type == GCC_STANDARD:
+ return ['-Wl,-soname,lib%s.so' % shlib_name]
+ elif gcc_type == GCC_OSX:
+ return ['-install_name', os.path.join(path, 'lib' + shlib_name + '.dylib')]
+ else:
+ raise RuntimeError('Not impelented yet.')
+
class GnuCCompiler(CCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
- def __init__(self, exelist, version, is_cross, exe_wrapper=None):
+ def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
self.id = 'gcc'
+ self.gcc_type = gcc_type
def get_std_warn_flags(self):
return GnuCCompiler.std_warn_flags
@@ -518,8 +531,8 @@ class GnuCCompiler(CCompiler):
def build_rpath_args(self, build_dir, rpath_paths):
return ['-Wl,-rpath,' + ':'.join([os.path.join(build_dir, p) for p in rpath_paths])]
- def get_soname_flags(self, shlib_name):
- return ['-Wl,-soname,lib%s.so' % shlib_name]
+ def get_soname_flags(self, shlib_name, path):
+ return get_gcc_soname_flags(self.gcc_type, shlib_name, path)
class GnuObjCCompiler(ObjCCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
@@ -541,6 +554,9 @@ class GnuObjCCompiler(ObjCCompiler):
def build_rpath_args(self, build_dir, rpath_paths):
return ['-Wl,-rpath,' + ':'.join([os.path.join(build_dir, p) for p in rpath_paths])]
+ def get_soname_flags(self, shlib_name, path):
+ return get_gcc_soname_flags(self.gcc_type, shlib_name, path)
+
class GnuObjCPPCompiler(ObjCPPCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
@@ -561,6 +577,9 @@ class GnuObjCPPCompiler(ObjCPPCompiler):
def build_rpath_args(self, build_dir, rpath_paths):
return ['-Wl,-rpath,' + ':'.join([os.path.join(build_dir, p) for p in rpath_paths])]
+ def get_soname_flags(self, shlib_name, path):
+ return get_gcc_soname_flags(self.gcc_type, shlib_name, path)
+
class ClangCCompiler(CCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
@@ -603,6 +622,9 @@ class GnuCPPCompiler(CPPCompiler):
def build_rpath_args(self, build_dir, rpath_paths):
return ['-Wl,-rpath,' + ':'.join([os.path.join(build_dir, p) for p in rpath_paths])]
+ def get_soname_flags(self, shlib_name, path):
+ return get_gcc_soname_flags(self.gcc_type, shlib_name, path)
+
class ClangCPPCompiler(CPPCompiler):
std_warn_flags = ['-Wall', '-Winvalid-pch']
std_opt_flags = ['-O2']
@@ -856,11 +878,11 @@ class Environment():
version = vmatch.group(0)
else:
version = 'unknown version'
+ if 'apple' in out and 'Free Software Foundation' in out:
+ return GnuCCompiler(ccache + [compiler], version, GCC_OSX, is_cross, exe_wrap)
if (out.startswith('cc') or 'gcc' in out) and \
'Free Software Foundation' in out:
- return GnuCCompiler(ccache + [compiler], version, is_cross, exe_wrap)
- if 'apple' in out and 'Free Software Foundation' in out:
- return GnuCCompiler(ccache + [compiler], version, is_cross, exe_wrap)
+ return GnuCCompiler(ccache + [compiler], version, GCC_STANDARD, is_cross, exe_wrap)
if (out.startswith('clang')):
return ClangCCompiler(ccache + [compiler], version, is_cross, exe_wrap)
if 'Microsoft' in out: