OLD | NEW |
---|---|
1 Instructions on how to update the [clang-format binaries](ClangFormat.md) that c ome with a checkout of Chromium. | 1 # Updating Clang format binaries |
2 | 2 |
3 <h2>Prerequisites</h2> | 3 Instructions on how to update the [clang-format binaries](clang_format.md) that |
4 come with a checkout of Chromium. | |
4 | 5 |
5 You'll need a Windows machine, a Linux machine, and a Mac; all capable of buildi ng clang-format. You'll also need permissions to upload to the appropriate googl e storage bucket. Chromium infrastructure team members have this, and others can be granted the permission based on need. Talk to ncarter or hinoka about gettin g access. | 6 ## Prerequisites |
6 | 7 |
7 <h2>Pick a head svn revision</h2> | 8 You'll need a Windows machine, a Linux machine, and a Mac; all capable of |
9 building clang-format. You'll also need permissions to upload to the appropriate | |
10 google storage bucket. Chromium infrastructure team members have this, and | |
11 others can be granted the permission based on need. Talk to ncarter or hinoka | |
12 about getting access. | |
8 | 13 |
9 Consult http://llvm.org/svn/llvm-project/ for the current head revision. This wi ll be the CLANG\_REV you'll use later to check out each platform to a consistent state. | 14 ## Pick a head svn revision |
10 | 15 |
11 <h2>Build a release-mode clang-format on each platform</h2> | 16 Consult http://llvm.org/svn/llvm-project/ for the current head revision. This |
17 will be the CLANG_REV you'll use later to check out each platform to a | |
18 consistent state. | |
12 | 19 |
13 Follow the the official instructions here: http://clang.llvm.org/get_started.htm l. | 20 ## Build a release-mode clang-format on each platform |
21 | |
22 Follow the the official instructions here: | |
23 http://clang.llvm.org/get_started.html. | |
14 | 24 |
15 Windows step-by-step: | 25 Windows step-by-step: |
16 ``` | |
17 [double check you have the tools you need] | |
18 where cmake.exe # You need to install this. | |
19 where svn.exe # Maybe fix with: set PATH=%PATH%;D:\src\depot_tools\svn_bin | |
20 "c:\Program Files (x86)\Microsoft Visual Studio 12.0\vc\vcvarsall.bat" amd64_x86 | |
21 | 26 |
27 ```shell | |
28 # [double check you have the tools you need] | |
29 # where cmake.exe # You need to install this. | |
Bons
2015/08/25 16:51:01
these shouldn't be all comments.
nodir
2015/08/25 17:05:04
Done.
| |
30 # where svn.exe # Maybe fix with: set PATH=%PATH%;D:\src\depot_tools\svn_bin | |
31 # "c:\Program Files (x86)\Microsoft Visual Studio 12.0\vc\vcvarsall.bat" amd64_x 86 | |
22 | 32 |
23 set CLANG_REV=198831 # You must change this value (see above) | 33 set CLANG_REV=198831 # You must change this value (see above) |
24 | 34 |
25 [from a clean directory, check out and build] | 35 [from a clean directory, check out and build] |
26 rmdir /S /Q llvm | 36 rmdir /S /Q llvm |
27 rmdir /S /Q llvm-build | 37 rmdir /S /Q llvm-build |
28 mkdir llvm | 38 mkdir llvm |
29 mkdir llvm-build | 39 mkdir llvm-build |
30 svn co http://llvm.org/svn/llvm-project/llvm/trunk@%CLANG_REV% llvm | 40 svn co http://llvm.org/svn/llvm-project/llvm/trunk@%CLANG_REV% llvm |
31 cd llvm\tools | 41 cd llvm\tools |
32 svn co http://llvm.org/svn/llvm-project/cfe/trunk@%CLANG_REV% clang | 42 svn co http://llvm.org/svn/llvm-project/cfe/trunk@%CLANG_REV% clang |
33 cd ..\..\llvm-build | 43 cd ..\..\llvm-build |
34 set CC=cl | 44 set CC=cl |
35 set CXX=cl | 45 set CXX=cl |
36 cmake -G Ninja ..\llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLL VM_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO -DPYTHON_EXECUTABLE=d:\src\depo t_tools\python276_bin\python.exe | 46 cmake -G Ninja ..\llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT \ |
47 -DLLVM_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO \ | |
48 -DPYTHON_EXECUTABLE=d:\src\depot_tools\python276_bin\python.exe | |
37 ninja clang-format | 49 ninja clang-format |
38 bin\clang-format.exe --version | 50 bin\clang-format.exe --version |
39 ``` | 51 ``` |
40 | 52 |
41 Mac & Linux step-by-step: | 53 Mac & Linux step-by-step: |
42 ``` | 54 |
55 ```shell | |
43 # Check out. | 56 # Check out. |
44 export CLANG_REV=198831 # You must change this value (see above) | 57 export CLANG_REV=198831 # You must change this value (see above) |
45 rm -rf llvm | 58 rm -rf llvm |
46 rm -rf llvm-build | 59 rm -rf llvm-build |
47 mkdir llvm | 60 mkdir llvm |
48 mkdir llvm-build | 61 mkdir llvm-build |
49 svn co http://llvm.org/svn/llvm-project/llvm/trunk@$CLANG_REV llvm | 62 svn co http://llvm.org/svn/llvm-project/llvm/trunk@$CLANG_REV llvm |
50 cd llvm/tools | 63 cd llvm/tools |
51 svn co http://llvm.org/svn/llvm-project/cfe/trunk@$CLANG_REV clang | 64 svn co http://llvm.org/svn/llvm-project/cfe/trunk@$CLANG_REV clang |
52 cd ../../llvm-build | 65 cd ../../llvm-build |
53 | 66 |
54 # Option 1: with cmake | 67 # Option 1: with cmake |
55 MACOSX_DEPLOYMENT_TARGET=10.9 cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLV M_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO ../llvm/ | 68 MACOSX_DEPLOYMENT_TARGET=10.9 cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \ |
56 time caffeinate ninja clang-format | 69 -DLLVM_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO ../llvm/ |
57 strip bin/clang-format | 70 time caffeinate ninja clang-format |
71 strip bin/clang-format | |
58 | 72 |
59 # (On Linux, to build with clang, which produces smaller binaries, add this to your cmake invocation. | 73 # (On Linux, to build with clang, which produces smaller binaries, add this to |
60 # On Mac, the system compiler is already clang so it's not needed there.) | 74 # your cmake invocation. |
61 -DCMAKE_C_COMPILER=$PWD/../chrome/src/third_party/llvm-build/Release+Asserts/b in/clang -DCMAKE_CXX_COMPILER=$PWD/../chrome/src/third_party/llvm-build/Release+ Asserts/bin/clang++ | 75 # On Mac, the system compiler is already clang so it's not needed there.) |
76 -DCMAKE_C_COMPILER=$PWD/../chrome/src/third_party/llvm-build/Release+Asserts/bin /clang -DCMAKE_CXX_COMPILER=$PWD/../chrome/src/third_party/llvm-build/Release+As serts/bin/clang++ | |
62 ``` | 77 ``` |
78 | |
79 TODO: these ^^ instructions looks odd. Are they correct??? | |
80 | |
63 Platform specific notes: | 81 Platform specific notes: |
64 * Windows: Visual Studio 2013 only. | |
65 * Linux: so far (as of January 2014) we've just included a 64-bit binary. It's important to disable threading, else clang-format will depend on libatomic.so.1 which doesn't exist on Precise. | |
66 * Mac: Remember to set `MACOSX_DEPLOYMENT_TARGET` when building! If you get co nfigure warnings, you may need to install XCode 5 and avoid a goma environment. | |
67 | 82 |
68 <h2>Upload each binary to google storage</h2> | 83 * Windows: Visual Studio 2013 only. |
84 * Linux: so far (as of January 2014) we've just included a 64-bit binary. It's | |
85 important to disable threading, else clang-format will depend on | |
86 libatomic.so.1 which doesn't exist on Precise. | |
87 * Mac: Remember to set `MACOSX_DEPLOYMENT_TARGET` when building! If you get | |
88 configure warnings, you may need to install XCode 5 and avoid a goma | |
89 environment. | |
69 | 90 |
70 Copy the binaries into your chromium checkout (under `src/buildtools/(win|linux6 4|mac)/clang-format(.exe?)`). | 91 ## Upload each binary to google storage |
71 For each binary, you'll need to run upload\_to\_google\_storage.py according to the instructions in [README.txt](https://code.google.com/p/chromium/codesearch#c hromium/src/buildtools/clang_format/README.txt). This will upload the binary int o a publicly accessible google storage bucket, and update `.sha1` file in your C hrome checkout. You'll check in the `.sha1` file (but NOT the clang-format binar y) into source control. In order to be able to upload, you'll need write permiss ion to the bucket -- see the prerequisites. | |
72 | 92 |
73 <h2>Copy the helper scripts and update README.chromium</h2> | 93 Copy the binaries into your chromium checkout (under |
94 `src/buildtools/(win|linux64|mac)/clang-format(.exe?)`). For each binary, you'll | |
95 need to run upload_to_google_storage.py according to the instructions in | |
96 [README.txt](/buildtools/clang_format/README.txt). This will upload the binary | |
97 into a publicly accessible google storage bucket, and update `.sha1` file in | |
98 your Chrome checkout. You'll check in the `.sha1` file (but NOT the clang-format | |
99 binary) into source control. In order to be able to upload, you'll need write | |
100 permission to the bucket -- see the prerequisites. | |
74 | 101 |
75 There are some auxiliary scripts that ought to be kept updated in lockstep with the clang-format binary. These get copied into third\_party/clang\_format/script s in your Chromium checkout. | 102 ## Copy the helper scripts and update README.chromium |
103 | |
104 There are some auxiliary scripts that ought to be kept updated in lockstep with | |
105 the clang-format binary. These get copied into | |
106 third_party/clang_format/scripts in your Chromium checkout. | |
76 | 107 |
77 The `README.chromium` file ought to be updated with version and date info. | 108 The `README.chromium` file ought to be updated with version and date info. |
78 | 109 |
79 <h2>Upload a CL according to the following template</h2> | 110 ## Upload a CL according to the following template |
80 | 111 |
81 ``` | 112 Update clang-format binaries and scripts for all platforms. |
82 Update clang-format binaries and scripts for all platforms. | |
83 | 113 |
84 I followed these instructions: | 114 I followed these instructions: |
85 https://code.google.com/p/chromium/wiki/UpdatingClangFormatBinaries | 115 https://code.google.com/p/chromium/wiki/UpdatingClangFormatBinaries |
Bons
2015/08/25 16:51:01
update link
nodir
2015/08/25 17:05:04
Done.
| |
86 | 116 |
87 The binaries were built at clang revision ####### on ####DATETIME####. | 117 The binaries were built at clang revision ####### on ####DATETIME####. |
88 | 118 |
89 BUG= | 119 BUG= |
90 ``` | |
91 | 120 |
92 The change should <b>always</b> include new `.sha1` files for each platform (we want to keep these in lockstep), should <b>never</b> include `clang-format` bina ries directly. The change should <b>always</b> update `README.chromium` | 121 The change should **always** include new `.sha1` files for each platform (we |
122 want to keep these in lockstep), should **never** include `clang-format` | |
123 binaries directly. The change should **always** update `README.chromium` | |
93 | 124 |
94 clang-format binaries should weigh in at 1.5MB or less. Watch out for size regre ssions. | 125 clang-format binaries should weigh in at 1.5MB or less. Watch out for size |
126 regressions. | |
OLD | NEW |