aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-07-02 15:26:02 -0700
committerDylan Baker <dylan@pnwbakers.com>2019-07-15 10:59:22 -0700
commit5d685e7a5c5d2705591d908ec985b6cc8994c4d9 (patch)
tree0a679d2cc54c74a9e77c312ba6f108ed11c70fc8 /mesonbuild/compilers/mixins
parent1b276598ce0319c9bcbf7cd34e042a545ec9ef70 (diff)
downloadmeson-5d685e7a5c5d2705591d908ec985b6cc8994c4d9.zip
meson-5d685e7a5c5d2705591d908ec985b6cc8994c4d9.tar.gz
meson-5d685e7a5c5d2705591d908ec985b6cc8994c4d9.tar.bz2
compilers: put elbrus in mixins
Diffstat (limited to 'mesonbuild/compilers/mixins')
-rw-r--r--mesonbuild/compilers/mixins/elbrus.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py
new file mode 100644
index 0000000..a254a8b
--- /dev/null
+++ b/mesonbuild/compilers/mixins/elbrus.py
@@ -0,0 +1,59 @@
+# Copyright 2019 The meson development team
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Abstractions for the Elbrus family of compilers."""
+
+import os
+
+from .gnu import GnuCompiler
+from ...mesonlib import Popen_safe
+
+
+class ElbrusCompiler(GnuCompiler):
+ # Elbrus compiler is nearly like GCC, but does not support
+ # PCH, LTO, sanitizers and color output as of version 1.21.x.
+ def __init__(self, compiler_type, defines):
+ GnuCompiler.__init__(self, compiler_type, defines)
+ self.id = 'lcc'
+ self.base_options = ['b_pgo', 'b_coverage',
+ 'b_ndebug', 'b_staticpic',
+ 'b_lundef', 'b_asneeded']
+
+ # FIXME: use _build_wrapper to call this so that linker flags from the env
+ # get applied
+ def get_library_dirs(self, env, elf_class = None):
+ os_env = os.environ.copy()
+ os_env['LC_ALL'] = 'C'
+ stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1]
+ paths = ()
+ for line in stdo.split('\n'):
+ if line.startswith('libraries:'):
+ # lcc does not include '=' in --print-search-dirs output.
+ libstr = line.split(' ', 1)[1]
+ paths = (os.path.realpath(p) for p in libstr.split(':'))
+ break
+ return paths
+
+ def get_program_dirs(self, env):
+ os_env = os.environ.copy()
+ os_env['LC_ALL'] = 'C'
+ stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1]
+ paths = ()
+ for line in stdo.split('\n'):
+ if line.startswith('programs:'):
+ # lcc does not include '=' in --print-search-dirs output.
+ libstr = line.split(' ', 1)[1]
+ paths = (os.path.realpath(p) for p in libstr.split(':'))
+ break
+ return paths \ No newline at end of file