• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2018 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
16# Generate the list of boringssl symbols that need to be renamed based on the
17# current boringssl submodule. The script should be run after a boringssl
18# upgrade in third_party/boringssl-with-bazel. Note that after the script is
19# run, you will typically need to manually upgrade the BoringSSL-GRPC podspec
20# (templates/src/objective-c/BoringSSL-GRPC.podspec.template) version and the
21# corresponding version number in gRPC-Core podspec
22# (templates/gRPC-Core.podspec.template).
23
24set -ev
25
26BORINGSSL_ROOT=third_party/boringssl-with-bazel/src
27
28cd "$(dirname $0)"
29cd ../../$BORINGSSL_ROOT
30
31BORINGSSL_COMMIT=$(git rev-parse HEAD)
32BORINGSSL_PREFIX_HEADERS_DIR=src/boringssl
33
34rm -rf build
35mkdir -p build
36cd build
37cmake ..
38make -j
39[ -f ssl/libssl.a ] || { echo "Failed to build libssl.a" ; exit 1 ; }
40[ -f crypto/libcrypto.a ] || { echo "Failed to build libcrypto.a" ; exit 1 ; }
41
42# Generates boringssl_prefix_symbols.h. The prefix header is generated by
43# BoringSSL's build system as instructed by BoringSSL build guide (see
44# https://github.com/google/boringssl/blob/367d64f84c3c1d01381c18c5a239b85eef47633c/BUILDING.md#building-with-prefixed-symbols).
45go run ../util/read_symbols.go ssl/libssl.a > ./symbols.txt
46go run ../util/read_symbols.go crypto/libcrypto.a >> ./symbols.txt
47cmake .. -DBORINGSSL_PREFIX=GRPC -DBORINGSSL_PREFIX_SYMBOLS=symbols.txt
48make boringssl_prefix_symbols
49[ -f symbol_prefix_include/boringssl_prefix_symbols.h ] || { echo "Failed to build boringssl_prefix_symbols.sh" ; exit 1 ; }
50
51cd ../../../..
52mkdir -p $BORINGSSL_PREFIX_HEADERS_DIR
53echo "// generated by generate_boringssl_prefix_header.sh on BoringSSL commit: $BORINGSSL_COMMIT" > $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
54echo "" >> $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
55cat "$BORINGSSL_ROOT/build/symbol_prefix_include/boringssl_prefix_symbols.h" >> $BORINGSSL_PREFIX_HEADERS_DIR/boringssl_prefix_symbols.h
56
57# Regenerated the project
58tools/buildgen/generate_projects.sh
59
60exit 0
61