aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/ninjabackend.py8
-rw-r--r--mesonbuild/build.py5
-rw-r--r--mesonbuild/compilers/__init__.py3
-rw-r--r--mesonbuild/compilers/c.py57
-rw-r--r--mesonbuild/compilers/compilers.py51
-rw-r--r--mesonbuild/environment.py13
-rw-r--r--mesonbuild/linkers.py13
-rw-r--r--mesonbuild/wrap/wrap.py8
8 files changed, 147 insertions, 11 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 660b1a5..1824e91 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1485,7 +1485,7 @@ int dummy;
# gcc-ar blindly pass the --plugin argument to `ar` and you cannot pass
# options as arguments while using the @file.rsp syntax.
# See: https://github.com/mesonbuild/meson/issues/1646
- if mesonlib.is_windows() and not isinstance(static_linker, ArLinker):
+ if static_linker.can_linker_accept_rsp():
command_template = ''' command = {executable} @$out.rsp
rspfile = $out.rsp
rspfile_content = $LINK_ARGS {output_args} $in
@@ -1540,7 +1540,7 @@ int dummy;
except KeyError:
pass
rule = 'rule %s%s_LINKER\n' % (langname, crstr)
- if mesonlib.is_windows():
+ if compiler.can_linker_accept_rsp():
command_template = ''' command = {executable} @$out.rsp
rspfile = $out.rsp
rspfile_content = $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing
@@ -1669,7 +1669,7 @@ rule FORTRAN_DEP_HACK
if getattr(self, 'created_llvm_ir_rule', False):
return
rule = 'rule llvm_ir{}_COMPILER\n'.format('_CROSS' if is_cross else '')
- if mesonlib.is_windows():
+ if compiler.can_linker_accept_rsp():
command_template = ' command = {executable} @$out.rsp\n' \
' rspfile = $out.rsp\n' \
' rspfile_content = {cross_args} $ARGS {output_args} {compile_only_args} $in\n'
@@ -1730,7 +1730,7 @@ rule FORTRAN_DEP_HACK
d = quote_func(d)
quoted_depargs.append(d)
cross_args = self.get_cross_info_lang_args(langname, is_cross)
- if mesonlib.is_windows():
+ if compiler.can_linker_accept_rsp():
command_template = ''' command = {executable} @$out.rsp
rspfile = $out.rsp
rspfile_content = {cross_args} $ARGS {dep_args} {output_args} {compile_only_args} $in
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 9eb74e9..ea2edc3 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1178,7 +1178,10 @@ class Executable(BuildTarget):
for_cygwin(is_cross, environment) or 'cs' in self.compilers):
self.suffix = 'exe'
else:
- self.suffix = ''
+ if 'c' in self.compilers and self.compilers['c'].get_id().startswith('arm'):
+ self.suffix = 'axf'
+ else:
+ self.suffix = ''
self.filename = self.name
if self.suffix:
self.filename += '.' + self.suffix
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py
index 84c87fb..a0ec469 100644
--- a/mesonbuild/compilers/__init__.py
+++ b/mesonbuild/compilers/__init__.py
@@ -41,6 +41,8 @@ __all__ = [
'sanitizer_compile_args',
'sort_clike',
+ 'ARMCompiler',
+ 'ARMCCompiler',
'CCompiler',
'ClangCCompiler',
'ClangCompiler',
@@ -115,6 +117,7 @@ from .compilers import (
IntelCompiler,
)
from .c import (
+ ARMCCompiler,
CCompiler,
ClangCCompiler,
GnuCCompiler,
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 1c9b9b4..cc1a48e 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -31,6 +31,7 @@ from .compilers import (
msvc_winlibs,
vs32_instruction_set_args,
vs64_instruction_set_args,
+ ARMCompiler,
ClangCompiler,
Compiler,
CompilerArgs,
@@ -888,6 +889,62 @@ class GnuCCompiler(GnuCompiler, CCompiler):
return ['-fpch-preprocess', '-include', os.path.basename(header)]
+class ARMCCompiler(ARMCompiler, CCompiler):
+ def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None, **kwargs):
+ CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs)
+ ARMCompiler.__init__(self, defines)
+
+ def sanity_check_impl(self, work_dir, environment, sname, code):
+ mlog.debug('Sanity testing disabled for armcc compiler')
+ return
+
+ def get_options(self):
+ opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
+ ['none', 'c89', 'c99', 'c11'],
+ 'none')}
+ return opts
+
+ def get_warn_args(self, level):
+ # ARMCC doesn't have warning levels
+ return []
+
+ def get_coverage_args(self):
+ return []
+
+ def get_coverage_link_args(self):
+ return []
+
+ # Override CCompiler.get_always_args
+ def get_always_args(self):
+ return []
+
+ def get_option_compile_args(self, options):
+ return []
+
+ def get_linker_exelist(self):
+ args = ['armlink']
+ return args
+
+ # Override CCompiler.get_dependency_gen_args
+ def get_dependency_gen_args(self, outtarget, outfile):
+ return []
+
+ # Override CCompiler.get_std_shared_lib_link_args
+ def get_std_shared_lib_link_args(self):
+ return []
+
+ def get_pch_use_args(self, pch_dir, header):
+ # FIXME: Add required arguments
+ # NOTE from armcc user guide:
+ # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05
+ # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported
+ # PCH files."
+ return []
+
+ def get_compile_only_args(self):
+ return ['-c']
+
+
class IntelCCompiler(IntelCompiler, CCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs)
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 034fef4..cdc6f87 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -112,6 +112,12 @@ gnulike_buildtype_args = {'plain': [],
'debugoptimized': ['-O2', '-g'],
'release': ['-O3'],
'minsize': ['-Os', '-g']}
+arm_buildtype_args = {'plain': [],
+ 'debug': ['-O0', '-g'],
+ 'debugoptimized': ['-O2', '-g'],
+ 'release': ['-O2'],
+ 'minsize': ['-Os', '-g'],
+ }
msvc_buildtype_args = {'plain': [],
'debug': ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"],
@@ -133,6 +139,12 @@ gnulike_buildtype_linker_args = {'plain': [],
'release': ['-Wl,-O1'],
'minsize': [],
}
+arm_buildtype_linker_args = {'plain': [],
+ 'debug': [],
+ 'debugoptimized': [],
+ 'release': [],
+ 'minsize': [],
+ }
msvc_buildtype_linker_args = {'plain': [],
'debug': [],
@@ -657,6 +669,12 @@ class Compiler:
def get_always_args(self):
return []
+ def can_linker_accept_rsp(self):
+ """
+ Determines whether the linker can accept arguments using the @rsp syntax.
+ """
+ return mesonlib.is_windows()
+
def get_linker_always_args(self):
return []
@@ -1075,6 +1093,39 @@ class GnuCompiler:
def get_default_include_dirs(self):
return gnulike_default_include_dirs(self.exelist, self.language)
+class ARMCompiler:
+ # Functionality that is common to all ARM family compilers.
+ def __init__(self, defines):
+ self.id = 'arm'
+ self.defines = defines or {}
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage',
+ 'b_colorout', 'b_ndebug', 'b_staticpic']
+ # Assembly
+ self.can_compile_suffixes.add('s')
+
+ def can_linker_accept_rsp(self):
+ return False
+
+ def get_pic_args(self):
+ # FIXME: Add /ropi, /rwpi, /fpic etc. qualifiers to --apcs
+ return []
+
+ def get_buildtype_args(self, buildtype):
+ return arm_buildtype_args[buildtype]
+
+ def get_buildtype_linker_args(self, buildtype):
+ return arm_buildtype_linker_args[buildtype]
+
+ def get_pch_suffix(self):
+ # NOTE from armcc user guide:
+ # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05
+ # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported
+ # PCH files."
+ return 'pch'
+
+ def split_shlib_to_parts(self, fname):
+ return os.path.split(fname)[0], fname
+
class ClangCompiler:
def __init__(self, clang_type):
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 31ca2a2..1d3ba72 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -38,6 +38,7 @@ from .compilers import (
is_source,
)
from .compilers import (
+ ARMCCompiler,
ClangCCompiler,
ClangCPPCompiler,
ClangObjCCompiler,
@@ -492,7 +493,10 @@ class Environment:
continue
arg = '/?'
else:
- arg = '--version'
+ if re.search('.*arm.*', compiler[0]):
+ arg = '--vsn'
+ else:
+ arg = '--version'
try:
p, out, err = Popen_safe(compiler + [arg])
except OSError as e:
@@ -537,6 +541,8 @@ class Environment:
inteltype = ICC_STANDARD
cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version)
+ if 'ARM' in out:
+ return ARMCCompiler(ccache + compiler, version, is_cross, exe_wrap, full_version=full_version)
self._handle_exceptions(popen_exceptions, compilers)
def detect_c_compiler(self, want_cross):
@@ -791,7 +797,10 @@ class Environment:
if 'lib' in linker or 'lib.exe' in linker:
arg = '/?'
else:
- arg = '--version'
+ if re.search('.*arm.*', linker[0]):
+ arg = '--vsn'
+ else:
+ arg = '--version'
try:
p, out, err = Popen_safe(linker + [arg])
except OSError as e:
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index 2333e27..8e491d9 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -13,9 +13,14 @@
# limitations under the License.
from .mesonlib import Popen_safe
+from . import mesonlib
class StaticLinker:
- pass
+ def can_linker_accept_rsp(self):
+ """
+ Determines whether the linker can accept arguments using the @rsp syntax.
+ """
+ return mesonlib.is_windows()
class VisualStudioLinker(StaticLinker):
@@ -75,6 +80,12 @@ class ArLinker(StaticLinker):
self.std_args = ['csrD']
else:
self.std_args = ['csr']
+ # For 'armar' the options should be prefixed with '-'.
+ if 'armar' in stdo:
+ self.std_args = ['-csr']
+
+ def can_linker_accept_rsp(self):
+ return False
def build_rpath_args(self, build_dir, from_dir, rpath_paths, build_rpath, install_rpath):
return []
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 54a928e..a3f8ab1 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -203,15 +203,17 @@ class Resolver:
subprocess.call(['git', 'pull'], cwd=checkoutdir)
else:
if subprocess.call(['git', 'checkout', revno], cwd=checkoutdir) != 0:
- subprocess.check_call(['git', 'fetch'], cwd=checkoutdir)
+ subprocess.check_call(['git', 'fetch', p.get('url'), revno], cwd=checkoutdir)
subprocess.check_call(['git', 'checkout', revno],
cwd=checkoutdir)
else:
subprocess.check_call(['git', 'clone', p.get('url'),
p.get('directory')], cwd=self.subdir_root)
if revno.lower() != 'head':
- subprocess.check_call(['git', 'checkout', revno],
- cwd=checkoutdir)
+ if subprocess.call(['git', 'checkout', revno], cwd=checkoutdir) != 0:
+ subprocess.check_call(['git', 'fetch', p.get('url'), revno], cwd=checkoutdir)
+ subprocess.check_call(['git', 'checkout', revno],
+ cwd=checkoutdir)
push_url = p.values.get('push-url')
if push_url:
subprocess.check_call(['git', 'remote', 'set-url',