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

Issue 914873002: Rework handling of os and cpu_arch in GN. (Closed)

Created:
5 years, 10 months ago by Dirk Pranke
Modified:
5 years, 10 months ago
Reviewers:
cjhopman, brettw, scottmg
CC:
chromium-reviews, tfarina, scottmg, Roland McGrath, Nick Bray (chromium), jochen (gone - plz use gerrit), jamesr, kjellander_chromium, Slava Chigrin
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Rework handling of os and cpu_arch in GN. NaCl and V8 have more complicated requirements for handling architectures than GN could previously handle. This CL reworks things to meet their needs. NaCl occasionally has the need to be able to override build_cpu_arch. This comes up when they want to use a 32-bit host toolchain (i.e., build 32-bit "host" objects) on a 64-bit kernel. In addition, it is conceivable that other projects will need this functionality on systems capable of building for running programs for multiple architectures (any system that can run both 32-bit and 64-bit binaries), and there is no way that GN can always correctly guess which arch to use by default. V8 has the need to be able to run a host toolchain that knows what the requested target cpu_arch is; we can not use the existing "cpu_arch" for this because that needs to be the cpu_arch of the current toolchain. The concrete example is running a host binary on Linux x86 that needs to get specific flags to target arm (rather than x86), for example. We could solve this in the build configs by passing custom variables across the toolchain, but this suggests that we should have a general solution to track these things, which is what this CL does. This CL introduces two new predefined variables -- target_cpu and target_os -- and renames cpu_arch and os to to 'current_cpu' and 'current_os', and renames build_cpu_arch and build_os to host_cpu and host_os for consistency. current_cpu and target_cpu default to the same value as host_cpu, and current_os and target_os default to the same value as host_os. Any of these variables is (and should be) overridable on the command line or in a build config file. We want them to be overridable because (a) it's conceivable that some projects might always want fixed values for target_os and target_cpu_arch regardless of what platform GN is running on, and (b) we might want to set the values based on other values (i.e., have target_cpu_arch default to "arm" if target_os == "android"). Due to the renaming of "os" and "cpu_arch", this CL is likely to break any and all existing project builds; projects will need to update their build configs when rolling in the new binary. R=brettw@chromium.org BUG=344767 Committed: https://crrev.com/74add9fc39c276817d91ae88a79746ba686fd330 Cr-Commit-Position: refs/heads/master@{#317120}

Patch Set 1 #

Total comments: 7

Patch Set 2 : post bikeshed paint job, remove unittest fix #

Patch Set 3 : fix os reference in example/build/BUILD.gn #

Patch Set 4 : fix typo #

Patch Set 5 : merge to #316930 #

Total comments: 14

Patch Set 6 : update w/ review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -106 lines) Patch
M tools/gn/args.cc View 1 2 3 4 4 chunks +32 lines, -19 lines 0 comments Download
M tools/gn/command_args.cc View 1 1 chunk +3 lines, -2 lines 0 comments Download
M tools/gn/example/build/BUILD.gn View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/format_test_data/032.gn View 1 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/format_test_data/032.golden View 1 1 chunk +1 line, -1 line 0 comments Download
M tools/gn/misc/vim/syntax/gn.vim View 1 1 chunk +5 lines, -4 lines 0 comments Download
M tools/gn/variables.h View 1 3 chunks +21 lines, -13 lines 0 comments Download
M tools/gn/variables.cc View 1 2 3 4 5 4 chunks +145 lines, -65 lines 0 comments Download

Messages

