diff options
author | 2017-04-05 07:32:45 -0400 | |
---|---|---|
committer | 2017-04-05 11:39:04 +0000 | |
commit | 261ea19c4d5aa90e6de3af7b06bb14d634641af0 (patch) | |
tree | c56cd5e86733d3cfa3d60264eba1650707283076 /infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py | |
parent | 8653e973893bcaf0b09325d8e0a81b4b20d47aa3 (diff) |
Add recipe to build for Asus Flip Chromebook
This build includes the GPU-specific code (EGL, GLES)
The armhf_sysroot should be generic enough to support
other ARM targets, like the Raspberry Pi.
I split out the EGL dependencies into their own CIPD package
(chromebook_c100p_lib) to facilitate the modularity of the approach.
When we add another ARM chromebook, maybe one that has different libraries,
we should be able to re-use armhf_sysroot and then a newly created CIPD asset for
that specific GPU (if needed).
Maybe this also can be used to build for the chromecasts (thus the TODO)
Bug: skia:
NOTRY=true
Change-Id: Icc131025932dc8d41da5be39f3c5cad0aa95d848
Reviewed-on: https://skia-review.googlesource.com/11064
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py')
-rw-r--r-- | infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py b/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py new file mode 100644 index 0000000000..70b138d239 --- /dev/null +++ b/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py @@ -0,0 +1,96 @@ +# 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 gn_flavor +import subprocess + + +""" + GN Chromebook flavor utils, used for building and testing Skia for ARM + Chromebooks with GN +""" +class GNChromebookFlavorUtils(gn_flavor.GNFlavorUtils): + + def compile(self, unused_target): + 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') + extra_config = self.m.vars.builder_cfg.get('extra_config', '') + + clang_linux = self.m.vars.slave_dir.join('clang_linux') + # This is a pretty typical arm-linux-gnueabihf sysroot + sysroot_dir = self.m.vars.slave_dir.join('armhf_sysroot') + # This is the extra things needed to link against for the chromebook. + # For example, the Mali GL drivers. + if extra_config == 'Chromebook_C100p': + gl_dir = self.m.vars.slave_dir.join('chromebook_c100p_lib') + + extra_asmflags = [ + '--target=armv7a-linux-gnueabihf', + '--sysroot=%s' % sysroot_dir, + '-march=armv7-a', + '-mfpu=neon', + '-mthumb', + ] + + extra_cflags = [ + '--target=armv7a-linux-gnueabihf', + '--sysroot=%s' % sysroot_dir, + '-I%s' % gl_dir.join('include'), + '-I%s' % sysroot_dir.join('include'), + '-I%s' % sysroot_dir.join('include', 'c++', '4.8.4'), + '-I%s' % sysroot_dir.join('include', 'c++', '4.8.4', + 'arm-linux-gnueabihf'), + '-DMESA_EGL_NO_X11_HEADERS', + ] + + extra_ldflags = [ + '--target=armv7a-linux-gnueabihf', + '--sysroot=%s' % sysroot_dir, + # use sysroot's ld which can properly link things. + '-B%s' % sysroot_dir.join('bin'), + # helps locate crt*.o + '-B%s' % sysroot_dir.join('gcc-cross'), + # helps locate libgcc*.so + '-L%s' % sysroot_dir.join('gcc-cross'), + '-L%s' % sysroot_dir.join('lib'), + '-L%s' % gl_dir.join('lib'), + # Explicitly do not use lld for cross compiling like this - I observed + # failures like "Unrecognized reloc 41" and couldn't find out why. + ] + + quote = lambda x: '"%s"' % x + args = { + 'cc': quote(clang_linux.join('bin','clang')), + 'cxx': quote(clang_linux.join('bin','clang++')), + 'target_cpu': quote(target_arch), + 'skia_use_fontconfig': 'false', + 'skia_use_system_freetype2': 'false', + 'skia_use_egl': '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 = '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) + + context = { + 'cwd': self.m.vars.skia_dir, + 'env': { + 'LD_LIBRARY_PATH': sysroot_dir.join('lib'), + } + } + with self.m.step.context(context): + 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]) + self._run('ninja', [ninja, '-C', self.out_dir, 'nanobench', 'dm']) |