diff options
author | Kevin Lubick <kjlubick@google.com> | 2017-03-08 14:01:01 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-08 19:41:14 +0000 |
commit | dcd2a908f424f080170a7d415ea0280d186e5d7f (patch) | |
tree | 9f95e9b2f8733ec0247479ef46fdc1763d80106d /infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py | |
parent | 30115680aef0323ae8aac6ceab0da937c2934779 (diff) |
Add jobs for building for Chromecast
BUG=skia:6345
Change-Id: Iaf09eb7f57ae71687c6804221837a8cc8ef04931
Reviewed-on: https://skia-review.googlesource.com/9419
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py')
-rw-r--r-- | infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py new file mode 100644 index 0000000000..e8e516d818 --- /dev/null +++ b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py @@ -0,0 +1,59 @@ +# Copyright 2016 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. + +from recipe_engine import recipe_api + +import default_flavor +import gn_android_flavor +import subprocess + + +"""GN Chromecast flavor utils, used for building Skia for Chromecast with GN""" +class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils): + def __init__(self, m): + super(GNChromecastFlavorUtils, self).__init__(m) + + def compile(self, unused_target, **kwargs): + configuration = self.m.vars.builder_cfg.get('configuration') + os = self.m.vars.builder_cfg.get('os') + target_arch = self.m.vars.builder_cfg.get('target_arch') + + # Makes the binary small enough to fit on the small disk. + extra_cflags = ['-g0'] + # Chromecast does not package libstdc++ + extra_ldflags = ['-static-libstdc++', '-static-libgcc'] + + toolchain_dir = self.m.vars.slave_dir.join('cast_toolchain') + + quote = lambda x: '"%s"' % x + args = { + 'cc': quote(toolchain_dir.join('bin','armv7a-cros-linux-gnueabi-gcc')), + 'cxx': quote(toolchain_dir.join('bin','armv7a-cros-linux-gnueabi-g++')), + 'ar': quote(toolchain_dir.join('bin','armv7a-cros-linux-gnueabi-ar')), + 'target_cpu': quote(target_arch), + 'skia_use_fontconfig': 'false', + 'skia_enable_gpu': 'false', + # 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', + } + + if configuration != 'Debug': + args['is_debug'] = 'false' + 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 = 'gn.exe' if 'Win' in os else 'gn' + ninja = 'ninja.exe' if 'Win' in os else 'ninja' + gn = self.m.vars.skia_dir.join('bin', gn) + + self._py('fetch-gn', self.m.vars.skia_dir.join('bin', 'fetch-gn')) + self._run('gn gen', gn, 'gen', self.out_dir, '--args=' + gn_args) + # We only build perf for the chromecasts. + self._run('ninja', ninja, '-C', self.out_dir, 'nanobench') + |