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