Added compatibility define
[platform/upstream/freerdp.git] / scripts / android-build-openssl.sh
1 #!/bin/bash
2
3 SCM_URL=https://github.com/openssl/openssl
4 SCM_TAG=master
5
6 COMPILER=4.9
7
8 source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
9
10 function build {
11         if [ $# -ne 2 ];
12         then
13                 echo "Invalid arguments $@"
14                 exit 1
15         fi
16
17         CONFIG=$1
18     DST_PREFIX=$2
19
20     common_run export CC=clang
21     common_run export PATH=$(${SCRIPT_PATH}/toolchains_path.py --ndk ${ANDROID_NDK}):$ORG_PATH
22     common_run export ANDROID_NDK
23
24         echo "CONFIG=$CONFIG"
25         echo "DST_PREFIX=$DST_PREFIX"
26         echo "PATH=$PATH"
27
28         BASE=$(pwd)
29         DST_DIR=$BUILD_DST/$DST_PREFIX
30         common_run cd $BUILD_SRC
31         common_run ./Configure ${CONFIG} -D__ANDROID_API__=$NDK_TARGET
32         common_run make SHLIB_EXT=.so -j build_libs
33
34         if [ ! -d $DST_DIR ];
35         then
36                 common_run mkdir -p $DST_DIR
37         fi
38
39     common_run cp *.so $DST_DIR/
40         common_run cd $BASE
41 }
42
43 # Run the main program.
44 common_parse_arguments $@
45 common_check_requirements
46 common_update $SCM_URL $SCM_TAG $BUILD_SRC
47
48 ORG_PATH=$PATH
49 for ARCH in $BUILD_ARCH
50 do
51
52         case $ARCH in
53          "armeabi-v7a")
54                  build "android-arm" "armeabi-v7a"
55          ;;
56          "x86")
57                  build "android-x86" "x86"
58                  ;;
59          "arm64-v8a")
60                  build "android-arm64" "arm64-v8a"
61                  ;;
62          "x86_64")
63                  build "android-x86_64" "x86_64"
64                  ;;
65         *)
66                 echo "[WARNING] Skipping unsupported architecture $ARCH"
67                 continue
68                 ;;
69         esac
70 done
71
72 if [ ! -d $BUILD_DST/$ARCH/include ];
73 then
74         common_run mkdir -p $BUILD_DST/$ARCH/include
75 fi
76 common_run cp -L -R $BUILD_SRC/include/openssl $BUILD_DST/$ARCH/include/
77