зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 6 changesets (bug 1319228) for Btup bustages on Linux x64 on a CLOSED TREE
Backed out changeset 2eedbab9137b (bug 1319228) Backed out changeset 6ba05238789f (bug 1319228) Backed out changeset badf116dde30 (bug 1319228) Backed out changeset a218f97e1b48 (bug 1319228) Backed out changeset d3c835477d11 (bug 1319228) Backed out changeset 3f3fa38b1a5f (bug 1319228)
This commit is contained in:
Родитель
b66176925a
Коммит
11cbcef059
|
@ -13,5 +13,4 @@ export TUP=${TOOLTOOL_DIR}/tup/tup
|
|||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
|
||||
ac_add_options --enable-build-backends=Tup
|
||||
ac_add_options --disable-js-shell
|
||||
ac_add_options --upload-tup-db
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
# 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/.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
cargo_extra_outputs = {
|
||||
'bindgen': [
|
||||
'tests.rs',
|
||||
'host-target.txt',
|
||||
],
|
||||
'cssparser': [
|
||||
'tokenizer.rs',
|
||||
],
|
||||
'gleam': [
|
||||
'gl_and_gles_bindings.rs',
|
||||
'gl_bindings.rs',
|
||||
'gles_bindings.rs',
|
||||
],
|
||||
'khronos_api': [
|
||||
'webgl_exts.rs',
|
||||
],
|
||||
'libloading': [
|
||||
'libglobal_static.a',
|
||||
'src/os/unix/global_static.o',
|
||||
],
|
||||
'selectors': [
|
||||
'ascii_case_insensitive_html_attributes.rs',
|
||||
],
|
||||
'style': [
|
||||
'gecko/atom_macro.rs',
|
||||
'gecko/pseudo_element_definition.rs',
|
||||
'gecko_properties.rs',
|
||||
'properties.rs',
|
||||
'gecko/bindings.rs',
|
||||
'gecko/structs.rs',
|
||||
],
|
||||
'webrender': [
|
||||
'shaders.rs',
|
||||
],
|
||||
}
|
||||
|
||||
cargo_extra_flags = {
|
||||
'style': [
|
||||
'-l', 'static=global_static',
|
||||
'-L', 'native=%(libloading_outdir)s',
|
||||
]
|
||||
}
|
|
@ -5,7 +5,6 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import os
|
||||
import itertools
|
||||
import json
|
||||
import sys
|
||||
import shutil
|
||||
|
@ -46,7 +45,6 @@ from ..frontend.data import (
|
|||
HostLibrary,
|
||||
HostProgram,
|
||||
HostSimpleProgram,
|
||||
RustLibrary,
|
||||
SharedLibrary,
|
||||
Sources,
|
||||
StaticLibrary,
|
||||
|
@ -61,10 +59,6 @@ from ..frontend.context import (
|
|||
ObjDirPath,
|
||||
RenamedSourcePath,
|
||||
)
|
||||
from .cargo_build_defs import (
|
||||
cargo_extra_outputs,
|
||||
cargo_extra_flags,
|
||||
)
|
||||
|
||||
|
||||
class BackendTupfile(object):
|
||||
|
@ -88,7 +82,6 @@ class BackendTupfile(object):
|
|||
self.sources = defaultdict(list)
|
||||
self.host_sources = defaultdict(list)
|
||||
self.variables = {}
|
||||
self.rust_library = None
|
||||
self.static_lib = None
|
||||
self.shared_lib = None
|
||||
self.programs = []
|
||||
|
@ -100,6 +93,8 @@ class BackendTupfile(object):
|
|||
# depends on them.
|
||||
self._skip_files = [
|
||||
'signmar',
|
||||
'libxul.so',
|
||||
'libtestcrasher.so',
|
||||
]
|
||||
|
||||
self.fh = FileAvoidWrite(self.name, capture_diff=True, dry_run=dry_run)
|
||||
|
@ -250,7 +245,6 @@ class TupBackend(CommonBackend):
|
|||
# will be built before any rules that list this as an input.
|
||||
self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
|
||||
self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
|
||||
self._rust_libs = '$(MOZ_OBJ_ROOT)/<rust-libs>'
|
||||
# The preprocessor including source-repo.h and buildid.h creates
|
||||
# dependencies that aren't specified by moz.build and cause errors
|
||||
# in Tup. Express these as a group dependency.
|
||||
|
@ -259,8 +253,6 @@ class TupBackend(CommonBackend):
|
|||
self._built_in_addons = set()
|
||||
self._built_in_addons_file = 'dist/bin/browser/chrome/browser/content/browser/built_in_addons.json'
|
||||
|
||||
self._shlibs = '$(MOZ_OBJ_ROOT)/<shlibs>'
|
||||
|
||||
def _get_mozconfig_env(self, config):
|
||||
env = {}
|
||||
loader = MozconfigLoader(config.topsrcdir)
|
||||
|
@ -325,9 +317,6 @@ class TupBackend(CommonBackend):
|
|||
def _gen_shared_library(self, backend_file):
|
||||
shlib = backend_file.shared_lib
|
||||
|
||||
if backend_file.objdir.endswith('gtest') and shlib.name == 'libxul.so':
|
||||
return
|
||||
|
||||
if shlib.cxx_link:
|
||||
mkshlib = (
|
||||
[backend_file.environment.substs['CXX']] +
|
||||
|
@ -353,17 +342,8 @@ class TupBackend(CommonBackend):
|
|||
list_file_name = '%s.list' % shlib.name.replace('.', '_')
|
||||
list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
|
||||
|
||||
rust_linked = self._lib_paths(backend_file.objdir,
|
||||
(l for l in backend_file.shared_lib.linked_libraries
|
||||
if isinstance(l, RustLibrary)))
|
||||
|
||||
inputs = objs + static_libs + shared_libs
|
||||
|
||||
extra_inputs = []
|
||||
if rust_linked:
|
||||
extra_inputs = [self._rust_libs]
|
||||
static_libs += rust_linked
|
||||
|
||||
symbols_file = []
|
||||
if shlib.symbols_file:
|
||||
inputs.append(shlib.symbols_file)
|
||||
|
@ -383,17 +363,14 @@ class TupBackend(CommonBackend):
|
|||
backend_file.rule(
|
||||
cmd=cmd,
|
||||
inputs=inputs,
|
||||
extra_inputs=extra_inputs,
|
||||
outputs=[shlib.lib_name],
|
||||
extra_outputs=[self._shlibs],
|
||||
display='LINK %o'
|
||||
)
|
||||
backend_file.symlink_rule(mozpath.join(backend_file.objdir,
|
||||
shlib.lib_name),
|
||||
output=mozpath.join(self.environment.topobjdir,
|
||||
shlib.install_target,
|
||||
shlib.lib_name),
|
||||
output_group=self._shlibs)
|
||||
shlib.lib_name))
|
||||
|
||||
def _gen_programs(self, backend_file):
|
||||
for p in backend_file.programs:
|
||||
|
@ -405,10 +382,7 @@ class TupBackend(CommonBackend):
|
|||
static_libs = self._lib_paths(backend_file.objdir, static_libs)
|
||||
shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
|
||||
|
||||
# Linking some programs will access libraries installed to dist/bin,
|
||||
# so depend on the installed libraries here. This can be made more
|
||||
# accurate once we start building libraries in their final locations.
|
||||
inputs = objs + static_libs + shared_libs + [self._shlibs]
|
||||
inputs = objs + static_libs + shared_libs
|
||||
|
||||
list_file_name = '%s.list' % prog.name.replace('.', '_')
|
||||
list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
|
||||
|
@ -572,8 +546,6 @@ class TupBackend(CommonBackend):
|
|||
backend_file.host_sources[obj.canonical_suffix].extend(obj.files)
|
||||
elif isinstance(obj, VariablePassthru):
|
||||
backend_file.variables = obj.variables
|
||||
elif isinstance(obj, RustLibrary):
|
||||
backend_file.rust_library = obj
|
||||
elif isinstance(obj, StaticLibrary):
|
||||
backend_file.static_lib = obj
|
||||
elif isinstance(obj, SharedLibrary):
|
||||
|
@ -611,8 +583,7 @@ class TupBackend(CommonBackend):
|
|||
self._gen_static_library),
|
||||
(backend_file.programs, self._gen_programs),
|
||||
(backend_file.host_programs, self._gen_host_programs),
|
||||
(backend_file.host_library, self._gen_host_library),
|
||||
(backend_file.rust_library, self._gen_rust)):
|
||||
(backend_file.host_library, self._gen_host_library)):
|
||||
if var:
|
||||
backend_file.export_shell()
|
||||
gen_method(backend_file)
|
||||
|
@ -650,176 +621,13 @@ class TupBackend(CommonBackend):
|
|||
tup = self.environment.substs.get('TUP', 'tup')
|
||||
self._cmd.run_process(cwd=self.environment.topsrcdir, log_name='tup', args=[tup, 'init'])
|
||||
|
||||
|
||||
def _get_cargo_flags(self, obj):
|
||||
cargo_flags = ['--build-plan', '-Z', 'unstable-options']
|
||||
if not self.environment.substs.get('MOZ_DEBUG_RUST'):
|
||||
cargo_flags += ['--release']
|
||||
cargo_flags += [
|
||||
'--frozen',
|
||||
'--manifest-path', mozpath.join(obj.srcdir, 'Cargo.toml'),
|
||||
'--lib',
|
||||
'--target=%s' % self.environment.substs['RUST_TARGET'],
|
||||
]
|
||||
if obj.features:
|
||||
cargo_flags += [
|
||||
'--features', ' '.join(obj.features)
|
||||
]
|
||||
return cargo_flags
|
||||
|
||||
def _get_cargo_env(self, backend_file):
|
||||
lib = backend_file.rust_library
|
||||
env = {
|
||||
'CARGO_TARGET_DIR': mozpath.normpath(mozpath.join(lib.objdir,
|
||||
lib.target_dir)),
|
||||
'RUSTC': self.environment.substs['RUSTC'],
|
||||
'MOZ_SRC': self.environment.topsrcdir,
|
||||
'MOZ_DIST': self.environment.substs['DIST'],
|
||||
'LIBCLANG_PATH': self.environment.substs['MOZ_LIBCLANG_PATH'],
|
||||
'CLANG_PATH': self.environment.substs['MOZ_CLANG_PATH'],
|
||||
'PKG_CONFIG_ALLOW_CROSS': '1',
|
||||
'RUST_BACKTRACE': 'full',
|
||||
'MOZ_TOPOBJDIR': self.environment.topobjdir,
|
||||
'PYTHON': self.environment.substs['PYTHON'],
|
||||
'PYTHONDONTWRITEBYTECODE': '1',
|
||||
}
|
||||
cargo_incremental = self.environment.substs.get('CARGO_INCREMENTAL')
|
||||
if cargo_incremental is not None:
|
||||
# TODO (bug 1468527): CARGO_INCREMENTAL produces outputs that Tup
|
||||
# doesn't know about, disable it unconditionally for now.
|
||||
pass # env['CARGO_INCREMENTAL'] = cargo_incremental
|
||||
|
||||
rust_simd = self.environment.substs.get('MOZ_RUST_SIMD')
|
||||
if rust_simd is not None:
|
||||
env['RUSTC_BOOTSTRAP'] = '1'
|
||||
|
||||
linker_env_var = ('CARGO_TARGET_%s_LINKER' %
|
||||
self.environment.substs['RUST_TARGET_ENV_NAME'])
|
||||
|
||||
env.update({
|
||||
'MOZ_CARGO_WRAP_LDFLAGS': ' '.join(backend_file.local_flags['LDFLAGS']),
|
||||
'MOZ_CARGO_WRAP_LD': backend_file.environment.substs['CC'],
|
||||
linker_env_var: mozpath.join(self.environment.topsrcdir,
|
||||
'build', 'cargo-linker'),
|
||||
'RUSTFLAGS': '%s %s' % (' '.join(self.environment.substs['MOZ_RUST_DEFAULT_FLAGS']),
|
||||
' '.join(self.environment.substs['RUSTFLAGS'])),
|
||||
})
|
||||
return env
|
||||
|
||||
def _gen_cargo_rules(self, backend_file, build_plan, cargo_env):
|
||||
invocations = build_plan['invocations']
|
||||
processed = set()
|
||||
|
||||
def get_libloading_outdir():
|
||||
for invocation in invocations:
|
||||
if (invocation['package_name'] == 'libloading' and
|
||||
invocation['outputs'][0].endswith('.rlib')):
|
||||
return invocation['env']['OUT_DIR']
|
||||
|
||||
def display_name(invocation):
|
||||
output_str = ''
|
||||
if invocation['outputs']:
|
||||
output_str = ' -> %s' % ' '.join([os.path.basename(f)
|
||||
for f in invocation['outputs']])
|
||||
return '{name} v{version} {kind}{output}'.format(
|
||||
name=invocation['package_name'],
|
||||
version=invocation['package_version'],
|
||||
kind=invocation['kind'],
|
||||
output=output_str
|
||||
)
|
||||
|
||||
def cargo_quote(s):
|
||||
return shell_quote(s.replace('\n', '\\n'))
|
||||
|
||||
def _process(key, invocation):
|
||||
if key in processed:
|
||||
return
|
||||
processed.add(key)
|
||||
inputs = set()
|
||||
shortname = invocation['package_name']
|
||||
for dep in invocation['deps']:
|
||||
# We'd expect to just handle dependencies transitively (so use
|
||||
# invocations[dep]['outputs'] here, but because the weird host dependencies
|
||||
# sometimes get used in the final library and not intermediate
|
||||
# libraries, tup doesn't work well with them. So build up the full set
|
||||
# of intermediate dependencies with 'full-deps'
|
||||
depmod = invocations[dep]
|
||||
_process(dep, depmod)
|
||||
inputs.update(depmod['full-deps'])
|
||||
|
||||
command = [
|
||||
'cd %s &&' % invocation['cwd'],
|
||||
'env',
|
||||
]
|
||||
envvars = invocation.get('env')
|
||||
for k, v in itertools.chain(cargo_env.iteritems(),
|
||||
envvars.iteritems()):
|
||||
command.append("%s=%s" % (k, cargo_quote(v)))
|
||||
command.append(invocation['program'])
|
||||
command.extend(cargo_quote(a.replace('dep-info,', ''))
|
||||
for a in invocation['args'])
|
||||
outputs = invocation['outputs']
|
||||
if os.path.basename(invocation['program']) == 'build-script-build':
|
||||
for output in cargo_extra_outputs.get(shortname, []):
|
||||
outputs.append(os.path.join(invocation['env']['OUT_DIR'], output))
|
||||
|
||||
if (invocation['target_kind'][0] == 'custom-build' and
|
||||
os.path.basename(invocation['program']) == 'rustc'):
|
||||
flags = cargo_extra_flags.get(shortname, [])
|
||||
for flag in flags:
|
||||
command.append(flag % {'libloading_outdir': get_libloading_outdir()})
|
||||
|
||||
if 'rustc' in invocation['program']:
|
||||
header = 'RUSTC'
|
||||
else:
|
||||
inputs.add(invocation['program'])
|
||||
header = 'RUN'
|
||||
|
||||
invocation['full-deps'] = set(inputs)
|
||||
invocation['full-deps'].update(invocation['outputs'])
|
||||
|
||||
backend_file.rule(
|
||||
command,
|
||||
inputs=sorted(inputs),
|
||||
outputs=outputs,
|
||||
extra_outputs=[self._rust_libs],
|
||||
extra_inputs=[self._installed_files],
|
||||
display='%s %s' % (header, display_name(invocation)),
|
||||
)
|
||||
|
||||
for dst, link in invocation['links'].iteritems():
|
||||
backend_file.symlink_rule(link, dst, self._rust_libs)
|
||||
|
||||
for val in enumerate(invocations):
|
||||
_process(*val)
|
||||
|
||||
|
||||
def _gen_rust(self, backend_file):
|
||||
# TODO (bug 1468547): The gtest rust library depends on many of the same
|
||||
# libraries as the main rust library, so we'll need to handle these all
|
||||
# at once in order to build the gtest rust library.
|
||||
if 'toolkit/library/gtest' in backend_file.objdir:
|
||||
return
|
||||
|
||||
cargo_flags = self._get_cargo_flags(backend_file.rust_library)
|
||||
cargo_env = self._get_cargo_env(backend_file)
|
||||
|
||||
output_lines = []
|
||||
def accumulate_output(line):
|
||||
output_lines.append(line)
|
||||
|
||||
cargo_status = self._cmd.run_process(
|
||||
[self.environment.substs['CARGO'], 'build'] + cargo_flags,
|
||||
line_handler=accumulate_output,
|
||||
explicit_env=cargo_env)
|
||||
|
||||
cargo_plan = json.loads(''.join(output_lines))
|
||||
self._gen_cargo_rules(backend_file, cargo_plan, cargo_env)
|
||||
self.backend_input_files |= set(cargo_plan['inputs'])
|
||||
|
||||
|
||||
def _process_generated_file(self, backend_file, obj):
|
||||
if obj.script and obj.method:
|
||||
# TODO: These are directories that don't work in the tup backend
|
||||
# yet, because things they depend on aren't built yet.
|
||||
skip_directories = (
|
||||
'toolkit/library', # libxul.so
|
||||
)
|
||||
if obj.script and obj.method and obj.relobjdir not in skip_directories:
|
||||
backend_file.export_shell()
|
||||
cmd = self._py_action('file_generate')
|
||||
if obj.localized:
|
||||
|
@ -854,11 +662,6 @@ class TupBackend(CommonBackend):
|
|||
extra_outputs = [self._installed_files] if obj.required_for_compile else []
|
||||
full_inputs += [self._early_generated_files]
|
||||
|
||||
extra_inputs = []
|
||||
if any(f in obj.outputs for f in ('dependentlibs.list',
|
||||
'dependendentlibs.list.gtest')):
|
||||
extra_inputs += [self._shlibs]
|
||||
|
||||
if len(outputs) > 3:
|
||||
display_outputs = ', '.join(outputs[0:3]) + ', ...'
|
||||
else:
|
||||
|
@ -872,7 +675,6 @@ class TupBackend(CommonBackend):
|
|||
display=display,
|
||||
cmd=cmd,
|
||||
inputs=full_inputs,
|
||||
extra_inputs=extra_inputs,
|
||||
outputs=outputs,
|
||||
extra_outputs=extra_outputs,
|
||||
check_unchanged=True,
|
||||
|
@ -960,14 +762,18 @@ class TupBackend(CommonBackend):
|
|||
# so do not attempt to install it.
|
||||
continue
|
||||
|
||||
output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
|
||||
f.target_basename)
|
||||
gen_backend_file = self._get_backend_file(f.context.relobjdir)
|
||||
if gen_backend_file.requires_delay([f]):
|
||||
gen_backend_file.delayed_installed_files.append((f.full_path, output, output_group))
|
||||
else:
|
||||
gen_backend_file.symlink_rule(f.full_path, output=output,
|
||||
output_group=output_group)
|
||||
# We're not generating files in these directories yet, so
|
||||
# don't attempt to install files generated from them.
|
||||
if f.context.relobjdir not in ('toolkit/library',
|
||||
'js/src/shell'):
|
||||
output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
|
||||
f.target_basename)
|
||||
gen_backend_file = self._get_backend_file(f.context.relobjdir)
|
||||
if gen_backend_file.requires_delay([f]):
|
||||
gen_backend_file.delayed_installed_files.append((f.full_path, output, output_group))
|
||||
else:
|
||||
gen_backend_file.symlink_rule(f.full_path, output=output,
|
||||
output_group=output_group)
|
||||
|
||||
|
||||
def _process_final_target_pp_files(self, obj, backend_file):
|
||||
|
|
|
@ -1029,7 +1029,7 @@ class BuildDriver(MozbuildObject):
|
|||
print('Build configuration changed. Regenerating backend.')
|
||||
args = [config.substs['PYTHON'],
|
||||
mozpath.join(self.topobjdir, 'config.status')]
|
||||
self.run_process(args, cwd=self.topobjdir, pass_thru=True)
|
||||
self.run_process(args, cwd=self.topobjdir)
|
||||
backend_cls = get_backend_class(active_backend)(config)
|
||||
return backend_cls.build(self, output, jobs, verbose, what)
|
||||
return None
|
||||
|
|
|
@ -862,7 +862,7 @@ linux64-tup/opt:
|
|||
toolchains:
|
||||
- linux64-clang
|
||||
- linux64-gcc
|
||||
- linux64-rust-nightly
|
||||
- linux64-rust
|
||||
- linux64-sccache
|
||||
- linux64-tup
|
||||
|
||||
|
|
|
@ -415,29 +415,6 @@ linux64-rust-1.24:
|
|||
toolchain-alias: linux64-rust
|
||||
toolchain-artifact: public/build/rustc.tar.xz
|
||||
|
||||
linux64-rust-nightly:
|
||||
description: "rust nightly repack"
|
||||
treeherder:
|
||||
kind: build
|
||||
platform: toolchains/opt
|
||||
symbol: TL(rust-nightly)
|
||||
tier: 1
|
||||
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
|
||||
worker:
|
||||
max-run-time: 7200
|
||||
env:
|
||||
UPLOAD_DIR: artifacts
|
||||
run:
|
||||
using: toolchain-script
|
||||
script: repack_rust.py
|
||||
arguments: [
|
||||
'--channel', 'nightly-2018-05-21',
|
||||
'--host', 'x86_64-unknown-linux-gnu',
|
||||
'--target', 'x86_64-unknown-linux-gnu',
|
||||
'--target', 'i686-unknown-linux-gnu',
|
||||
]
|
||||
toolchain-artifact: public/build/rustc.tar.xz
|
||||
|
||||
linux64-rust-macos-1.24:
|
||||
description: "rust repack with macos-cross support"
|
||||
treeherder:
|
||||
|
|
|
@ -128,8 +128,7 @@ def gen_list(output, lib):
|
|||
func = dependentlibs_dumpbin
|
||||
|
||||
deps = dependentlibs(lib, libpaths, func)
|
||||
base_lib = mozpath.basename(lib)
|
||||
deps[base_lib] = mozpath.join(libpaths[0], base_lib)
|
||||
deps[lib] = mozpath.join(libpaths[0], lib)
|
||||
output.write('\n'.join(deps.keys()) + '\n')
|
||||
|
||||
with open(output.name + ".gtest", 'w') as gtest_out:
|
||||
|
|
Загрузка…
Ссылка в новой задаче