====== NDK Shell for Linux/Cygwin(Windows) ====== 自己简单封装了一下ndk-build 支持: - 通过修改build-static-library.mk,可以生成静态库 - 直接解析Android.mk,支持设置安装目录,支持自动拷贝依赖的静态库 - 添加了系统检测,同时支持Linux和Cygwin(Windows)环境。 使用方法 - 和以前一样,只是直接调用脚本名字ndk。 - 支持原来ndk-build参数,如:ndk clean,ndk -h等。 update note: - 解决了Windows下make.exe和Symbian编译环境的冲突 - 同时支持了Linux和Cygwin(Windows)环境下编译 #!/bin/sh #Your Android.mk Maybe need to add INSTALL_DIR and MY_STATIC_LIBRARIES. #Now it just support parse these variables: # INSTALL_DIR =>Where you want to install the static library. # MY_STATIC_LIBRARIES =>Some dependent static libraries,with the full path or relative path. #NOTICE: #1.This shell just support parse MY_STATIC_LIBRARIES like this: # MY_STATIC_LIBRARIES = ../libafc.a # MY_STATIC_LIBRARIES = ../libutf8.a #2.If you need to run this shell,you must cd to the RIGHT directory #You MUST see ./${ANDROID_MK},then this shell will run,otherwise it will exit. #Author:pengjianqing@gmail.com #Date:20101126 START_AT=`date` INSTALL_DIR="INSTALL_DIR" MY_STATIC_LIBRARIES="MY_STATIC_LIBRARIES" ANDROID_MK="jni/Android.mk" CREATED_LIBRARIES_DIR="libs/armeabi" #help() #{ # cat <>${build_static_library_mk}" echo ${TO_BE_APPEND} >>${build_static_library_mk} fi fi echo "Check the environment...SUCCESS" } #if it is ndk-build -h,just print the help and exit. echo ${1} #A=`grep "^-" "${1}"` if [ "${1}" = "-h" ];then ndk-build ${1} exit 0 fi #Check the environment. check_env #check whether it is ndk-build clean,and exit. clean $1 #Prepare the Needed StaticLibraries if need. prepareStaticLibraries n="${#}" #echo parameters number = ${n} case $# in 0) ndk-build;; 1) ndk-build ${1};; 2) ndk-build ${1} ${2};; 3) ndk-build ${1} ${2} ${3};; *) break;; esac #Install the built library. installLibraries #Print the start time and finish time. printTime