Imported Upstream version 1.26.0
[platform/upstream/grpc.git] / templates / tools / openssl / use_openssl.sh.template
1 %YAML 1.2
2 --- |
3   #!/bin/bash
4
5   # Copyright 2015 gRPC authors.
6   #
7   # Licensed under the Apache License, Version 2.0 (the "License");
8   # you may not use this file except in compliance with the License.
9   # You may obtain a copy of the License at
10   #
11   #     http://www.apache.org/licenses/LICENSE-2.0
12   #
13   # Unless required by applicable law or agreed to in writing, software
14   # distributed under the License is distributed on an "AS IS" BASIS,
15   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   # See the License for the specific language governing permissions and
17   # limitations under the License.
18
19   set -ex
20
21   cd "$(dirname "$0")/../.."
22   set root=`pwd`
23   CC=${"${CC:-cc}"}
24
25   # allow openssl to be pre-downloaded
26   if [ ! -e third_party/${openssl_fallback.tarball} ]
27   then
28     echo "Downloading ${openssl_fallback.base_uri + openssl_fallback.tarball} to third_party/${openssl_fallback.tarball}"
29     wget ${openssl_fallback.base_uri + openssl_fallback.tarball} -O third_party/${openssl_fallback.tarball}
30   fi
31
32   # clean openssl directory
33   rm -rf third_party/${openssl_fallback.extraction_dir}
34
35   # extract archive
36   cd third_party
37   tar xfz ${openssl_fallback.tarball}
38
39   # build openssl
40   cd ${openssl_fallback.extraction_dir}
41   CC="$CC -fPIC -fvisibility=hidden" ./config no-asm
42   make
43
44   # generate the 'grpc_obj' directory needed by the makefile
45   mkdir grpc_obj
46   cd grpc_obj
47   ar x ../libcrypto.a
48   ar x ../libssl.a