Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: build/toolchain/cros/BUILD.gn

Issue 1491463002: build CrOS chrome with gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/cros/BUILD.gn
diff --git a/build/toolchain/cros/BUILD.gn b/build/toolchain/cros/BUILD.gn
index 5db3c200889678598ddff608aabcd76e0dfde9ed..f99112376d3ba5740a2b8474a95e8313eddf3a1c 100644
--- a/build/toolchain/cros/BUILD.gn
+++ b/build/toolchain/cros/BUILD.gn
@@ -4,33 +4,98 @@
import("//build/toolchain/gcc_toolchain.gni")
+# CrOS builds must cross-compile on a Linux host for the actual CrOS
+# device target. There are many different CrOS devices so the build
+# system provides configuration variables that permit a CrOS build to
+# control the cross-compilation tool chain. However, requiring such
+# fine-grain specification is tedious for build-bots and developers.
+# Consequently, the CrOS build system defaults to a convenience
+# compilation mode where the compilation host is also the build target.
+#
+# Chrome can be compiled in this way with the gn variable:
+#
+# target_os = "chromeos"
+#
+# To perform a board-specific build, first obtain the correct system
+# root (http://goo.gl/aFB4XH) for the board. Then configure GN to use it
+# by setting appropriate cross-compilation variables.
+#
+# For example, to compile a Chrome source tree in /g/src for an
+# auron_paine CrOS device with the system root cached in /g/.cros_cache,
+# the following GN arguments must be provided to configure
+# cross-compilation with Goma acceleration. (NB: additional variables
+# will be necessary to successfully compile a working CrOS Chrome. See
+# the definition of GYP_DEFINES inside a sysroot shell.)
+#
+# goma_dir = "/g/.cros_cache/common/goma+2"
+# target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz"
+# 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"
+# 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"
+# cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar"
+# target_cpu = "x64"
+
declare_args() {
- # The CrOS build system supports many different kinds of targets across
- # many different architectures. Bringing your own toolchain is also supported,
- # so it's actually impossible to enumerate all toolchains for all targets
- # as GN toolchain specifications.
- # These arguments provide a mechanism for specifying your CC, CXX and AR at
- # buildfile-generation time, allowing the CrOS build system to always use
- # the right tools for the current target.
+ # These must be specified for a board-specific build.
cros_target_cc = ""
cros_target_cxx = ""
cros_target_ar = ""
}
-gcc_toolchain("target") {
- assert(cros_target_cc != "", "Must provide target CC.")
- assert(cros_target_cxx != "", "Must provide target CXX.")
- assert(cros_target_ar != "", "Must provide target AR.")
+clang_toolchain("clang_x64") {
Dirk Pranke 2015/12/01 20:13:48 is there really a reason to support both the _x64
rjkroege 2015/12/02 00:22:39 Probably not? I have simplified the file.
+ toolchain_cpu = "x64"
+ toolchain_os = "linux"
+}
- cc = "${cros_target_cc}"
- cxx = "${cros_target_cxx}"
+gcc_toolchain("x64") {
+ # These defaults permit building on a Linux host as described above.
+ cc = "gcc"
+ cxx = "g++"
+ ar = "ar"
- ar = "${cros_target_ar}"
+ # But to build for a specific board, the cros_* args will need to be defined.
+ if (cros_target_cc != "") {
+ cc = "${cros_target_cc}"
+ }
+ if (cros_target_cxx != "") {
+ cxx = "${cros_target_cxx}"
+ }
+ if (cros_target_ar != "") {
+ ar = "${cros_target_ar}"
+ }
ld = cxx
- toolchain_cpu = "${target_cpu}"
+ toolchain_cpu = "x64"
toolchain_os = "linux"
is_clang = is_clang
use_ccache = false
- use_goma = false
+}
+
+clang_toolchain("clang_x86") {
+ toolchain_cpu = "x86"
+ toolchain_os = "linux"
+}
+
+gcc_toolchain("x86") {
+ cc = "gcc"
+ cxx = "g++"
+
+ readelf = "readelf"
+ nm = "nm"
+ ar = "ar"
+ ld = cxx
+
+ # To build for a specific board, the cros_* args will need to be defined.
+ if (cros_target_cc != "") {
+ cc = "${cros_target_cc}"
+ }
+ if (cros_target_cxx != "") {
+ cxx = "${cros_target_cxx}"
+ }
+ if (cros_target_ar != "") {
+ ar = "${cros_target_ar}"
+ }
+
+ toolchain_cpu = "x86"
+ toolchain_os = "linux"
+ is_clang = false
}
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698