зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1292046) for android build failures a=backout
Backed out changeset 3263785341f2 (bug 1292046) Backed out changeset a1b9e1631661 (bug 1292046)
This commit is contained in:
Родитель
9712b25c12
Коммит
e2fcb18843
|
@ -49,11 +49,34 @@ AC_DEFUN([MOZ_CROSS_COMPILER],
|
|||
[
|
||||
echo "cross compiling from $host to $target"
|
||||
|
||||
_SAVE_CC="$CC"
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
_SAVE_LDFLAGS="$LDFLAGS"
|
||||
|
||||
if test -z "$HOST_AR_FLAGS"; then
|
||||
HOST_AR_FLAGS="$AR_FLAGS"
|
||||
fi
|
||||
AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
|
||||
AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
|
||||
CC="$HOST_CC"
|
||||
CFLAGS="$HOST_CFLAGS"
|
||||
LDFLAGS="$HOST_LDFLAGS"
|
||||
|
||||
AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
|
||||
AC_TRY_COMPILE([], [return(0);],
|
||||
[ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
|
||||
AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
|
||||
|
||||
CC="$HOST_CXX"
|
||||
CFLAGS="$HOST_CXXFLAGS"
|
||||
AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
|
||||
AC_TRY_COMPILE([], [return(0);],
|
||||
[ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
|
||||
AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
|
||||
|
||||
CC=$_SAVE_CC
|
||||
CFLAGS=$_SAVE_CFLAGS
|
||||
LDFLAGS=$_SAVE_LDFLAGS
|
||||
|
||||
dnl AC_CHECK_PROGS manually goes through $PATH, and as such fails to handle
|
||||
dnl absolute or relative paths. Relative paths wouldn't work anyways, but
|
||||
|
|
|
@ -60,7 +60,7 @@ def checking(what, callback=None):
|
|||
log.info('no')
|
||||
else:
|
||||
log.info(display_ret)
|
||||
if error is not None:
|
||||
if error:
|
||||
die(error)
|
||||
return ret
|
||||
return wrapped
|
||||
|
|
|
@ -18,14 +18,47 @@
|
|||
# - `check_msg` is the message to be printed to accompany compiling the test
|
||||
# program.
|
||||
@template
|
||||
@imports('textwrap')
|
||||
def try_compile(includes=None, body='', language='C++', flags=None, check_msg=None):
|
||||
compiler = {
|
||||
'C': c_compiler,
|
||||
'C++': cxx_compiler,
|
||||
}[language]
|
||||
includes = includes or []
|
||||
source_lines = ['#include <%s>' % f for f in includes]
|
||||
source = '\n'.join(source_lines) + '\n'
|
||||
source += textwrap.dedent('''\
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
%s
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
''' % body)
|
||||
|
||||
return compiler.try_compile(includes, body, flags, check_msg)
|
||||
if check_msg:
|
||||
def checking_fn(fn):
|
||||
return checking(check_msg, callback=lambda r: r is not None)(fn)
|
||||
else:
|
||||
def checking_fn(fn):
|
||||
return fn
|
||||
|
||||
def get_flags():
|
||||
if flags:
|
||||
return flags[:]
|
||||
|
||||
@depends(cxx_compiler, c_compiler, extra_toolchain_flags)
|
||||
@checking_fn
|
||||
def check(cxx_info, c_info, extra_flags):
|
||||
flags = get_flags() or []
|
||||
flags += extra_flags
|
||||
flags.append('-c')
|
||||
|
||||
info = {
|
||||
'C': c_info,
|
||||
'C++': cxx_info,
|
||||
}[language]
|
||||
return try_invoke_compiler(info.wrapper + [info.compiler] + info.flags,
|
||||
language, source, flags,
|
||||
onerror=lambda: None)
|
||||
return check
|
||||
|
||||
# Checks for the presence of the given header on the target system by compiling
|
||||
# a test program including that header. The return value of the template is a
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
@template
|
||||
@imports('textwrap')
|
||||
@imports(_from='mozbuild.configure', _import='DependsFunction')
|
||||
def compiler_class(compiler):
|
||||
class Compiler(DependsFunction):
|
||||
# Generates a test program and attempts to compile it. In case of
|
||||
# failure, the resulting check will return None. If the test program
|
||||
# succeeds, it will return the output of the test program.
|
||||
# - `includes` are the includes (as file names) that will appear at the
|
||||
# top of the generated test program.
|
||||
# - `body` is the code that will appear in the main function of the
|
||||
# generated test program. `return 0;` is appended to the function
|
||||
# body automatically.
|
||||
# - `flags` are the flags to be passed to the compiler, in addition to
|
||||
# `-c`.
|
||||
# - `check_msg` is the message to be printed to accompany compiling the
|
||||
# test program.
|
||||
def try_compile(self, includes=None, body='', flags=None,
|
||||
check_msg=None, onerror=lambda: None):
|
||||
includes = includes or []
|
||||
source_lines = ['#include <%s>' % f for f in includes]
|
||||
source = '\n'.join(source_lines) + '\n'
|
||||
source += textwrap.dedent('''\
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
%s
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
''' % body)
|
||||
|
||||
if check_msg:
|
||||
def checking_fn(fn):
|
||||
return checking(check_msg,
|
||||
callback=lambda r: r is not None)(fn)
|
||||
else:
|
||||
def checking_fn(fn):
|
||||
return fn
|
||||
|
||||
def get_flags():
|
||||
if flags:
|
||||
return flags[:]
|
||||
|
||||
@depends(self, extra_toolchain_flags)
|
||||
@checking_fn
|
||||
def func(compiler, extra_flags):
|
||||
flags = get_flags() or []
|
||||
flags += extra_flags
|
||||
flags.append('-c')
|
||||
|
||||
return try_invoke_compiler(
|
||||
compiler.wrapper + [compiler.compiler] + compiler.flags,
|
||||
compiler.language, source, flags, onerror=onerror)
|
||||
|
||||
return func
|
||||
|
||||
compiler.__class__ = Compiler
|
||||
return compiler
|
|
@ -171,8 +171,6 @@ add_old_configure_assignment('TOOLCHAIN_PREFIX', toolchain_prefix)
|
|||
|
||||
# Compilers
|
||||
# ==============================================================
|
||||
include('compilers-util.configure')
|
||||
|
||||
def try_preprocess(compiler, language, source):
|
||||
return try_invoke_compiler(compiler, language, source, ['-E'])
|
||||
|
||||
|
@ -535,7 +533,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
|||
'C++': lambda: default_cxx_compilers(c_compiler),
|
||||
}[language]()
|
||||
|
||||
what='the %s %s compiler' % (host_or_target_str, language)
|
||||
what='the %s %s compiler' % (host_or_target_str, language),
|
||||
|
||||
option(env=var, nargs=1, help='Path to %s' % what)
|
||||
|
||||
|
@ -699,7 +697,6 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
|||
flags=flags,
|
||||
type=info.type,
|
||||
version=info.version,
|
||||
language=language,
|
||||
)
|
||||
|
||||
@depends(valid_compiler)
|
||||
|
@ -738,26 +735,6 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
|||
add_old_configure_assignment(
|
||||
'%s_VERSION' % var, delayed_getattr(valid_compiler, 'version'))
|
||||
|
||||
valid_compiler = compiler_class(valid_compiler)
|
||||
|
||||
kwargs = {
|
||||
'C': {
|
||||
'includes': ['stdio.h'],
|
||||
'body': 'printf("Hello World\\n");',
|
||||
},
|
||||
'C++': {
|
||||
'includes': ['new'],
|
||||
'body': 'unsigned *test = new unsigned(42);',
|
||||
},
|
||||
}[language]
|
||||
|
||||
def compiler_error():
|
||||
raise FatalCheckError('Failed compiling a simple %s source with %s'
|
||||
% (language, what))
|
||||
|
||||
valid_compiler.try_compile(check_msg='%s works' % what,
|
||||
onerror=compiler_error, **kwargs)
|
||||
|
||||
return valid_compiler
|
||||
|
||||
|
||||
|
|
|
@ -265,6 +265,17 @@ case "$target" in
|
|||
# Make sure compilers are valid
|
||||
CFLAGS="$CFLAGS -TC -nologo"
|
||||
CXXFLAGS="$CXXFLAGS -TP -nologo"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[ printf("Hello World\n"); ],,
|
||||
AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
|
||||
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([#include <new.h>],
|
||||
[ unsigned *test = new unsigned(42); ],,
|
||||
AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
|
||||
AC_LANG_RESTORE
|
||||
|
||||
changequote(,)
|
||||
_MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
|
||||
|
|
|
@ -44,40 +44,32 @@ class TestHeaderChecks(unittest.TestCase):
|
|||
expected_flags=expected_flags),
|
||||
}
|
||||
|
||||
base_dir = os.path.join(topsrcdir, 'build', 'moz.configure')
|
||||
|
||||
mock_compiler_defs = textwrap.dedent('''\
|
||||
@depends('--help')
|
||||
def extra_toolchain_flags(_):
|
||||
return []
|
||||
|
||||
include('%s/compilers-util.configure')
|
||||
|
||||
@compiler_class
|
||||
@depends('--help')
|
||||
def c_compiler(_):
|
||||
return namespace(
|
||||
flags=[],
|
||||
compiler=os.path.abspath('/usr/bin/mockcc'),
|
||||
wrapper=[],
|
||||
language='C',
|
||||
)
|
||||
|
||||
@compiler_class
|
||||
@depends('--help')
|
||||
def cxx_compiler(_):
|
||||
return namespace(
|
||||
flags=[],
|
||||
compiler=os.path.abspath('/usr/bin/mockcc'),
|
||||
wrapper=[],
|
||||
language='C++',
|
||||
)
|
||||
''' % base_dir)
|
||||
@depends('--help')
|
||||
def extra_toolchain_flags(_):
|
||||
return []
|
||||
''')
|
||||
|
||||
config = {}
|
||||
out = StringIO()
|
||||
sandbox = ConfigureTestSandbox(paths, config, {}, ['/bin/configure'],
|
||||
out, out)
|
||||
base_dir = os.path.join(topsrcdir, 'build', 'moz.configure')
|
||||
sandbox.include_file(os.path.join(base_dir, 'util.configure'))
|
||||
sandbox.include_file(os.path.join(base_dir, 'checks.configure'))
|
||||
exec_(mock_compiler_defs, sandbox)
|
||||
|
|
|
@ -311,35 +311,30 @@ class LinuxToolchainTest(BaseToolchainTest):
|
|||
version='4.9.3',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/gcc',
|
||||
language='C',
|
||||
)
|
||||
GXX_4_9_RESULT = CompilerResult(
|
||||
flags=['-std=gnu++11'],
|
||||
version='4.9.3',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/g++',
|
||||
language='C++',
|
||||
)
|
||||
GCC_5_RESULT = CompilerResult(
|
||||
flags=['-std=gnu99'],
|
||||
version='5.2.1',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/gcc-5',
|
||||
language='C',
|
||||
)
|
||||
GXX_5_RESULT = CompilerResult(
|
||||
flags=['-std=gnu++11'],
|
||||
version='5.2.1',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/g++-5',
|
||||
language='C++',
|
||||
)
|
||||
CLANG_3_3_RESULT = CompilerResult(
|
||||
flags=[],
|
||||
version='3.3.0',
|
||||
type='clang',
|
||||
compiler='/usr/bin/clang-3.3',
|
||||
language='C',
|
||||
)
|
||||
CLANGXX_3_3_RESULT = 'Only clang/llvm 3.6 or newer is supported.'
|
||||
CLANG_3_6_RESULT = CompilerResult(
|
||||
|
@ -347,14 +342,12 @@ class LinuxToolchainTest(BaseToolchainTest):
|
|||
version='3.6.2',
|
||||
type='clang',
|
||||
compiler='/usr/bin/clang',
|
||||
language='C',
|
||||
)
|
||||
CLANGXX_3_6_RESULT = CompilerResult(
|
||||
flags=['-std=gnu++11'],
|
||||
version='3.6.2',
|
||||
type='clang',
|
||||
compiler='/usr/bin/clang++',
|
||||
language='C++',
|
||||
)
|
||||
|
||||
def test_gcc(self):
|
||||
|
@ -760,14 +753,6 @@ class WindowsToolchainTest(BaseToolchainTest):
|
|||
version='19.00.23918',
|
||||
type='msvc',
|
||||
compiler='/usr/bin/cl',
|
||||
language='C',
|
||||
)
|
||||
VSXX_2015u2_RESULT = CompilerResult(
|
||||
flags=[],
|
||||
version='19.00.23918',
|
||||
type='msvc',
|
||||
compiler='/usr/bin/cl',
|
||||
language='C++',
|
||||
)
|
||||
CLANG_CL_3_9_RESULT = CompilerResult(
|
||||
flags=['-Xclang', '-std=gnu99',
|
||||
|
@ -775,14 +760,12 @@ class WindowsToolchainTest(BaseToolchainTest):
|
|||
version='18.00.30723',
|
||||
type='clang-cl',
|
||||
compiler='/usr/bin/clang-cl',
|
||||
language='C',
|
||||
)
|
||||
CLANGXX_CL_3_9_RESULT = CompilerResult(
|
||||
flags=['-fms-compatibility-version=18.00.30723', '-fallback'],
|
||||
version='18.00.30723',
|
||||
type='clang-cl',
|
||||
compiler='/usr/bin/clang-cl',
|
||||
language='C++',
|
||||
)
|
||||
CLANG_3_3_RESULT = LinuxToolchainTest.CLANG_3_3_RESULT
|
||||
CLANGXX_3_3_RESULT = LinuxToolchainTest.CLANGXX_3_3_RESULT
|
||||
|
@ -798,7 +781,7 @@ class WindowsToolchainTest(BaseToolchainTest):
|
|||
def test_msvc(self):
|
||||
self.do_toolchain_test(self.PATHS, {
|
||||
'c_compiler': self.VS_2015u2_RESULT,
|
||||
'cxx_compiler': self.VSXX_2015u2_RESULT,
|
||||
'cxx_compiler': self.VS_2015u2_RESULT,
|
||||
})
|
||||
|
||||
def test_unsupported_msvc(self):
|
||||
|
|
|
@ -348,7 +348,7 @@ class CompilerResult(ReadOnlyNamespace):
|
|||
'''
|
||||
|
||||
def __init__(self, wrapper=None, compiler='', version='', type='',
|
||||
language='', flags=None):
|
||||
flags=None):
|
||||
if flags is None:
|
||||
flags = []
|
||||
if wrapper is None:
|
||||
|
@ -359,7 +359,6 @@ class CompilerResult(ReadOnlyNamespace):
|
|||
type=type,
|
||||
compiler=mozpath.abspath(compiler),
|
||||
wrapper=wrapper,
|
||||
language=language,
|
||||
)
|
||||
|
||||
def __add__(self, other):
|
||||
|
@ -381,7 +380,6 @@ class TestCompilerResult(unittest.TestCase):
|
|||
'compiler': mozpath.abspath(''),
|
||||
'version': '',
|
||||
'type': '',
|
||||
'language': '',
|
||||
'flags': [],
|
||||
})
|
||||
|
||||
|
@ -389,7 +387,6 @@ class TestCompilerResult(unittest.TestCase):
|
|||
compiler='/usr/bin/gcc',
|
||||
version='4.2.1',
|
||||
type='gcc',
|
||||
language='C',
|
||||
flags=['-std=gnu99'],
|
||||
)
|
||||
self.assertEquals(result.__dict__, {
|
||||
|
@ -397,7 +394,6 @@ class TestCompilerResult(unittest.TestCase):
|
|||
'compiler': mozpath.abspath('/usr/bin/gcc'),
|
||||
'version': '4.2.1',
|
||||
'type': 'gcc',
|
||||
'language': 'C',
|
||||
'flags': ['-std=gnu99'],
|
||||
})
|
||||
|
||||
|
@ -407,7 +403,6 @@ class TestCompilerResult(unittest.TestCase):
|
|||
'compiler': mozpath.abspath('/usr/bin/gcc'),
|
||||
'version': '4.2.1',
|
||||
'type': 'gcc',
|
||||
'language': 'C',
|
||||
'flags': ['-std=gnu99', '-m32'],
|
||||
})
|
||||
# Original flags are untouched.
|
||||
|
@ -423,7 +418,6 @@ class TestCompilerResult(unittest.TestCase):
|
|||
'compiler': mozpath.abspath('/usr/bin/gcc-4.7'),
|
||||
'version': '4.7.3',
|
||||
'type': 'gcc',
|
||||
'language': 'C',
|
||||
'flags': ['-std=gnu99', '-m32'],
|
||||
})
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче