- Timestamp:
- Feb 11, 2019 3:43:51 AM (6 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/configure-android
r5666 r5932 3 3 4 4 F="configure-android" 5 IS_USING_LLVM="0" 5 6 6 7 if test "$*" = "--help" -o "$*" = "-h"; then … … 38 39 fi 39 40 41 NDK_VER=`sed -n -e 's/.*Pkg.Revision *= *\([0-9]\+\).*/\1/p' ${ANDROID_NDK_ROOT}/source.properties` 42 40 43 if test "x$APP_PLATFORM" = "x"; then 41 44 APP_PLATFORM=`ls ${ANDROID_NDK_ROOT}/platforms/ | sed 's/android-//' | sort -gr | head -1` … … 45 48 46 49 if test "x$TARGET_ABI" = "x"; then 47 TARGET_ABI="armeabi" 50 # armeabi was removed since NDK r17 51 if [ "${NDK_VER}" -ge "17" ]; then 52 TARGET_ABI="armeabi-v7a" 53 else 54 TARGET_ABI="armeabi" 55 fi 48 56 echo "$F: TARGET_ABI not specified, using ${TARGET_ABI}" 49 57 fi … … 56 64 57 65 58 if test "$1" = "--use-ndk-cflags"; then 59 shift 60 ADD_CFLAGS="1" 66 if test "$1" = "--use-ndk-cflags" || [ "${NDK_VER}" -ge "17" ]; then 67 if test "$1" = "--use-ndk-cflags"; then 68 shift # don't pass this param to main configure script 69 fi 70 71 ADD_CFLAGS="0" 72 ADD_CXXFLAGS="0" 61 73 ADD_NDK_TOOLCHAIN="0" 62 74 ADD_NDK_TARGET="0" … … 77 89 fi 78 90 79 #echo "====="80 #echo "NDK_OUT : ${NDK_OUT}"81 #echo "====="91 echo "=====" 92 echo "NDK_OUT : ${NDK_OUT}" 93 echo "=====" 82 94 83 95 for i in $NDK_OUT; do 84 if test "x${NDK_CXX}" != "x" -a "$i" = "-o"; then break; fi85 96 86 97 # Parse NDK CXXFLAGS 87 if test "x${NDK_CXX}" != "x" -a "x`echo $i|grep 'dummy'`" = "x"; then 98 if test "${ADD_CXXFLAGS}" = "1"; then 99 if test "$i" = "-o"; then 100 ADD_CXXFLAGS="0" 101 continue 102 fi 103 if test "x`echo $i|grep 'dummy'`" != "x"; then 104 continue 105 fi 88 106 if test "x`echo $i|grep '\-\-sysroot='`" != "x"; then 89 107 ANDROID_SYSROOT=`echo $i|sed 's/--sysroot=//'`; 90 108 fi 91 109 NDK_CXXFLAGS="${NDK_CXXFLAGS} $i" 92 fi 110 continue 111 fi 112 93 113 # Parse NDK CFLAGS 94 if test "x${NDK_CC}" != "x" -a "x`echo $i|grep 'dummy'`" = "x" -a "${ADD_CFLAGS}" = "1"; then 95 if test "$i" = "-c"; then ADD_CFLAGS="0"; else 96 if test "x`echo $i|grep ${IGNORE_CFLAGS}`" = "x"; then 114 if test "${ADD_CFLAGS}" = "1"; then 115 if test "$i" = "-c"; then 116 ADD_CFLAGS="0" 117 continue 118 fi 119 if test "x`echo $i|grep 'dummy'`" != "x"; then 120 continue 121 fi 122 if test "x`echo $i|grep ${IGNORE_CFLAGS}`" = "x"; then 97 123 if test "${ADD_NDK_TOOLCHAIN}" = "0" -a "x`echo $i|grep '\-gcc-toolchain'`" != "x"; then 98 124 ADD_NDK_TOOLCHAIN="1" … … 107 133 fi 108 134 NDK_CFLAGS="${NDK_CFLAGS} $i" 109 fi 110 fi 111 fi 112 # Find gcc or clang toolchain 135 fi 136 continue 137 fi 138 139 # Find gcc or clang 113 140 if test "x${NDK_CC}" = "x"; then 114 141 if test "x`echo $i | grep 'gcc'`" != "x" -o "x`echo $i | grep 'clang'`" != "x"; then 115 142 NDK_CC=$i 116 fi 117 fi 118 # Find g++ toolchain 119 if test "x`echo $i | grep 'g++'`" != "x"; then 120 NDK_CXX=$i 143 ADD_CFLAGS="1" 144 if test "x`echo ${NDK_CC} | grep 'clang'`" != "x"; then 145 IS_USING_LLVM="1" 146 #echo "---using llvm" 147 fi 148 fi 149 fi 150 151 # Find g++ or clang++ 152 if test "x${NDK_CXX}" = "x"; then 153 if test "x`echo $i | grep 'g++'`" != "x"; then 154 NDK_CXX=$i 155 ADD_CXXFLAGS="1" 156 fi 157 fi 158 159 # Find ar tool 160 if test "x${NDK_AR}" = "x" -a "x${NDK_CC}" != "x" -a "x`echo $i|grep '\-ar'`" != "x"; then 161 if test "$(dirname \"${NDK_CC}\")" = "$(dirname \"${i}\")"; then 162 NDK_AR=$i 163 #echo "--- found AR=${NDK_AR}" 164 fi 165 fi 166 167 # Find ranlib tool 168 if test "x${NDK_RANLIB}" = "x" -a "x${NDK_CC}" != "x" -a "x`echo $i|grep '\-ranlib'`" != "x"; then 169 if test "$(dirname \"${NDK_CC}\")" = "$(dirname \"${i}\")"; then 170 NDK_RANLIB=$i 171 #echo "--- found RANLIB=${NDK_RANLIB}" 172 fi 121 173 fi 122 174 done 123 124 echo "NDK_CC : ${NDK_CC}"125 175 126 176 # Get target host from NDK toolchain dir name … … 130 180 TARGET_HOST=`echo ${TARGET_HOST} | sed -e 's/\-[0-9\.]*$//'` 131 181 182 # Get target from '-target' param when TARGET_HOST is 'llvm' 183 if test "$TARGET_HOST" = "llvm"; then 184 TARGET_HOST=`echo ${NDK_CFLAGS} | sed -e 's/.*-target \([^- ]*\).*/\1/'` 185 fi 186 132 187 # Make sure target host string has 'linux-android' in it 133 188 if test "x`echo ${TARGET_HOST} | grep 'linux-android'`" = "x"; then … … 138 193 # Set the binutils 139 194 if test "x${NDK_TOOLCHAIN}" = "x"; then 140 export AR=`echo ${NDK_CXX}|sed 's/-g++/-ar/'`; 141 export RANLIB=`echo ${NDK_CXX}|sed 's/-g++/-ranlib/'`; 195 if test "x${NDK_AR}" = "x"; then 196 NDK_CC_DIR=$(dirname "${NDK_CC}") 197 NDK_AR=`find ${NDK_CC_DIR} -name "*ar" | grep -m 1 -v "gcc"` 198 fi 142 199 export LDFLAGS="${LDFLAGS} --sysroot=${ANDROID_SYSROOT}" 143 200 else 144 201 # find ar and ranlib 145 TC_AR=`find ${NDK_TOOLCHAIN}/bin/ -name "*-ar" | grep -v "gcc"` 146 TC_RANLIB=`find ${NDK_TOOLCHAIN}/bin/ -name "*-ranlib" | grep -v "gcc"` 147 if test "x${TC_AR}" != "x" -a "x${TC_RANLIB}" != "x"; then 148 export AR=$TC_AR 149 export RANLIB=$TC_RANLIB 150 fi 151 TARGET_HOST="arm-linux-androideabi" 202 if test "x${NDK_AR}" = "x"; then 203 NDK_AR=`find ${NDK_TOOLCHAIN}/bin/ -name "*-ar" | grep -m 1 -v "gcc"` 204 fi 205 if test "x${NDK_RANLIB}" = "x"; then 206 NDK_RANLIB=`find ${NDK_TOOLCHAIN}/bin/ -name "*-ranlib" | grep -m 1 -v "gcc"` 207 fi 152 208 export LDFLAGS="${LDFLAGS} --sysroot=${ANDROID_SYSROOT} -target ${NDK_TARGET} -gcc-toolchain ${NDK_TOOLCHAIN}" 153 fi 209 fi 210 211 if test "x${NDK_RANLIB}" = "x"; then 212 NDK_RANLIB="${NDK_AR} s" 213 fi 214 215 TC_AR=${NDK_AR} 216 TC_RANLIB=${NDK_RANLIB} 217 if test "x${TC_AR}" != "x" -a "x${TC_RANLIB}" != "x"; then 218 export AR="${TC_AR}" 219 export RANLIB="${TC_RANLIB}" 220 fi 154 221 155 222 export TARGET_ABI="${TARGET_ABI}" … … 206 273 # Note: STL for pjsua2 sample app is specified in pjsip-apps/src/swig/java/android/jni/Application.mk 207 274 208 if test "x${NDK_TOOLCHAIN}" = "x"; then 275 if test "${IS_USING_LLVM}" = "1"; then 276 # llvm 277 STDCPP_TC="${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++" 278 STDCPP_CFLAGS="-I${STDCPP_TC}/include" 279 STDCPP_LIBS="-lc++_static -lc++abi" 280 STDCPP_LDFLAGS="-L${STDCPP_TC}/libs/${TARGET_ABI}/" 281 else 209 282 # gnustl 210 283 STDCPP_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/[0-9]* | sort -gr | head -1` … … 212 285 STDCPP_LIBS="-lgnustl_static" 213 286 STDCPP_LDFLAGS="-L${STDCPP_TC_VER}/libs/${TARGET_ABI}/" 214 else215 # llvm216 STDCPP_TC="${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++"217 STDCPP_CFLAGS="-I${STDCPP_TC}/include"218 STDCPP_LIBS="-lc++_static -lc++abi"219 STDCPP_LDFLAGS="-L${STDCPP_TC}/libs/${TARGET_ABI}/"220 287 fi 221 288 … … 232 299 if test "1" = "1"; then 233 300 echo "$F: calling ./configure with env vars:" 301 echo " NDK_TOOLCHAIN = ${NDK_TOOLCHAIN}" 234 302 echo " CC = ${CC}" 235 303 echo " CXX = ${CXX}" -
pjproject/trunk/pjsip-apps/src/samples/android_sample/jni/Android.mk
r5409 r5932 3 3 include $(CLEAR_VARS) 4 4 5 LOCAL_MODULE := dummy 5 LOCAL_MODULE := dummy_static 6 LOCAL_SRC_FILES := dummy.c 7 8 include $(BUILD_STATIC_LIBRARY) 9 10 include $(CLEAR_VARS) 11 LOCAL_MODULE := dummy_shared 12 LOCAL_STATIC_LIBRARIES := dummy_static 6 13 LOCAL_SRC_FILES := dummy.c 7 14
Note: See TracChangeset
for help on using the changeset viewer.