Browse Source

add the right base build folder

pull/866/head
Elear Solutions Dev 7 years ago
parent
commit
8edd9a381f
1 changed files with 57 additions and 50 deletions
  1. +57
    -50
      aconfigure.sh

+ 57
- 50
aconfigure.sh View File

@@ -1,72 +1,79 @@
ANDROID_NDK_DIR=/opt/elear-solutions
LIBICONV_INSTALL_DIR=/opt/elear-solutions/android
#! /usr/bin/env bash

## *****************************************************************************
##
## Description : aconfigure is a script used for compiling autotools projects
## for android.
##
## Prerequisites:
## 1. Setup android toolchains using README.md present in
## cocosdk-java/jni
##
## *****************************************************************************
##/*===============================================================================*/
##/* Copyright (c) 2018 Elear Solutions Tech Private Limited. All rights reserved. */
##/* To any person (the "Recipient") obtaining a copy of this software and */
##/* associated documentation files (the "Software"): */
##/* */
##/* All information contained in or disclosed by this software is confidential */
##/* and proprietary information of Elear Solutions Tech Private Limited and all */
##/* rights therein are expressly reserved. By accepting this material the */
##/* recipient agrees that this material and the information contained therein is */
##/* held in confidence and in trust and will NOT be used, copied, modified, */
##/* merged, published, distributed, sublicensed, reproduced in whole or in part, */
##/* nor its contents revealed in any manner to others without the express */
##/* written permission of Elear Solutions Tech Private Limited. */
##/*===============================================================================*/

ANDROID_TOOLCHAINS_DIR="/opt/elear-solutions"

declare -a COMPILE_ARCHITECTURES=("armv7" "arm64" "x86" "x86_64")
SAVED_PATH="${PATH}"
for ARCH in "${COMPILE_ARCHITECTURES[@]}"
do
make distclean
autoreconf -i
COMPILER_DIR=""
autoreconf -fsi
ANDROID_TOOLCHAIN_DIR=""
COMPILER_PREFIX=""
case ${ARCH} in
"armv7" )
COMPILER_DIR=toolchain_armeabi_v7a_19
ANDROID_TOOLCHAIN_DIR="toolchain_armeabi_v7a_19"
COMPILER_PREFIX="arm-linux-androideabi"
;;
"arm64" )
COMPILER_DIR=toolchain_aarch64_v8a_21
ANDROID_TOOLCHAIN_DIR="toolchain_aarch64_v8a_21"
COMPILER_PREFIX="aarch64-linux-android"
;;
"x86" )
COMPILER_DIR=toolchain_x86_19
ANDROID_TOOLCHAIN_DIR="toolchain_x86_19"
COMPILER_PREFIX="i686-linux-android"
;;
"x86_64" )
COMPILER_DIR=toolchain_x86_64_21
"x86_64" )
ANDROID_TOOLCHAIN_DIR="toolchain_x86_64_21"
COMPILER_PREFIX="x86_64-linux-android"
;;
esac

export ANDROID_NDK_ROOT="${ANDROID_NDK_DIR}/${COMPILER_DIR}"

ANDROID_NDK_BIN="${ANDROID_NDK_ROOT}/bin"
ANDROID_SYSROOT_DIR="${ANDROID_NDK_ROOT}/sysroot"

export PATH="${ANDROID_NDK_BIN}:${SAVED_PATH}"

export CFLAGS="--sysroot=${ANDROID_SYSROOT_DIR}"
export CXXFLAGS="--sysroot=${ANDROID_SYSROOT_DIR}"
case ${ARCH} in
"armv7" )
ABI_NAME=armv7
COMPILER_PREFIX=arm-linux-androideabi
;;
"arm64" )
ABI_NAME=arm64
COMPILER_PREFIX=aarch64-linux-android
;;
"x86" )
ABI_NAME=x86
COMPILER_PREFIX=i686-linux-android
;;
"x86_64" )
ABI_NAME=x86_64
COMPILER_PREFIX=x86_64-linux-android
;;
export ANDROID_TOOLCHAIN_ROOT="${ANDROID_TOOLCHAINS_DIR}/${ANDROID_TOOLCHAIN_DIR}"

ANDROID_TOOLCHAIN_BIN="${ANDROID_TOOLCHAIN_ROOT}/bin"
ANDROID_TOOLCHAIN_SYSROOT_DIR="${ANDROID_TOOLCHAIN_ROOT}/sysroot"
ANDROID_TOOLCHAIN_LD_LIB="${ANDROID_TOOLCHAIN_SYSROOT_DIR}/usr/lib"

esac

export CFLAGS="--sysroot=${ANDROID_TOOLCHAIN_SYSROOT_DIR}"
export CXXFLAGS="--sysroot=${ANDROID_TOOLCHAIN_SYSROOT_DIR}"
export LDFLAGS="-L${ANDROID_TOOLCHAIN_ROOT}/${COMPILER_PREFIX}/lib"

export CC=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-clang
export CPP=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-cpp
export CXX=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-clang++
export LD=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ld
export AR=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ar
export RANLIB=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ranlib
export STRIP=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-strip
export CC=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-clang
export CPP=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-cpp
export CXX=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-clang++
export LD=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ld
export AR=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ar
export RANLIB=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-ranlib
export STRIP=${ANDROID_TOOLCHAIN_BIN}/${COMPILER_PREFIX}-strip

echo "---- Compiling for ${ARCH}"
./configure --host="${COMPILER_PREFIX}" --prefix="${LIBICONV_INSTALL_DIR}/${ABI_NAME}"
make clean
make install
echo "---- Compiling for ${ARCH}"
./configure --host="${COMPILER_PREFIX}" --prefix="${ANDROID_TOOLCHAIN_SYSROOT_DIR}/usr"
make
make install
done

export PATH="${SAVED_PATH}"

Loading…
Cancel
Save