User Tools

Site Tools


android:android-jni:ndkbuild-shell-for-linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
android:android-jni:ndkbuild-shell-for-linux [2010/11/30 17:48] percyandroid:android-jni:ndkbuild-shell-for-linux [2016/05/05 13:07] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== NDK Shell for Linux ======+====== NDK Shell for Linux/Cygwin(Windows) ======
 自己简单封装了一下ndk-build 自己简单封装了一下ndk-build
  
Line 5: Line 5:
   - 通过修改build-static-library.mk,可以生成静态库   - 通过修改build-static-library.mk,可以生成静态库
   - 直接解析Android.mk,支持设置安装目录,支持自动拷贝依赖的静态库   - 直接解析Android.mk,支持设置安装目录,支持自动拷贝依赖的静态库
 +  - 添加了系统检测,同时支持Linux和Cygwin(Windows)环境。
  
 使用方法 使用方法
   - 和以前一样,只是直接调用脚本名字ndk。   - 和以前一样,只是直接调用脚本名字ndk。
   - 支持原来ndk-build参数,如:ndk clean,ndk -h等。   - 支持原来ndk-build参数,如:ndk clean,ndk -h等。
 +
 +update note:
 +  - 解决了Windows下make.exe和Symbian编译环境的冲突
 +  - 同时支持了Linux和Cygwin(Windows)环境下编译
  
 <file lang=shell ndk.sh> <file lang=shell ndk.sh>
Line 22: Line 27:
 # MY_STATIC_LIBRARIES = ../libutf8.a # MY_STATIC_LIBRARIES = ../libutf8.a
 #2.If you need to run this shell,you must cd to the RIGHT directory #2.If you need to run this shell,you must cd to the RIGHT directory
-#You MUST see ./jni/Android.mk,then this shell will run,otherwise it will exit.+#You MUST see ./${ANDROID_MK},then this shell will run,otherwise it will exit.
  
 #Author:pengjianqing@gmail.com #Author:pengjianqing@gmail.com
Line 29: Line 34:
 START_AT=`date` START_AT=`date`
  
-#Parsed list in Android.mk 
 INSTALL_DIR="INSTALL_DIR" INSTALL_DIR="INSTALL_DIR"
 MY_STATIC_LIBRARIES="MY_STATIC_LIBRARIES"  MY_STATIC_LIBRARIES="MY_STATIC_LIBRARIES" 
Line 36: Line 40:
  
 CREATED_LIBRARIES_DIR="libs/armeabi" CREATED_LIBRARIES_DIR="libs/armeabi"
 +
  
 #help() #help()
Line 57: Line 62:
     #echo LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES     #echo LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES
  
 +    HOST_OS=`uname -s`
     BIN_ARMEABI="obj/local/armeabi/"     BIN_ARMEABI="obj/local/armeabi/"
 +
 +    echo "HOST_OS=${HOST_OS}"
 +    #Check the OS,I find Linux and Cygwin has the different directory.
 +    if [ "${HOST_OS}" = "Linux" ];then
 +     BIN_ARMEABI="obj/local/armeabi/"
 +     #elif [ "${HOST_OS}" = "CYGWIN*|*_NT-*" ];then
 +    else
 +     BIN_ARMEABI="bin/ndk/local/armeabi/"
 +    fi
 +
     mkdir -p ${BIN_ARMEABI}     mkdir -p ${BIN_ARMEABI}
     STATIC_LIBRARIES=`grep ${MY_STATIC_LIBRARIES} ${ANDROID_MK}|grep -v ^#|cut -d "=" -f2|sed 's/ //g'`     STATIC_LIBRARIES=`grep ${MY_STATIC_LIBRARIES} ${ANDROID_MK}|grep -v ^#|cut -d "=" -f2|sed 's/ //g'`
Line 131: Line 147:
     else     else
  echo "Find ndk-build successfully,continue..."  echo "Find ndk-build successfully,continue..."
 + HOST_OS=`uname -s`
 + echo "HOST_OS=${HOST_OS}"
 + echo "PATH=${PATH}"
 + if [ "${HOST_OS}" = "Linux" ];then
 +     echo ""
 + else
 +     #In Windows,the make maybe occur conflicts with othe make tool,so set the PATH here.
 +     export PATH=/cygdrive/c/cygwin/bin:`dirname ${NDK_BUILD}`
 +     #echo "PATH=${PATH}"
 + fi
     fi     fi
     if [ ! -f ${ANDROID_MK} ];then     if [ ! -f ${ANDROID_MK} ];then
Line 192: Line 218:
 #Print the start time and finish time. #Print the start time and finish time.
 printTime printTime
- 
  
 </file> </file>
  
  
/var/www/dokuwiki/wiki/data/attic/android/android-jni/ndkbuild-shell-for-linux.1291110524.txt.gz · Last modified: 2016/05/05 13:06 (external edit)