Permalink
Browse files

fixed #982: android template works ok on linux

  • Loading branch information...
1 parent f642de4 commit 3fdc1adfa59d6541c7d851418d2fad8c09bfb890 @minggo minggo committed Feb 29, 2012
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# This script should be called by create-android-project.bat
# or should be runned in linux shell. It can not be runned under
# cygwin.
@@ -57,8 +57,8 @@ check_param(){
esac
done
- if [ $NEED_BOX2D == "true" ]; then
- if [ $NEED_CHIPMUNK == "true" ]; then
+ if [ $NEED_BOX2D = "true" ]; then
+ if [ $NEED_CHIPMUNK = "true" ]; then
echo Warning!!!
echo Use box2d and chipmunk together????
fi
@@ -122,7 +122,7 @@ PARAMS=$@
check_param
create_android_project
-if [ $0 == "linux" ]; then
+if [ $0 = "linux" ]; then
# invoked by create-linux-android-project.sh
sh `pwd`/template/linux/mycopy_files.sh `pwd` $PROJECT_NAME $NDK_ROOT_LOCAL $PACKAGE_PATH $NEED_BOX2D $NEED_CHIPMUNK $NEED_LUA
else
@@ -1,22 +1,24 @@
+#!/bin/bash
+
FILE=$1
NEED_BOX2D=$2
NEED_CHIPMUNK=$3
NEED_LUA=$4
APP_MODULES="APP_MODULES := cocos2dx_static cocosdenshion_shared"
-if [ $NEED_BOX2D == "true" ];then
- APP_MODULES+=" box2d_shared"
+if [ $NEED_BOX2D = "true" ];then
+ APP_MODULES=$APP_MODULES" box2d_shared"
fi
-if [ $NEED_CHIPMUNK == "true" ]; then
- APP_MODULES+=" chipmunk_shared"
+if [ $NEED_CHIPMUNK = "true" ]; then
+ APP_MODULES=$APP_MODULES" chipmunk_shared"
fi
-if [ $NEED_LUA == "true" ]; then
- APP_MODULES+=" lua_shared"
+if [ $NEED_LUA = "true" ]; then
+ APP_MODULES=$APP_MODULES" lua_shared"
fi
-APP_MODULES+=" game_shared"
+APP_MODULES=$APP_MODULES" game_shared"
cat > $FILE << EOF
APP_STL := gnustl_static
@@ -1,20 +1,22 @@
+#!/bin/bash
+
FILE=$1
NEED_BOX2D=$2
NEED_CHIPMUNK=$3
NEED_LUA=$4
LOCAL_SHARED_LIBRARIES="LOCAL_SHARED_LIBRARIES := cocosdenshion_shared"
-if [ $NEED_BOX2D == "true" ];then
- LOCAL_SHARED_LIBRARIES+=" box2d_shared"
+if [ $NEED_BOX2D = "true" ];then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" box2d_shared"
fi
-if [ $NEED_CHIPMUNK == "true" ]; then
- LOCAL_SHARED_LIBRARIES+=" chipmunk_shared"
+if [ $NEED_CHIPMUNK = "true" ]; then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" chipmunk_shared"
fi
-if [ $NEED_LUA == "true" ]; then
- LOCAL_SHARED_LIBRARIES+=" lua_shared"
+if [ $NEED_LUA = "true" ]; then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" lua_shared"
fi
cat > $FILE << EOF
@@ -43,4 +45,4 @@ include \$(BUILD_STATIC_LIBRARY)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libpng)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libxml2)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libjpeg)
-EOF
+EOF
@@ -1,3 +1,4 @@
+#!/bin/bash
# check the args
# $1: root of cocos2dx $2: app name $3: ndk root $4:pakcage path
@@ -90,16 +91,16 @@ modify_applicationdemo(){
# load need .so
CONTENT=
- if [ $NEED_BOX2D == "true" ];then
- CONTENT+='System.loadLibrary("box2d");'
+ if [ $NEED_BOX2D = "true" ];then
+ CONTENT=$CONTENT'System.loadLibrary("box2d");'
fi
- if [ $NEED_CHIPMUNK == "true" ]; then
- CONTENT+='System.loadLibrary("chipmunk");'
+ if [ $NEED_CHIPMUNK = "true" ]; then
+ CONTENT=$CONTENT'System.loadLibrary("chipmunk");'
fi
- if [ $NEED_LUA == "true" ]; then
- CONTENT+='System.loadLibrary("lua");'
+ if [ $NEED_LUA = "true" ]; then
+ CONTENT=$CONTENT'System.loadLibrary("lua");'
fi
sed -i "/cocosdenshion/ i\ $CONTENT" $APP_DIR/android/src/$PACKAGE_PATH_DIR/$APP_NAME.java
View
@@ -1,20 +1,22 @@
+#!/bin/bash
+
FILE=$1
NEED_BOX2D=$2
NEED_CHIPMUNK=$3
NEED_LUA=$4
LOCAL_SHARED_LIBRARIES="LOCAL_SHARED_LIBRARIES := cocosdenshion_shared"
-if [ $NEED_BOX2D == "true" ];then
- LOCAL_SHARED_LIBRARIES+=" box2d_shared"
+if [ $NEED_BOX2D = "true" ];then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" box2d_shared"
fi
-if [ $NEED_CHIPMUNK == "true" ]; then
- LOCAL_SHARED_LIBRARIES+=" chipmunk_shared"
+if [ $NEED_CHIPMUNK = "true" ]; then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" chipmunk_shared"
fi
-if [ $NEED_LUA == "true" ]; then
- LOCAL_SHARED_LIBRARIES+=" lua_shared"
+if [ $NEED_LUA = "true" ]; then
+ LOCAL_SHARED_LIBRARIES=$LOCAL_SHARED_LIBRARIES" lua_shared"
fi
cat > $FILE << EOF
@@ -43,4 +45,4 @@ include \$(BUILD_SHARED_LIBRARY)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libpng)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libxml2)
\$(call import-module,cocos2dx/platform/third_party/android/modules/libjpeg)
-EOF
+EOF
@@ -1,17 +1,19 @@
+#!/bin/bash
+
FILE=$1
NEED_BOX2D=$2
NEED_CHIPMUNK=$3
NEED_LUA=$4
-if [ $NEED_BOX2D == "true" ];then
+if [ $NEED_BOX2D = "true" ];then
BOX2D="Box2D"
fi
-if [ $NEED_CHIPMUNK == "true" ]; then
+if [ $NEED_CHIPMUNK = "true" ]; then
CHIPMUNK="chipmunk"
fi
-if [ $NEED_LUA == "true" ]; then
+if [ $NEED_LUA = "true" ]; then
LUA="lua/proj.android/jni"
fi
@@ -28,4 +30,4 @@ subdirs := \$(addprefix \$(LOCAL_PATH)/../../../,\$(addsuffix /Android.mk, \\
subdirs += \$(LOCAL_PATH)/../../Classes/Android.mk \$(LOCAL_PATH)/helloworld/Android.mk
include \$(subdirs)
-EOF
+EOF

0 comments on commit 3fdc1ad

Please sign in to comment.