skia2/infra/bots/recipe_modules/build/chromecast.py
Mike Klein 963a606677 roll cast toolchain
- clang 3.9 -> clang "9"  (pre-release)
  - libstdc++ -> libc++     (pretty sure)

PS1 should fail to build... need to update
infra/bots/recipe_modules/build/chromecast.py too.

PS2 compiles but fails to link.

PS3 puts -Lchromebook_arm_gles/lib on the link line;
unclear to me how we're linking today...

PS4 removed a workaround for the older toolchain.

PS5+ tries to request the older glibc math symbols
that shipped with the devices we test on... we don't
seem to have glibc 2.27 there.

Cq-Include-Trybots: skia.primary:Test-Chromecast-Clang-Chorizo-CPU-Cortex_A7-arm-Debug-All,Perf-Chromecast-Clang-Chorizo-GPU-Cortex_A7-arm-Release-All,Test-Chromecast-Clang-Chorizo-GPU-Cortex_A7-arm-Release-All
Change-Id: I7a1ac2da646fb5b0cbdeb44310f1c0747013f3f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234956
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-08-15 20:02:18 +00:00

82 lines
2.8 KiB
Python

# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def compile_fn(api, checkout_root, out_dir):
skia_dir = checkout_root.join('skia')
configuration = api.vars.builder_cfg.get('configuration')
target_arch = api.vars.builder_cfg.get('target_arch')
# TODO(kjlubick): can this toolchain be replaced/shared with chromebook?
toolchain_dir = api.vars.slave_dir.join('cast_toolchain', 'armv7a')
gles_dir = api.vars.slave_dir.join('chromebook_arm_gles')
target = ['-target', 'armv7a-cros-linux-gnueabihf']
sysroot = ['--sysroot',
'%s/usr/armv7a-cros-linux-gnueabihf' % toolchain_dir]
extra_asmflags = target
extra_cflags = target + sysroot + [
'-I%s' % gles_dir.join('include'),
'-DMESA_EGL_NO_X11_HEADERS',
"-DSK_NO_COMMAND_BUFFER",
# Avoid unused warning with yyunput
'-Wno-error=unused-function',
# Makes the binary small enough to fit on the small disk.
'-g0',
('-DDUMMY_cast_toolchain_version=%s' %
api.run.asset_version('cast_toolchain', skia_dir)),
# Force older math.h function versions that shipped on the Chorizo.
'-include', '%s' % skia_dir.join('tools', 'force_older_glibc_math.h'),
]
extra_ldflags = target + sysroot + [
# Chromecast does not package libc++.
'-static-libstdc++', '-static-libgcc',
'-L%s' % toolchain_dir.join('lib'),
'-L%s' % gles_dir.join('lib'),
'-fuse-ld=gold',
'-B%s/usr/libexec/gcc' % toolchain_dir,
]
quote = lambda x: '"%s"' % x
args = {
'cc': quote(toolchain_dir.join('usr', 'bin', 'clang-9.elf')),
'cxx': quote(toolchain_dir.join('usr', 'bin', 'clang++-9.elf')),
'ar': quote(toolchain_dir.join('bin','armv7a-cros-linux-gnueabihf-ar')),
'target_cpu': quote(target_arch),
'skia_use_fontconfig': 'false',
'skia_enable_gpu': 'true',
# The toolchain won't allow system libraries to be used
# when cross-compiling
'skia_use_system_freetype2': 'false',
# Makes the binary smaller
'skia_use_icu': 'false',
'skia_use_egl': 'true',
'werror': 'true',
}
if configuration != 'Debug':
args['is_debug'] = 'false'
args['extra_asmflags'] = repr(extra_asmflags).replace("'", '"')
args['extra_cflags'] = repr(extra_cflags).replace("'", '"')
args['extra_ldflags'] = repr(extra_ldflags).replace("'", '"')
gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems()))
gn = skia_dir.join('bin', 'gn')
with api.context(cwd=skia_dir):
api.run(api.python, 'fetch-gn',
script=skia_dir.join('bin', 'fetch-gn'),
infra_step=True)
api.run(api.step, 'gn gen', cmd=[gn, 'gen', out_dir, '--args=' + gn_args])
api.run(api.step, 'ninja',
cmd=['ninja', '-C', out_dir, 'nanobench', 'dm'])
def copy_extra_build_products(api, src, dst):
pass