1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2016 The Chromium Authors 2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file. 4*8975f5c5SAndroid Build Coastguard Worker 5*8975f5c5SAndroid Build Coastguard Worker# CrOS builds must cross-compile on a Linux host for the actual CrOS 6*8975f5c5SAndroid Build Coastguard Worker# device target. There are many different CrOS devices so the build 7*8975f5c5SAndroid Build Coastguard Worker# system provides configuration variables that permit a CrOS build to 8*8975f5c5SAndroid Build Coastguard Worker# control the cross-compilation tool chain. However, requiring such 9*8975f5c5SAndroid Build Coastguard Worker# fine-grain specification is tedious for build-bots and developers. 10*8975f5c5SAndroid Build Coastguard Worker# Consequently, the CrOS build system defaults to a convenience 11*8975f5c5SAndroid Build Coastguard Worker# compilation mode where the compilation host is also the build target. 12*8975f5c5SAndroid Build Coastguard Worker# 13*8975f5c5SAndroid Build Coastguard Worker# Chrome can be compiled in this way with the gn variable: 14*8975f5c5SAndroid Build Coastguard Worker# 15*8975f5c5SAndroid Build Coastguard Worker# target_os = "chromeos" 16*8975f5c5SAndroid Build Coastguard Worker# 17*8975f5c5SAndroid Build Coastguard Worker# To perform a board-specific build, first obtain the correct system 18*8975f5c5SAndroid Build Coastguard Worker# root (http://goo.gl/aFB4XH) for the board. Then configure GN to use it 19*8975f5c5SAndroid Build Coastguard Worker# by setting appropriate cross-compilation variables. 20*8975f5c5SAndroid Build Coastguard Worker# 21*8975f5c5SAndroid Build Coastguard Worker# For example, to compile a Chrome source tree in /g/src for an 22*8975f5c5SAndroid Build Coastguard Worker# auron_paine CrOS device with the system root cached in /g/.cros_cache, 23*8975f5c5SAndroid Build Coastguard Worker# the following GN arguments must be provided to configure 24*8975f5c5SAndroid Build Coastguard Worker# cross-compilation with RBE acceleration. (NB: additional variables 25*8975f5c5SAndroid Build Coastguard Worker# will be necessary to successfully compile a working CrOS Chrome. See 26*8975f5c5SAndroid Build Coastguard Worker# the definition of GYP_DEFINES inside a sysroot shell.) 27*8975f5c5SAndroid Build Coastguard Worker# 28*8975f5c5SAndroid Build Coastguard Worker# target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz" 29*8975f5c5SAndroid Build Coastguard Worker# cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarballs/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold" 30*8975f5c5SAndroid Build Coastguard Worker# cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarballs/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold" 31*8975f5c5SAndroid Build Coastguard Worker# cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar" 32*8975f5c5SAndroid Build Coastguard Worker# target_cpu = "x64" 33*8975f5c5SAndroid Build Coastguard Worker 34*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/clang/clang.gni") 35*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/compiler/compiler.gni") 36*8975f5c5SAndroid Build Coastguard Worker 37*8975f5c5SAndroid Build Coastguard Workerdeclare_args() { 38*8975f5c5SAndroid Build Coastguard Worker # These must be specified for a board-specific build. 39*8975f5c5SAndroid Build Coastguard Worker cros_target_ar = "${clang_base_path}/bin/llvm-ar" 40*8975f5c5SAndroid Build Coastguard Worker cros_target_cc = "${clang_base_path}/bin/clang" 41*8975f5c5SAndroid Build Coastguard Worker cros_target_cxx = "${clang_base_path}/bin/clang++" 42*8975f5c5SAndroid Build Coastguard Worker cros_target_nm = "" 43*8975f5c5SAndroid Build Coastguard Worker cros_target_readelf = "" 44*8975f5c5SAndroid Build Coastguard Worker 45*8975f5c5SAndroid Build Coastguard Worker # These can be optionally set. The "_cppflags" will be applied to *both* 46*8975f5c5SAndroid Build Coastguard Worker # C and C++ files; use "_cxxflags" for C++-only flags. 47*8975f5c5SAndroid Build Coastguard Worker cros_target_extra_cflags = "" 48*8975f5c5SAndroid Build Coastguard Worker cros_target_extra_cppflags = "" 49*8975f5c5SAndroid Build Coastguard Worker cros_target_extra_cxxflags = "" 50*8975f5c5SAndroid Build Coastguard Worker cros_target_extra_ldflags = "" 51*8975f5c5SAndroid Build Coastguard Worker 52*8975f5c5SAndroid Build Coastguard Worker cros_host_ar = "${clang_base_path}/bin/llvm-ar" 53*8975f5c5SAndroid Build Coastguard Worker cros_host_cc = "${clang_base_path}/bin/clang" 54*8975f5c5SAndroid Build Coastguard Worker cros_host_cxx = "${clang_base_path}/bin/clang++" 55*8975f5c5SAndroid Build Coastguard Worker cros_host_nm = "" 56*8975f5c5SAndroid Build Coastguard Worker cros_host_readelf = "" 57*8975f5c5SAndroid Build Coastguard Worker cros_host_extra_cflags = "" 58*8975f5c5SAndroid Build Coastguard Worker cros_host_extra_cppflags = "" 59*8975f5c5SAndroid Build Coastguard Worker cros_host_extra_cxxflags = "" 60*8975f5c5SAndroid Build Coastguard Worker cros_host_extra_ldflags = "" 61*8975f5c5SAndroid Build Coastguard Worker cros_host_sysroot = "" 62*8975f5c5SAndroid Build Coastguard Worker 63*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_ar = "${clang_base_path}/bin/llvm-ar" 64*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_cc = "${clang_base_path}/bin/clang" 65*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_cxx = "${clang_base_path}/bin/clang++" 66*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_nm = "" 67*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_readelf = "" 68*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_extra_cflags = "" 69*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_extra_cppflags = "" 70*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_extra_cxxflags = "" 71*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_extra_ldflags = "" 72*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_sysroot = "" 73*8975f5c5SAndroid Build Coastguard Worker 74*8975f5c5SAndroid Build Coastguard Worker cros_nacl_bootstrap_extra_cflags = "" 75*8975f5c5SAndroid Build Coastguard Worker cros_nacl_bootstrap_extra_cppflags = "" 76*8975f5c5SAndroid Build Coastguard Worker cros_nacl_bootstrap_extra_cxxflags = "" 77*8975f5c5SAndroid Build Coastguard Worker cros_nacl_bootstrap_extra_ldflags = "" 78*8975f5c5SAndroid Build Coastguard Worker 79*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_ar = "${clang_base_path}/bin/llvm-ar" 80*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_cc = "${clang_base_path}/bin/clang" 81*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_cxx = "${clang_base_path}/bin/clang++" 82*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_readelf = "" 83*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_sysroot = "" 84*8975f5c5SAndroid Build Coastguard Worker} 85*8975f5c5SAndroid Build Coastguard Worker 86*8975f5c5SAndroid Build Coastguard Workerdeclare_args() { 87*8975f5c5SAndroid Build Coastguard Worker cros_target_ld = cros_target_cxx 88*8975f5c5SAndroid Build Coastguard Worker cros_host_ld = cros_host_cxx 89*8975f5c5SAndroid Build Coastguard Worker cros_v8_snapshot_ld = cros_v8_snapshot_cxx 90*8975f5c5SAndroid Build Coastguard Worker cros_nacl_helper_arm32_ld = cros_nacl_helper_arm32_cxx 91*8975f5c5SAndroid Build Coastguard Worker} 92