Total messages: 26 (8 generated)
Dirk Pranke
https://codereview.chromium.org/914873002/diff/1/tools/gn/args.cc File tools/gn/args.cc (right): https://codereview.chromium.org/914873002/diff/1/tools/gn/args.cc#newcode146 tools/gn/args.cc:146: Brett: I couldn't figure out how to make this ...
5 years, 10 months ago (2015-02-11 02:34:32 UTC) #1
scottmg
Sorry to bikeshed (and maybe it's too annoying to change now anyway...) but does "host_cpu_arch" ...
5 years, 10 months ago (2015-02-11 03:06:21 UTC) #3
tfarina
Sorry to enter the bikeshed party, but +1!!! for 'host_cpu_arch'. I didn't realize build_cpu_arch was ...
5 years, 10 months ago (2015-02-11 10:43:23 UTC) #5
tfarina
https://codereview.chromium.org/914873002/diff/1/tools/gn/format_test_data/030.golden File tools/gn/format_test_data/030.golden (right): https://codereview.chromium.org/914873002/diff/1/tools/gn/format_test_data/030.golden#newcode4 tools/gn/format_test_data/030.golden:4: On 2015/02/11 02:34:31, Dirk Pranke wrote: > This is ...
5 years, 10 months ago (2015-02-11 13:04:48 UTC) #7
Dirk Pranke
Actually, in this case bikeshedding is welcome. If we're going to change these names, we ...
5 years, 10 months ago (2015-02-11 22:05:21 UTC) #8
Dirk Pranke
+cjhopman for his thoughts/approval/paint preferences as well.
5 years, 10 months ago (2015-02-11 22:05:52 UTC) #10
scottmg
I like those, seems clearer to me what they all mean when they're all prefixed. ...
5 years, 10 months ago (2015-02-11 22:15:01 UTC) #11
Dirk Pranke
https://codereview.chromium.org/914873002/diff/1/tools/gn/variables.cc File tools/gn/variables.cc (right): https://codereview.chromium.org/914873002/diff/1/tools/gn/variables.cc#newcode22 tools/gn/variables.cc:22: " host architecture (e.g., if you can do either ...
5 years, 10 months ago (2015-02-11 22:51:11 UTC) #12
tfarina
On Wednesday, February 11, 2015, Scott Graham <scottmg@chromium.org> wrote: > I like those, seems clearer ...
5 years, 10 months ago (2015-02-11 22:59:40 UTC) #13
Dirk Pranke
https://codereview.chromium.org/914873002/diff/20001/tools/gn/format_test_data/030.golden File tools/gn/format_test_data/030.golden (right): https://codereview.chromium.org/914873002/diff/20001/tools/gn/format_test_data/030.golden#newcode4 tools/gn/format_test_data/030.golden:4: This change is unrelated to the CL, but is ...
5 years, 10 months ago (2015-02-11 23:53:26 UTC) #14
cjhopman
On 2015/02/11 23:53:26, Dirk Pranke wrote: > https://codereview.chromium.org/914873002/diff/20001/tools/gn/format_test_data/030.golden > File tools/gn/format_test_data/030.golden (right): > > https://codereview.chromium.org/914873002/diff/20001/tools/gn/format_test_data/030.golden#newcode4 ...
5 years, 10 months ago (2015-02-12 00:53:20 UTC) #17
Dirk Pranke
On 2015/02/12 00:53:20, cjhopman wrote: > What's the benefit of building all of this into ...
5 years, 10 months ago (2015-02-12 02:02:01 UTC) #18
Dirk Pranke
Brett, please take a look? I think this is ready to land now that I've ...
5 years, 10 months ago (2015-02-19 00:16:58 UTC) #19
brettw
lgtm https://codereview.chromium.org/914873002/diff/120001/tools/gn/variables.cc File tools/gn/variables.cc (right): https://codereview.chromium.org/914873002/diff/120001/tools/gn/variables.cc#newcode9 tools/gn/variables.cc:9: // Built-in variables ---------------------------------------------------------- CAn you keep the ...
5 years, 10 months ago (2015-02-19 17:51:27 UTC) #20
Dirk Pranke
https://codereview.chromium.org/914873002/diff/120001/tools/gn/variables.cc File tools/gn/variables.cc (right): https://codereview.chromium.org/914873002/diff/120001/tools/gn/variables.cc#newcode9 tools/gn/variables.cc:9: // Built-in variables ---------------------------------------------------------- On 2015/02/19 17:51:27, brettw wrote: ...
5 years, 10 months ago (2015-02-19 19:47:09 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/914873002/140001
5 years, 10 months ago (2015-02-19 19:48:43 UTC) #24
commit-bot: I haz the power
Committed patchset #6 (id:140001)
5 years, 10 months ago (2015-02-19 20:21:14 UTC) #25
commit-bot: I haz the power
5 years, 10 months ago (2015-02-19 20:22:01 UTC) #26
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/74add9fc39c276817d91ae88a79746ba686fd330
Cr-Commit-Position: refs/heads/master@{#317120}

Powered by Google App Engine
This is Rietveld 408576698