OLD | NEW |
(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 Create package and deploy to `cipd` server. Tag it with the Git commit of the |
| 42 `protobuf` source from which it was built. |
| 43 |
| 44 $ cipd create \ |
| 45 -name "infra/tools/protoc/linux-amd64" \ |
| 46 -in $ROOT/PREFIX \ |
| 47 -tag "git_commit:`git rev-parse HEAD`" |
OLD | NEW |