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
20echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
21apt-get update
22apt-get install -t jessie-backports -y libssl-dev
23
24# Install c-ares
25cd third_party/cares/cares
26git fetch origin
27git checkout cares-1_13_0
28mkdir -p cmake/build
29cd cmake/build
30cmake -DCMAKE_BUILD_TYPE=Release ../..
31make -j4 install
32cd ../../../../..
33rm -rf third_party/cares/cares  # wipe out to prevent influencing the grpc build
34
35# Install zlib
36cd third_party/zlib
37mkdir -p cmake/build
38cd cmake/build
39cmake -DCMAKE_BUILD_TYPE=Release ../..
40make -j4 install
41cd ../../../..
42rm -rf third_party/zlib  # wipe out to prevent influencing the grpc build
43
44# Install protobuf
45cd third_party/protobuf
46mkdir -p cmake/build
47cd cmake/build
48cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..
49make -j4 install
50cd ../../../..
51rm -rf third_party/protobuf  # wipe out to prevent influencing the grpc build
52
53# Install gRPC
54mkdir -p cmake/build
55cd cmake/build
56cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release ../..
57make -j4 install
58cd ../..
59
60# Build helloworld example using cmake
61cd examples/cpp/helloworld
62mkdir -p cmake/build
63cd cmake/build
64cmake ../..
65make
66
67