Fix mbedtls-2.4.0 build error
[platform/upstream/iotivity.git] / extlibs / mbedtls / prep.sh
1 #!/bin/sh
2
3 set -e
4
5 # Keep mbedtls_revision in sync with extlibs/mbedtls/SConscript's setting. Right now this script
6 # assumes mbedtls_revision is a tag; comment out the second clause if mbedtls_revision becomes
7 # a branch or a specific commit.
8 mbedtls_dir=`dirname -- "$(readlink -f "$0")"`/mbedtls
9 mbedtls_revision="mbedtls-2.4.0"
10 if [ ! -d ${mbedtls_dir} ]; then
11     echo ""
12     echo "*********************************** Error: ****************************************"
13     echo "* Please download mbedTLS using the following command:                            *"
14     echo "*     $ git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls  *"
15     echo "***********************************************************************************"
16     echo ""
17     exit
18 elif [ ! -z $(git tag -l $mbedtls_revision) ]; then
19     echo ""
20     echo "*********************************** Error: ****************************************"
21     echo "* mbedTLS repo is out of date. Please update mbedtls using the following commands:*"
22     echo "*     $ cd (authoritative mbedTLS source repo location)                           *"
23     echo "*     $ git fetch                                                                 *"
24     echo "***********************************************************************************"
25     echo ""
26     exit
27 elif [ -d ${mbedtls_dir}/.git ]; then
28     cd ${mbedtls_dir}
29     git reset --hard ${mbedtls_revision} ; git apply --whitespace=fix ../ocf.patch
30     cd -
31     rm -rf ${mbedtls_dir}/.git*
32 else
33     echo "tizen: Checking if ocf.patch is applied in ${mbedtls_dir}"
34     grep -r 'TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256' "${mbedtls_dir}"
35 fi
36