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

Side by Side Diff: bootstrap/cipd/doc/infra/tools/protoc/linux-amd64/README.md

Issue 1364983002: Add CIPD binary installation to DEPS runhooks. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Technically correct, the best kind of correct! :) Created 5 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « bootstrap/cipd/cipd_linux_amd64.txt ('k') | bootstrap/install_cipd_packages.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # `infra/tools/protoc/linux-amd64`
2 ## Building Instructions.
3
4 Choose a build directory. We'll use the enviornment variable `$ROOT` to
5 represent it.
6
7 $ cd $ROOT
8
9 Clone the `protobuf` repository:
10
11 $ git clone https://github.com/google/protobuf
12
13 Run the build. We include the following additional configuration flags:
14 - `--disable-shared`: Build a static library.
15 - `--prefix $ROOT/PREFIX`: The installation prefix. This allows us to install
16 locally, so we don't need root.
17
18 Build:
19
20 $ cd protobuf
21 $ ./autogen.sh
22 $ ./configure --disable-shared --prefix $ROOT/PREFIX
23 $ make -j24 install
24
25 This will install the generator to `$ROOT/PREFIX`. Afterwards, strip the binary.
26 This removes symbols and debugging information, including your username, from
27 the binary, reducing its size from ~40MiB to ~3MiB.
28
29 $ strip -g $ROOT/PREFIX/bin/protoc
30
31 We need to package the `$ROOT/PREFIX/include` directory because it includes
32 the protobuf standard library. However, we don't want to include all of the
33 C++ header files, nor do we want to include the compiled libraries. Prune the
34 contents of `$ROOT/PREFIX` to include only:
35 - The `protoc` binary.
36 - The standard library header files.
37
38 $ rm -rf $ROOT/PREFIX/lib
39 $ find $ROOT/PREFIX/include -type f ! -name '*.proto' -delete
40
41 The `protoc` utility searches for its default `include` path relative to its
42 binary location. First, it searches to see if the `include` path is in the same
43 directory as itself; if not, it looks in the parent directory. Because of the
44 way `CIPD` packages are installed, we opt to exploit the former location by
45 moving the `include` directory into the `bin` directory, then making the `bin`
46 directory the `CIPD` package root.
47
48 $ mv $ROOT/PREFIX/include $ROOT/PREFIX/bin
49
50 This will result in a deployment that looks like:
51 - `/protoc`: The statically-linked protocol buffers compiler.
52 - `/include/...`: Standard `proto3` include protobufs.
53
54 Create package and deploy to `CIPD` server. Tag it with the Git commit of the
55 `protobuf` source from which it was built.
56
57 $ cipd create \
58 -name "infra/tools/protoc/linux-amd64" \
59 -in $ROOT/PREFIX/bin \
60 -tag "git_commit:`git rev-parse HEAD`"
OLDNEW
« no previous file with comments | « bootstrap/cipd/cipd_linux_amd64.txt ('k') | bootstrap/install_cipd_packages.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698