From 0109ebd70733ee640b8f962fa72172ac0fd366c3 Mon Sep 17 00:00:00 2001 From: lihex Date: Tue, 21 Jan 2014 16:53:07 +0800 Subject: [PATCH 1/7] issue #3781, Update genbinding script to fit new bindings-generator. --- tools/tojs/genbindings.sh | 79 +++++++++++++++++++++++++++++--------- tools/tolua/genbindings.sh | 79 +++++++++++++++++++++++++++++--------- 2 files changed, 122 insertions(+), 36 deletions(-) diff --git a/tools/tojs/genbindings.sh b/tools/tojs/genbindings.sh index 00d2d7a8c5..4368a0bdfe 100755 --- a/tools/tojs/genbindings.sh +++ b/tools/tojs/genbindings.sh @@ -1,4 +1,9 @@ #!/bin/bash +# +# Usage: +# export NDK_ROOT=/path/to/ndk-r9b +# ./genbindings.sh +# # exit this script if any commmand fails set -e @@ -6,10 +11,12 @@ set -e # read user.cfg if it exists and is readable _CFG_FILE=$(dirname "$0")"/user.cfg" -if [ -f "$_CFG_FILE" ] +if [ -f "$_CFG_FILE" ]; then - [ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable" - . "$_CFG_FILE" + if [ ! -r "$_CFG_FILE" ]; then + echo "Fatal Error: $_CFG_FILE exists but is unreadable" + exit 1 + fi fi # paths @@ -19,11 +26,6 @@ if [ -z "${NDK_ROOT+aaa}" ]; then NDK_ROOT="$HOME/bin/android-ndk" fi -if [ -z "${CLANG_ROOT+aaa}" ]; then -# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.3" - CLANG_ROOT="$HOME/bin/clang+llvm-3.3" -fi - if [ -z "${PYTHON_BIN+aaa}" ]; then # ... if PYTHON_BIN is not set, use "/usr/bin/python2.7" PYTHON_BIN="/usr/bin/python2.7" @@ -43,16 +45,56 @@ if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then fi if [ -z "${TOJS_ROOT+aaa}" ]; then - TO_JS_ROOT="$COCOS2DX_ROOT/tools/tojs" + OUPUT_ROOT="$COCOS2DX_ROOT/tools/tojs" fi echo "Paths" echo " NDK_ROOT: $NDK_ROOT" -echo " CLANG_ROOT: $CLANG_ROOT" echo " PYTHON_BIN: $PYTHON_BIN" echo " COCOS2DX_ROOT: $COCOS2DX_ROOT" echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT" -echo " TO_JS_ROOT: $TO_JS_ROOT" +echo " OUPUT_ROOT: $OUPUT_ROOT" + +# check NDK version, must be r9b +if ! grep -q r9b $NDK_ROOT/RELEASE.TXT +then + echo " Fatal Error: NDK r9b must be required!" + exit 1 +fi + +# check clang include path +OS_NAME=$('uname') +NDK_LLVM_ROOT=$NDK_ROOT/toolchains/llvm-3.3/prebuilt +case "$OS_NAME" in + Darwin | darwin) + echo "in darwin" + if [ -d "$NDK_LLVM_ROOT/darwin-x86_64" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86_64 + elif [ -d "$NDK_LLVM_ROOT/darwin-x86" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86 + else + echo $NDK_LLVM_ROOT + echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3" + exit 1 + fi + ;; + Linux | linux) + echo "in linux" + if [ -d "$NDK_LLVM_ROOT/linux-x86_64" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86_64 + elif [ -d "$NDK_LLVM_ROOT/linux-x86" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86 + else + echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3" + exit 1 + fi + ;; + *) + echo " Fatal Error: Please run this script in linux or mac osx." + exit 1 + ;; +esac + # write userconf.ini @@ -65,7 +107,7 @@ fi _CONTENTS="" _CONTENTS+="[DEFAULT]"'\n' _CONTENTS+="androidndkdir=$NDK_ROOT"'\n' -_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n' +_CONTENTS+="clangllvmdir=$NDK_LLVM_ROOT"'\n' _CONTENTS+="cocosdir=$COCOS2DX_ROOT"'\n' _CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n' _CONTENTS+="extra_flags="'\n' @@ -80,19 +122,20 @@ echo --- # Generate bindings for cocos2dx echo "Generating bindings for cocos2dx..." set -x -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_auto echo "Generating bindings for cocos2dx_extension..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_extension_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_extension_auto echo "Generating bindings for cocos2dx_builder..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_builder_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_builder_auto echo "Generating bindings for cocos2dx_gui..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_gui_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_gui_auto echo "Generating bindings for cocos2dx_studio..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_studio_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_studio_auto echo "Generating bindings for cocos2dx_spine..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_spine_auto \ No newline at end of file +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_spine_auto + diff --git a/tools/tolua/genbindings.sh b/tools/tolua/genbindings.sh index eb463fcfa5..0acf430cce 100755 --- a/tools/tolua/genbindings.sh +++ b/tools/tolua/genbindings.sh @@ -1,4 +1,9 @@ #!/bin/bash +# +# Usage: +# export NDK_ROOT=/path/to/ndk-r9b +# ./genbindings.sh +# # exit this script if any commmand fails set -e @@ -6,10 +11,12 @@ set -e # read user.cfg if it exists and is readable _CFG_FILE=$(dirname "$0")"/user.cfg" -if [ -f "$_CFG_FILE" ] +if [ -f "$_CFG_FILE" ]; then - [ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable" - . "$_CFG_FILE" + if [ ! -r "$_CFG_FILE" ]; then + echo "Fatal Error: $_CFG_FILE exists but is unreadable" + exit 1 + fi fi # paths @@ -19,11 +26,6 @@ if [ -z "${NDK_ROOT+aaa}" ]; then NDK_ROOT="$HOME/bin/android-ndk" fi -if [ -z "${CLANG_ROOT+aaa}" ]; then -# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.3" - CLANG_ROOT="$HOME/bin/clang+llvm-3.3" -fi - if [ -z "${PYTHON_BIN+aaa}" ]; then # ... if PYTHON_BIN is not set, use "/usr/bin/python2.7" PYTHON_BIN="/usr/bin/python2.7" @@ -43,16 +45,56 @@ if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then fi if [ -z "${TOJS_ROOT+aaa}" ]; then - TO_JS_ROOT="$COCOS2DX_ROOT/tools/tolua" + OUPUT_ROOT="$COCOS2DX_ROOT/tools/tolua" fi echo "Paths" echo " NDK_ROOT: $NDK_ROOT" -echo " CLANG_ROOT: $CLANG_ROOT" echo " PYTHON_BIN: $PYTHON_BIN" echo " COCOS2DX_ROOT: $COCOS2DX_ROOT" echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT" -echo " TO_JS_ROOT: $TO_JS_ROOT" +echo " OUPUT_ROOT: $OUPUT_ROOT" + +# check NDK version, must be r9b +if ! grep -q r9b $NDK_ROOT/RELEASE.TXT +then + echo " Fatal Error: NDK r9b must be required!" + exit 1 +fi + +# check clang include path +OS_NAME=$('uname') +NDK_LLVM_ROOT=$NDK_ROOT/toolchains/llvm-3.3/prebuilt +case "$OS_NAME" in + Darwin | darwin) + echo "in darwin" + if [ -d "$NDK_LLVM_ROOT/darwin-x86_64" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86_64 + elif [ -d "$NDK_LLVM_ROOT/darwin-x86" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86 + else + echo $NDK_LLVM_ROOT + echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3" + exit 1 + fi + ;; + Linux | linux) + echo "in linux" + if [ -d "$NDK_LLVM_ROOT/linux-x86_64" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86_64 + elif [ -d "$NDK_LLVM_ROOT/linux-x86" ]; then + NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86 + else + echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3" + exit 1 + fi + ;; + *) + echo " Fatal Error: Please run this script in linux or mac osx." + exit 1 + ;; +esac + # write userconf.ini @@ -65,7 +107,7 @@ fi _CONTENTS="" _CONTENTS+="[DEFAULT]"'\n' _CONTENTS+="androidndkdir=$NDK_ROOT"'\n' -_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n' +_CONTENTS+="clangllvmdir=$NDK_LLVM_ROOT"'\n' _CONTENTS+="cocosdir=$COCOS2DX_ROOT"'\n' _CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n' _CONTENTS+="extra_flags="'\n' @@ -80,19 +122,20 @@ echo --- # Generate bindings for cocos2dx echo "Generating bindings for cocos2dx..." set -x -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_auto echo "Generating bindings for cocos2dx_extension..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_extension_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_extension_auto echo "Generating bindings for cocos2dx_gui..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_gui_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_gui_auto echo "Generating bindings for cocos2dx_studio..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_studio_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_studio_auto echo "Generating bindings for cocos2dx_spine..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_spine_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_spine_auto echo "Generating bindings for cocos2dx_physics..." -LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_physics_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_physics_auto + From a392a709cd93d805bdb5f54115a3fe06d4ad7454 Mon Sep 17 00:00:00 2001 From: lihex Date: Tue, 21 Jan 2014 17:40:20 +0800 Subject: [PATCH 2/7] issue #3781: Fix the variable name. --- tools/tojs/genbindings.sh | 19 +++++++++++-------- tools/tolua/genbindings.sh | 21 ++++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/tools/tojs/genbindings.sh b/tools/tojs/genbindings.sh index 4368a0bdfe..06b8eab316 100755 --- a/tools/tojs/genbindings.sh +++ b/tools/tojs/genbindings.sh @@ -45,15 +45,18 @@ if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then fi if [ -z "${TOJS_ROOT+aaa}" ]; then - OUPUT_ROOT="$COCOS2DX_ROOT/tools/tojs" + TOJS_ROOT="$COCOS2DX_ROOT/tools/tojs" fi +# set output dir +OUTPUT_DIR=${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings + echo "Paths" echo " NDK_ROOT: $NDK_ROOT" echo " PYTHON_BIN: $PYTHON_BIN" echo " COCOS2DX_ROOT: $COCOS2DX_ROOT" echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT" -echo " OUPUT_ROOT: $OUPUT_ROOT" +echo " TOJS_ROOT: $TOJS_ROOT" # check NDK version, must be r9b if ! grep -q r9b $NDK_ROOT/RELEASE.TXT @@ -122,20 +125,20 @@ echo --- # Generate bindings for cocos2dx echo "Generating bindings for cocos2dx..." set -x -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_auto echo "Generating bindings for cocos2dx_extension..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_extension_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_extension_auto echo "Generating bindings for cocos2dx_builder..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_builder_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_builder_auto echo "Generating bindings for cocos2dx_gui..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_gui_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_gui_auto echo "Generating bindings for cocos2dx_studio..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_studio_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_studio_auto echo "Generating bindings for cocos2dx_spine..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_spine_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_spine_auto diff --git a/tools/tolua/genbindings.sh b/tools/tolua/genbindings.sh index 0acf430cce..8881efa950 100755 --- a/tools/tolua/genbindings.sh +++ b/tools/tolua/genbindings.sh @@ -44,16 +44,19 @@ if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then CXX_GENERATOR_ROOT="$COCOS2DX_ROOT/tools/bindings-generator" fi -if [ -z "${TOJS_ROOT+aaa}" ]; then - OUPUT_ROOT="$COCOS2DX_ROOT/tools/tolua" +if [ -z "${TOLUA_ROOT+aaa}" ]; then + TOLUA_ROOT="$COCOS2DX_ROOT/tools/tolua" fi +# set output dir +OUTPUT_DIR=${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings + echo "Paths" echo " NDK_ROOT: $NDK_ROOT" echo " PYTHON_BIN: $PYTHON_BIN" echo " COCOS2DX_ROOT: $COCOS2DX_ROOT" echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT" -echo " OUPUT_ROOT: $OUPUT_ROOT" +echo " TOLUA_ROOT: $TOLUA_ROOT" # check NDK version, must be r9b if ! grep -q r9b $NDK_ROOT/RELEASE.TXT @@ -122,20 +125,20 @@ echo --- # Generate bindings for cocos2dx echo "Generating bindings for cocos2dx..." set -x -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_auto echo "Generating bindings for cocos2dx_extension..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_extension_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_extension_auto echo "Generating bindings for cocos2dx_gui..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_gui_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_gui_auto echo "Generating bindings for cocos2dx_studio..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_studio_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_studio_auto echo "Generating bindings for cocos2dx_spine..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_spine_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_spine_auto echo "Generating bindings for cocos2dx_physics..." -LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${OUPUT_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_physics_auto +LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_physics_auto From 1a6b36184df4490fae160b50d64b4925301c5cc8 Mon Sep 17 00:00:00 2001 From: lihex Date: Tue, 21 Jan 2014 17:48:49 +0800 Subject: [PATCH 3/7] issue #3781, Add windows bat script. --- tools/tojs/genbindings-win32.bat | 93 +++++++++++++++++++++++++++++++ tools/tolua/genbindings-win32.bat | 89 +++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 tools/tojs/genbindings-win32.bat create mode 100644 tools/tolua/genbindings-win32.bat diff --git a/tools/tojs/genbindings-win32.bat b/tools/tojs/genbindings-win32.bat new file mode 100644 index 0000000000..8e1a06e391 --- /dev/null +++ b/tools/tojs/genbindings-win32.bat @@ -0,0 +1,93 @@ +@echo off + +:: This script is used to generate jsbinding glue codes. +:: You should modify PYTHON_ROOT and NDK_ROOT to work under your environment. +:: Android ndk version must be at least ndk-r9b. + +set PYTHON_ROOT=C:/Python27 +set NDK_ROOT=G:/android/android-ndk-r9b +set NDK_LLVM_ROOT=%NDK_ROOT%/toolchains/llvm-3.3/prebuilt/windows-x86_64 + +set COCOS2DX_ROOT=%cd%/../.. +set "COCOS2DX_ROOT=%COCOS2DX_ROOT:\=/%" +set CXX_GENERATOR_ROOT=%COCOS2DX_ROOT%/tools/bindings-generator +set TO_JS_ROOT=%COCOS2DX_ROOT%/tools/tojs +set "CXX_GENERATOR_ROOT=%CXX_GENERATOR_ROOT:\=/%" +set OUTPUT_DIR=%COCOS2DX_ROOT%/scripting/auto-generated/js-bindings +set "OUTPUT_DIR=%OUTPUT_DIR:/=\%" + +set PATH=%PATH%;%CXX_GENERATOR_ROOT%/libclang;%CXX_GENERATOR_ROOT%/tools/win32;%PYTHON_ROOT% + +:: write userconf.ini + +set _CONF_INI_FILE=%cd%\userconf.ini +if exist %_CONF_INI_FILE% del /Q %_CONF_INI_FILE% + + +echo +echo generating userconf.ini... +echo --- +echo [DEFAULT] > %_CONF_INI_FILE% +echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE% +echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE% +echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE% +echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE% +:: fixme: to fix parse error, we must difine __WCHAR_MAX__ here. +echo extra_flags=-D__WCHAR_MAX__=0x7fffffff >> %_CONF_INI_FILE% +echo --- + + + +:: Generate bindings for cocos2dx +echo Generating bindings for cocos2dx... +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx.ini -s cocos2d-x -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_auto +if %errorlevel% neq 0 goto ERROR + +echo "Generating bindings for cocos2dx_extension..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_extension_auto +if %errorlevel% neq 0 goto ERROR + +echo "Generating bindings for cocos2dx_builder..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o %OUTPUT_DIR% -n jsb_cocos2dx_builder_auto +if %errorlevel% neq 0 goto ERROR + +echo "Generating bindings for cocos2dx_gui..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_gui_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_studio..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_studio_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_spine..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_spine_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_physics..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_physics.ini -s cocos2dx_physics -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_physics_auto +if %errorlevel% neq 0 goto ERROR + + +:: Change the generated file format from DOS to UNIX. +pushd "%OUTPUT_DIR%" +dos2unix * +popd + +echo --------------------------------- +echo Generating bindings succeeds. +echo --------------------------------- + +goto QUIT + +:ERROR +echo --------------------------------- +echo Generating bindings fails. +echo --------------------------------- + +:QUIT + +pause + diff --git a/tools/tolua/genbindings-win32.bat b/tools/tolua/genbindings-win32.bat new file mode 100644 index 0000000000..8a02e6d18f --- /dev/null +++ b/tools/tolua/genbindings-win32.bat @@ -0,0 +1,89 @@ +@echo off + +:: This script is used to generate luabinding glue codes. +:: You should modify PYTHON_ROOT and NDK_ROOT to work under your environment. +:: Android ndk version must be at least ndk-r9b. + +set PYTHON_ROOT=C:/Python27 +set NDK_ROOT=G:/android/android-ndk-r9b +set NDK_LLVM_ROOT=%NDK_ROOT%/toolchains/llvm-3.3/prebuilt/windows-x86_64 + +set COCOS2DX_ROOT=%cd%/../.. +set "COCOS2DX_ROOT=%COCOS2DX_ROOT:\=/%" +set CXX_GENERATOR_ROOT=%COCOS2DX_ROOT%/tools/bindings-generator +set TO_LUA_ROOT=%COCOS2DX_ROOT%/tools/tolua +set "CXX_GENERATOR_ROOT=%CXX_GENERATOR_ROOT:\=/%" +set OUTPUT_DIR=%COCOS2DX_ROOT%/scripting/auto-generated/lua-bindings +set "OUTPUT_DIR=%OUTPUT_DIR:/=\%" + +set PATH=%PATH%;%CXX_GENERATOR_ROOT%/libclang;%CXX_GENERATOR_ROOT%/tools/win32;%PYTHON_ROOT% + +:: write userconf.ini + +set _CONF_INI_FILE=%cd%\userconf.ini +if exist %_CONF_INI_FILE% del /Q %_CONF_INI_FILE% + + +echo +echo generating userconf.ini... +echo --- +echo [DEFAULT] > %_CONF_INI_FILE% +echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE% +echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE% +echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE% +echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE% +:: fixme: to fix parse error, we must difine __WCHAR_MAX__ here. +echo extra_flags=-D__WCHAR_MAX__=0x7fffffff >> %_CONF_INI_FILE% +echo --- + + + +:: Generate bindings for cocos2dx +echo Generating bindings for cocos2dx... +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx.ini -s cocos2d-x -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_auto +if %errorlevel% neq 0 goto ERROR + +echo "Generating bindings for cocos2dx_extension..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_extension_auto +if %errorlevel% neq 0 goto ERROR + +echo "Generating bindings for cocos2dx_gui..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_gui_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_studio..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_studio_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_spine..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_spine_auto +if %errorlevel% neq 0 goto ERROR + + +echo "Generating bindings for cocos2dx_physics..." +python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_physics_auto +if %errorlevel% neq 0 goto ERROR + + +:: Change the generated file format from DOS to UNIX. +pushd "%OUTPUT_DIR%" +dos2unix * +popd + +echo --------------------------------- +echo Generating bindings succeeds. +echo --------------------------------- + +goto QUIT + +:ERROR +echo --------------------------------- +echo Generating bindings fails. +echo --------------------------------- + +:QUIT + +pause + From 56654c0ffb0174bf07feffdcbd879c9d62ca872b Mon Sep 17 00:00:00 2001 From: lihex Date: Tue, 21 Jan 2014 18:09:21 +0800 Subject: [PATCH 4/7] issue #3781, js not generate cocos2dx physics now. --- tools/tojs/genbindings-win32.bat | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/tojs/genbindings-win32.bat b/tools/tojs/genbindings-win32.bat index 8e1a06e391..7437c6ce5e 100644 --- a/tools/tojs/genbindings-win32.bat +++ b/tools/tojs/genbindings-win32.bat @@ -66,11 +66,6 @@ python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_spine.ini -s coco if %errorlevel% neq 0 goto ERROR -echo "Generating bindings for cocos2dx_physics..." -python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_physics.ini -s cocos2dx_physics -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_physics_auto -if %errorlevel% neq 0 goto ERROR - - :: Change the generated file format from DOS to UNIX. pushd "%OUTPUT_DIR%" dos2unix * From 40f5c31a50e2192ebb8d53e524c9777a3977cc1d Mon Sep 17 00:00:00 2001 From: lihex Date: Tue, 21 Jan 2014 18:32:27 +0800 Subject: [PATCH 5/7] issue #3781, Undefine the __MINGW32__ macro to fix the script error on windows --- tools/tojs/genbindings-win32.bat | 4 ++-- tools/tolua/genbindings-win32.bat | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/tojs/genbindings-win32.bat b/tools/tojs/genbindings-win32.bat index 7437c6ce5e..b8c4c0e537 100644 --- a/tools/tojs/genbindings-win32.bat +++ b/tools/tojs/genbindings-win32.bat @@ -32,8 +32,8 @@ echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE% echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE% echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE% echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE% -:: fixme: to fix parse error, we must difine __WCHAR_MAX__ here. -echo extra_flags=-D__WCHAR_MAX__=0x7fffffff >> %_CONF_INI_FILE% +:: fixme: to fix parse error, we must difine __WCHAR_MAX__ and undefine __MINGW32__ . +echo extra_flags=-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__ >> %_CONF_INI_FILE% echo --- diff --git a/tools/tolua/genbindings-win32.bat b/tools/tolua/genbindings-win32.bat index 8a02e6d18f..1aeddcdcfa 100644 --- a/tools/tolua/genbindings-win32.bat +++ b/tools/tolua/genbindings-win32.bat @@ -32,8 +32,8 @@ echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE% echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE% echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE% echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE% -:: fixme: to fix parse error, we must difine __WCHAR_MAX__ here. -echo extra_flags=-D__WCHAR_MAX__=0x7fffffff >> %_CONF_INI_FILE% +:: fixme: to fix parse error, we must difine __WCHAR_MAX__ and undefine __MINGW32__ . +echo extra_flags=-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__ >> %_CONF_INI_FILE% echo --- From b2a1cd90eb604c1e7ed9db85b5abecc3d6b3a2ec Mon Sep 17 00:00:00 2001 From: lihex Date: Wed, 22 Jan 2014 10:58:02 +0800 Subject: [PATCH 6/7] issue #3781, Minor fix & update submodule. --- tools/bindings-generator | 2 +- tools/tojs/genbindings.sh | 2 +- tools/tolua/genbindings.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 6fc3372cdf..ad6f6c7816 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 6fc3372cdfdbf39dd20bdcf1f60eb779773d32d7 +Subproject commit ad6f6c781687b0dd471c4df53c0ba5925e43894d diff --git a/tools/tojs/genbindings.sh b/tools/tojs/genbindings.sh index 06b8eab316..aa95a4e28b 100755 --- a/tools/tojs/genbindings.sh +++ b/tools/tojs/genbindings.sh @@ -37,7 +37,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # paths with defaults hardcoded to relative paths if [ -z "${COCOS2DX_ROOT+aaa}" ]; then - COCOS2DX_ROOT="$DIR/../../" + COCOS2DX_ROOT="$DIR/../.." fi if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then diff --git a/tools/tolua/genbindings.sh b/tools/tolua/genbindings.sh index 8881efa950..e15de46b1a 100755 --- a/tools/tolua/genbindings.sh +++ b/tools/tolua/genbindings.sh @@ -37,7 +37,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # paths with defaults hardcoded to relative paths if [ -z "${COCOS2DX_ROOT+aaa}" ]; then - COCOS2DX_ROOT="$DIR/../../" + COCOS2DX_ROOT="$DIR/../.." fi if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then From 3b9d4c7a39b348b2ab6fd7f8c43b2fd30a55f5f9 Mon Sep 17 00:00:00 2001 From: lihex Date: Wed, 22 Jan 2014 11:28:53 +0800 Subject: [PATCH 7/7] issue #3781, Update travis-scripts, llvm-installing parts no need now. --- tools/travis-scripts/before-install.sh | 50 +------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/tools/travis-scripts/before-install.sh b/tools/travis-scripts/before-install.sh index acfdd36e12..eb29f0fc5d 100755 --- a/tools/travis-scripts/before-install.sh +++ b/tools/travis-scripts/before-install.sh @@ -6,9 +6,6 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" COCOS2DX_ROOT="$DIR"/../.. HOST_NAME="" -LLVM_VERSION="" -LLVM_PACKAGE="" -LLVM_PACKAGE_SUFFIX="" mkdir -p $HOME/bin cd $HOME/bin @@ -29,47 +26,6 @@ install_android_ndk() mv android-ndk-r9b android-ndk } -install_llvm() -{ - LLVM_VERSION="3.3" - if [ "$PLATFORM"x = "ios"x ]; then - LLVM_PACKAGE="clang+llvm-3.3-x86_64-apple-darwin12" - LLVM_PACKAGE_SUFFIX=".tar.gz" - else - LLVM_PACKAGE="clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu" - LLVM_PACKAGE_SUFFIX=".tar.bz2" - fi - - # Download llvm - echo "Download ${LLVM_PACKAGE} ..." - curl -O http://llvm.org/releases/${LLVM_VERSION}/${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX} - echo "Decompress ${LLVM_PACKAGE} ..." - if [ "$PLATFORM"x = "ios"x ]; then - tar xzf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX} - else - tar xjf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX} - fi - - # Rename llvm - mv ${LLVM_PACKAGE} clang+llvm-${LLVM_VERSION} -} - -install_llvm_3_2() -{ - if [ "$PLATFORM"x = "ios"x ]; then - HOST_NAME="apple-darwin11" - else - HOST_NAME="linux-ubuntu-12.04" - fi - # Download llvm3.2 - echo "Download clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz" - curl -O http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz - echo "Decompress clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz ..." - tar xzf clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz - # Rename llvm - mv clang+llvm-3.2-x86_64-${HOST_NAME} clang+llvm-3.2 -} - install_nacl_sdk() { # NaCl compilers are built for 32-bit linux so we need to install @@ -92,7 +48,6 @@ if [ "$GEN_JSB"x = "YES"x ]; then exit 0 fi install_android_ndk - install_llvm elif [ "$PLATFORM"x = "linux"x ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # OpenMW team provides SDL2 package. @@ -104,19 +59,15 @@ elif [ "$PLATFORM"x = "linux"x ]; then g++ --version bash $COCOS2DX_ROOT/build/install-deps-linux.sh install_android_ndk - install_llvm elif [ "$PLATFORM"x = "nacl"x ]; then install_nacl_sdk elif [ "$PLATFORM"x = "android"x ]; then install_android_ndk - install_llvm elif [ "$PLATFORM"x = "emscripten"x ]; then sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm install_android_ndk - install_llvm_3_2 elif [ "$PLATFORM"x = "ios"x ]; then install_android_ndk - install_llvm pushd $COCOS2DX_ROOT git submodule add https://github.com/facebook/xctool.git ./xctool @@ -127,3 +78,4 @@ else echo "Unknown \$PLATFORM: '$PLATFORM'" exit 1 fi +