Ignore:
Timestamp:
Aug 5, 2015 4:26:06 AM (9 years ago)
Author:
nanang
Message:

Re #1870: Fixed 64 bit arch issues on Android: pool alignment, updated suffix in lib file naming.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/configure-android

    r5126 r5145  
    3333fi 
    3434 
    35 if test "x${ANDROID_NDK_ROOT}" = "x"; then 
    36   echo "$F error: ANDROID_NDK_ROOT must be specified" 
     35if test "x${ANDROID_NDK_ROOT}" = "x" || test ! -e ${ANDROID_NDK_ROOT}; then 
     36  echo "$F error: ANDROID_NDK_ROOT env var is not specified or invalid" 
    3737  exit 0 
    38 fi 
    39  
    40 #if test "$1" = "--simulator"; then 
    41 if test "1" = "0"; then 
    42   shift 
    43   TARGET_HOST="i686-android-linux" 
    44   TC_DIR="x86" 
    45 else 
    46   TARGET_HOST="arm-linux-androideabi" 
    47   TC_DIR=${TARGET_HOST} 
    4838fi 
    4939 
     
    6353else 
    6454    USR_LIB="/usr/lib" 
    65 fi  
     55fi 
     56 
    6657 
    6758if test "$1" = "--use-ndk-cflags"; then 
     
    7162    IGNORE_CFLAGS="\-M\|\-f*stack\|\-f*alias" 
    7263  fi 
    73   for i in `${ANDROID_NDK_ROOT}/ndk-build -n -C ${ANDROID_NDK_ROOT}/samples/hello-jni NDK_TOOLCHAIN_VERSION=4.8 NDK_LOG=1 APP_PLATFORM=${APP_PLATFORM} APP_ABI=${TARGET_ABI}`; do 
     64 
     65  NDK_OUT=`${ANDROID_NDK_ROOT}/ndk-build -n -C ${ANDROID_NDK_ROOT}/samples/hello-jni NDK_TOOLCHAIN_VERSION=4.8 APP_PLATFORM=${APP_PLATFORM} APP_ABI=${TARGET_ABI}` 
     66  if test ! "${NDK_OUT}"; then 
     67    echo "$F error: failed to run ndk-build, check ANDROID_NDK_ROOT env var" 
     68    exit 1 
     69  fi 
     70 
     71  for i in $NDK_OUT; do 
    7472    if test "x${NDK_CXX}" != "x" -a "$i" = "-o"; then break; fi 
    7573 
     
    10199  done 
    102100 
     101  # Get target host from NDK toolchain dir name 
     102  TARGET_HOST=`echo ${NDK_CC} | sed -e 's/.*\/toolchains\/\([^\/]*\).*/\1/'` 
     103   
     104  # Remove version number suffix (otherwise config.sub will return error, perhaps it just doesn't like the format) 
     105  TARGET_HOST=`echo ${TARGET_HOST} | sed -e 's/\-[0-9\.]*$//'` 
     106 
     107  # Make sure target host string has 'linux-android' in it 
     108  if test "x`echo ${TARGET_HOST} | grep 'linux-android'`" = "x"; then 
     109    #TARGET_HOST=`echo ${TARGET_HOST} | sed -e 's/\(.*\)\-\([0-9\.]*\)/\1-linux-android-\2/'` 
     110    TARGET_HOST+=-linux-android 
     111  fi 
     112 
    103113  export CC="${NDK_CC}" 
    104114  export CXX="${NDK_CXX}" 
     
    114124else 
    115125 
    116   ANDROID_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/toolchains/${TC_DIR}-* | sed 's/clang/0/' | sort -gr | head -1` 
     126  if test "$TARGET_ABI" != "armeabi"; then 
     127    echo "$F error: For targets other than 'armeabi', specify --use-ndk-cflags" 
     128    exit 1 
     129  fi 
     130   
     131  TARGET_HOST="arm-linux-androideabi" 
     132   
     133  ANDROID_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/toolchains/${TARGET_HOST}-* | sed 's/clang/0/' | sort -gr | head -1` 
    117134  ANDROID_TC=`ls -d ${ANDROID_TC_VER}/prebuilt/* | grep -v gdbserver | head -1` 
    118135  if test ! -d ${ANDROID_TC}; then 
     
    140157fi 
    141158 
     159if test "x${CC}" = "x" || test ! -e ${CC}; then 
     160  echo "$F error: compiler not found, please check environment settings (TARGET_ABI, etc)" 
     161  exit 1 
     162fi 
     163 
    142164# C++ STL 
    143165# Note: STL for pjsua2 sample app is specified in pjsip-apps/src/swig/java/android/jni/Application.mk 
     
    151173# stlport 
    152174#STDCPP_CFLAGS="-I${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/stlport" 
    153 #STDCPP_LIBS="${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o -lstlport_static -ldl" 
     175#STDCPP_LIBS="${ANDROID_SYSROOT}${USR_LIB}/crtbegin_so.o -lstlport_static -ldl" 
    154176#STDCPP_LDFLAGS="-L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/${TARGET_ABI}" 
    155177 
     
    169191  echo " AR = ${AR}" 
    170192  echo " RANLIB = ${RANLIB}" 
     193  echo " TARGET_HOST = ${TARGET_HOST}" 
    171194fi 
    172195 
Note: See TracChangeset for help on using the changeset viewer.