Advertisement
Guest User

Untitled

a guest
Feb 8th, 2012
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #!/bin/sh
  2. # This script should be called by create-android-project.bat
  3. # or should be runned in linux shell. It can not be runned under
  4. # cygwin.
  5. # Don't modify the script until you know what you do.
  6.  
  7. # set environment paramters
  8. NDK_ROOT_LOCAL="/home/android/android-ndk-r7"
  9. ANDROID_SDK_ROOT_LOCAL="/home/Android/android-sdk"
  10.  
  11. # try to get global variable
  12. if [ $NDK_ROOT"aaa" != "aaa" ]; then
  13. echo "use global definition of NDK_ROOT: $NDK_ROOT"
  14. NDK_ROOT_LOCAL=$NDK_ROOT
  15. fi
  16.  
  17. if [ $ANDROID_SDK_ROOT"aaa" != "aaa" ]; then
  18. echo "use global definition of ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
  19. ANDROID_SDK_ROOT_LOCAL=$ANDROID_SDK_ROOT
  20. fi
  21.  
  22. # check if it was called by .bat file
  23. if [ $# -eq 5 ];then
  24. if [ $5 = "windows" ];then
  25. # called by .bat file
  26. sh $1/template/android/copy_files.sh $1 $2 $3 $4
  27. exit
  28. fi
  29. fi
  30.  
  31.  
  32. # the bash file should not be called by cygwin
  33. KERNEL_NAME=`uname -s | grep "CYGWIN*"`
  34. if [ $KERNEL_NAME"hi" != "hi" ]; then
  35. echo "Error!!!"
  36. echo "Don't run in cygwin. You should run corresponding bat."
  37. exit
  38. fi
  39.  
  40. # ok, it was run under linux
  41.  
  42. # check it was runned in cocos2d-x root
  43. check_path(){
  44. if [ ! -f create-android-project.sh ];then
  45. echo Error!!!
  46. echo Please run in cocos2dx root
  47. exit
  48. fi
  49. }
  50.  
  51. create_android_project(){
  52. echo "Input package path. For example: org.cocos2dx.example"
  53. read PACKAGE_PATH
  54. echo "Now cocos2d-x supports Android 2.1-update1, 2.2, 2.3 & 3.0"
  55. echo "Other versions have not tested."
  56. $ANDROID_SDK_ROOT_LOCAL/tools/android list targets
  57. echo "input target id:"
  58. read TARGET_ID
  59. echo "input your project name:"
  60. read PROJECT_NAME
  61. PROJECT_DIR=`pwd`/$PROJECT_NAME
  62.  
  63. # check if PROJECT_DIR is exist
  64. if [ -d $PROJECT_DIR ]; then
  65. echo "$PROJECT_DIR is exist, please use another name"
  66. exit
  67. fi
  68.  
  69. $ANDROID_SDK_ROOT_LOCAL/tools/android create project -n $PROJECT_NAME -t $TARGET_ID -k $PACKAGE_PATH -a $PROJECT_NAME -p $PROJECT_DIR
  70. }
  71.  
  72. check_path
  73. create_android_project
  74.  
  75. if [ $# -eq 1 ]; then
  76. # invoked by create-linux-android-project.sh
  77. sh `pwd`/template/linux/mycopy_files.sh `pwd` $PROJECT_NAME $NDK_ROOT_LOCAL $PACKAGE_PATH
  78. else
  79. # invoke template/android/copy_files.sh
  80. sh `pwd`/template/android/copy_files.sh `pwd` $PROJECT_NAME $NDK_ROOT_LOCAL $PACKAGE_PATH
  81. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement