Changeset 4594
- Timestamp:
- Sep 9, 2013 5:53:58 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/configure-android
r4435 r4594 17 17 echo " ANDROID_NDK_ROOT Specify the directory of Android NDK to use." 18 18 echo " APP_PLATFORM Optionally specify the platform level used, e.g." 19 echo " android-8. By default, configure will use the maximum" 20 echo " platform level detected." 21 echo " TARGET_ABI Optionally specify a single target architecture, e.g." 22 echo " armeabi-v7a. By default, the target architecture is" 23 echo " armeabi." 19 echo " android-9. By default, configure will use the" 20 echo " maximum platform level detected." 21 echo " TARGET_ABI Optionally specify a single target architecture," 22 echo " e.g. armeabi-v7a, mips, x86. By default, the target" 23 echo " architecture is armeabi. Only used when" 24 echo " --use-ndk-cflags is specified." 24 25 echo "" 25 26 exit 0 … … 54 55 if test "$1" = "--use-ndk-cflags"; then 55 56 shift 57 ADD_CFLAGS="1" 56 58 for i in `${ANDROID_NDK_ROOT}/ndk-build -n -C ${ANDROID_NDK_ROOT}/samples/hello-jni NDK_LOG=1 APP_PLATFORM=${APP_PLATFORM} APP_ABI=${TARGET_ABI}`; do 57 if test "$i" = "-c"; then break; fi 58 if test "x${NDK_CC}" != "x" -a "$i" != "-MF" -a "x`echo $i|grep '\.o\.d'`" = "x" -a "x`echo $i|grep 'include'`" = "x"; then 59 NDK_CFLAGS="${NDK_CFLAGS} $i" 59 if test "x${NDK_CXX}" != "x" -a "$i" = "-o"; then break; fi 60 61 # Parse NDK CXXFLAGS 62 if test "x${NDK_CXX}" != "x" -a "x`echo $i|grep 'hello-jni'`" = "x"; then 63 if test "x`echo $i|grep '\-\-sysroot='`" != "x"; then 64 ANDROID_SYSROOT=`echo $i|sed 's/--sysroot=//'`; 65 fi 66 NDK_CXXFLAGS="${NDK_CXXFLAGS} $i" 60 67 fi 61 if test "x`echo $i | grep 'gcc'`" != "x"; then 68 69 # Parse NDK CFLAGS 70 if test "x${NDK_CC}" != "x" -a "x`echo $i|grep 'hello-jni'`" = "x" -a "x`echo $i|grep '\-M'`" = "x" -a "${ADD_CFLAGS}" = "1"; then 71 if test "$i" = "-c"; then ADD_CFLAGS="0"; else 72 NDK_CFLAGS="${NDK_CFLAGS} $i" 73 fi 74 fi 75 76 # Find gcc toolchain 77 if test "x${NDK_CC}" = "x" -a "x`echo $i | grep 'gcc'`" != "x"; then 62 78 NDK_CC=$i 63 79 fi 80 # Find g++ toolchain 81 if test "x`echo $i | grep 'g++'`" != "x"; then 82 NDK_CXX=$i 83 fi 64 84 done 85 86 export CC="${NDK_CC}" 87 export CXX="${NDK_CXX}" 88 89 export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/" 90 export LIBS="${LIBS} -lc -lgcc" 65 91 export CFLAGS="${CFLAGS} ${NDK_CFLAGS}" 92 export CPPFLAGS="${CFLAGS}" 93 export CXXFLAGS="${NDK_CXXFLAGS}" 94 95 else 96 97 ANDROID_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/toolchains/${TC_DIR}-* | sed 's/clang/0/' | sort -gr | head -1` 98 ANDROID_TC=`ls -d ${ANDROID_TC_VER}/prebuilt/*` 99 if test ! -d ${ANDROID_TC}; then 100 echo "$F error: unable to find directory ${ANDROID_TC} in Android NDK" 101 exit 1 102 fi 103 104 export ANDROID_SYSROOT="${ANDROID_NDK_ROOT}/platforms/${APP_PLATFORM}/arch-arm" 105 if test ! -d ${ANDROID_SYSROOT}; then 106 echo "$F error: unable to find sysroot dir ${ANDROID_SYSROOT} in Android NDK" 107 exit 1 108 fi 109 110 export CC="${ANDROID_TC}/bin/${TARGET_HOST}-gcc" 111 export CXX="${ANDROID_TC}/bin/${TARGET_HOST}-g++" 112 113 export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/" 114 export LIBS="${LIBS} -lc -lgcc" 115 export CFLAGS="${CFLAGS} -I${ANDROID_SYSROOT}/usr/include" 116 export CPPFLAGS="${CFLAGS}" 117 export CXXFLAGS="${CXXFLAGS} -shared --sysroot=${ANDROID_SYSROOT}" 118 66 119 fi 67 68 HOST_OS=$(uname -s)69 case $HOST_OS in70 Darwin) BUILD_MACHINE="darwin-x86";;71 Linux) BUILD_MACHINE="linux-x86";;72 CYGWIN*|*_NT-*) BUILD_MACHINE="windows";;73 esac74 75 ANDROID_TC="${ANDROID_NDK_ROOT}/toolchains/${TC_DIR}-4.4.3/prebuilt/${BUILD_MACHINE}"76 if test ! -d ${ANDROID_TC}; then77 echo "$F error: unable to find directory ${ANDROID_TC} in Android NDK"78 exit 179 fi80 81 export ANDROID_SYSROOT="${ANDROID_NDK_ROOT}/platforms/${APP_PLATFORM}/arch-arm"82 if test ! -d ${ANDROID_SYSROOT}; then83 echo "$F error: unable to find sysroot dir ${ANDROID_SYSROOT} in Android NDK"84 exit 185 fi86 87 export CC="${ANDROID_TC}/bin/${TARGET_HOST}-gcc"88 export CXX="${ANDROID_TC}/bin/${TARGET_HOST}-g++"89 90 export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/"91 export LIBS="${LIBS} -lc -lgcc"92 export CFLAGS="${CFLAGS} -I${ANDROID_SYSROOT}/usr/include"93 export CPPFLAGS="${CFLAGS}"94 export CXXFLAGS="${CXXFLAGS} -shared --sysroot=${ANDROID_SYSROOT}"95 120 96 121 # Print settings
Note: See TracChangeset
for help on using the changeset viewer.