You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

aconfigure.sh 3.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #! /usr/bin/env bash
  2. ## *****************************************************************************
  3. ##
  4. ## Description : aconfigure is a script used for compiling autotools projects
  5. ## for android.
  6. ##
  7. ## Prerequisites:
  8. ## 1. Setup android toolchains using README.md present in
  9. ## cocosdk-java/jni
  10. ##
  11. ## *****************************************************************************
  12. ##/*===============================================================================*/
  13. ##/* Copyright (c) 2018 Elear Solutions Tech Private Limited. All rights reserved. */
  14. ##/* To any person (the "Recipient") obtaining a copy of this software and */
  15. ##/* associated documentation files (the "Software"): */
  16. ##/* */
  17. ##/* All information contained in or disclosed by this software is confidential */
  18. ##/* and proprietary information of Elear Solutions Tech Private Limited and all */
  19. ##/* rights therein are expressly reserved. By accepting this material the */
  20. ##/* recipient agrees that this material and the information contained therein is */
  21. ##/* held in confidence and in trust and will NOT be used, copied, modified, */
  22. ##/* merged, published, distributed, sublicensed, reproduced in whole or in part, */
  23. ##/* nor its contents revealed in any manner to others without the express */
  24. ##/* written permission of Elear Solutions Tech Private Limited. */
  25. ##/*===============================================================================*/
  26. ANDROID_TOOLCHAINS_DIR="/opt/elear-solutions"
  27. declare -a COMPILE_ARCHITECTURES=("armv7" "arm64" "x86" "x86_64")
  28. for ARCH in "${COMPILE_ARCHITECTURES[@]}"
  29. do
  30. make distclean
  31. autoreconf -fsi
  32. ANDROID_TOOLCHAIN_DIR=""
  33. COMPILER_PREFIX=""
  34. case ${ARCH} in
  35. "armv7" )
  36. ANDROID_TOOLCHAIN_DIR="toolchain_armeabi_v7a_19"
  37. COMPILER_PREFIX="arm-linux-androideabi"
  38. ;;
  39. "arm64" )
  40. ANDROID_TOOLCHAIN_DIR="toolchain_aarch64_v8a_21"
  41. COMPILER_PREFIX="aarch64-linux-android"
  42. ;;
  43. "x86" )
  44. ANDROID_TOOLCHAIN_DIR="toolchain_x86_19"
  45. COMPILER_PREFIX="i686-linux-android"
  46. ;;
  47. "x86_64" )
  48. ANDROID_TOOLCHAIN_DIR="toolchain_x86_64_21"
  49. COMPILER_PREFIX="x86_64-linux-android"
  50. ;;
  51. esac
  52. export ANDROID_TOOLCHAIN_ROOT="${ANDROID_TOOLCHAINS_DIR}/${ANDROID_TOOLCHAIN_DIR}"
  53. ANDROID_TOOLCHAIN_BIN="${ANDROID_TOOLCHAIN_ROOT}/bin"
  54. ANDROID_TOOLCHAIN_SYSROOT_DIR="${ANDROID_TOOLCHAIN_ROOT}/sysroot"
  55. ANDROID_TOOLCHAIN_LD_LIB="${ANDROID_TOOLCHAIN_SYSROOT_DIR}/usr/lib"
  56. export CFLAGS="--sysroot=${ANDROID_TOOLCHAIN_SYSROOT_DIR}"
  57. export CXXFLAGS="--sysroot=${ANDROID_TOOLCHAIN_SYSROOT_DIR}"
  58. export LDFLAGS="-L${ANDROID_TOOLCHAIN_ROOT}/${COMPILER_PREFIX}/lib"
  59. export CC=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-clang
  60. # export CPP=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-cpp
  61. export CXX=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-clang++
  62. export LD=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ld
  63. export AR=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ar
  64. export RANLIB=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ranlib
  65. export STRIP=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-strip
  66. echo "---- Compiling for ${ARCH}"
  67. ./configure --host="${COMPILER_PREFIX}" --prefix="${ANDROID_TOOLCHAIN_SYSROOT_DIR}/usr" CFLAGS="-fPIC"
  68. make
  69. make install
  70. done