• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2017 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -ex
17
18cd "$(dirname "$0")/../../.."
19
20# Install openssl (to use instead of boringssl)
21apt-get update && apt-get install -y libssl-dev
22
23# Install absl
24mkdir -p "third_party/abseil-cpp/cmake/build"
25pushd "third_party/abseil-cpp/cmake/build"
26cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../..
27make -j4 install
28popd
29
30# Install c-ares
31# If the distribution provides a new-enough version of c-ares,
32# this section can be replaced with:
33# apt-get install -y libc-ares-dev
34mkdir -p "third_party/cares/cares/cmake/build"
35pushd "third_party/cares/cares/cmake/build"
36cmake -DCMAKE_BUILD_TYPE=Release ../..
37make -j4 install
38popd
39
40# Install protobuf
41mkdir -p "third_party/protobuf/cmake/build"
42pushd "third_party/protobuf/cmake/build"
43cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
44make -j4 install
45popd
46
47# Install re2
48mkdir -p "third_party/re2/cmake/build"
49pushd "third_party/re2/cmake/build"
50cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../..
51make -j4 install
52popd
53
54# Install zlib
55mkdir -p "third_party/zlib/cmake/build"
56pushd "third_party/zlib/cmake/build"
57cmake -DCMAKE_BUILD_TYPE=Release ../..
58make -j4 install
59popd
60
61# Just before installing gRPC, wipe out contents of all the submodules to simulate
62# a standalone build from an archive
63# shellcheck disable=SC2016
64git submodule foreach 'cd $toplevel; rm -rf $name'
65
66# Install gRPC
67mkdir -p "cmake/build"
68pushd "cmake/build"
69cmake \
70  -DCMAKE_BUILD_TYPE=Release \
71  -DgRPC_INSTALL=ON \
72  -DgRPC_BUILD_TESTS=OFF \
73  -DgRPC_CARES_PROVIDER=package \
74  -DgRPC_ABSL_PROVIDER=package \
75  -DgRPC_PROTOBUF_PROVIDER=package \
76  -DgRPC_RE2_PROVIDER=package \
77  -DgRPC_SSL_PROVIDER=package \
78  -DgRPC_ZLIB_PROVIDER=package \
79  ../..
80make -j4 install
81popd
82
83# Build helloworld example using cmake
84mkdir -p "examples/cpp/helloworld/cmake/build"
85pushd "examples/cpp/helloworld/cmake/build"
86cmake ../..
87make
88popd
89