2013-05-13 15:18:18 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# exit this script if any commmand fails
|
|
|
|
set -e
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
COCOS2DX_ROOT="$DIR"/../..
|
2013-05-21 16:13:47 +08:00
|
|
|
HOST_NAME=""
|
2013-06-21 21:27:45 +08:00
|
|
|
|
2016-09-01 16:25:47 +08:00
|
|
|
function install_android_ndk()
|
2013-05-13 15:18:18 +08:00
|
|
|
{
|
2018-09-17 11:54:39 +08:00
|
|
|
if [ "$BUILD_TARGET" == "android_ndk-build" ]\
|
|
|
|
|| [ "$BUILD_TARGET" == "android_lua_ndk-build" ]\
|
|
|
|
|| [ "$BUILD_TARGET" == "android_cmake" ]\
|
|
|
|
|| [ "$BUILD_TARGET" == "android_lua_cmake" ] ; then
|
2018-03-15 09:36:27 +08:00
|
|
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
|
2013-05-21 17:29:23 +08:00
|
|
|
else
|
2018-03-15 09:36:27 +08:00
|
|
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py --ndk_only
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|
2016-09-01 16:25:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_linux_environment()
|
|
|
|
{
|
2017-01-19 13:55:14 +08:00
|
|
|
mkdir -p $HOME/bin
|
|
|
|
pushd $HOME/bin
|
|
|
|
|
|
|
|
echo "GCC version: `gcc --version`"
|
|
|
|
# install new version cmake
|
|
|
|
CMAKE_VERSION="3.7.2"
|
|
|
|
CMAKE_DOWNLOAD_URL="https://cmake.org/files/v3.7/cmake-${CMAKE_VERSION}.tar.gz"
|
|
|
|
echo "Download ${CMAKE_DOWNLOAD_URL}"
|
|
|
|
curl -O ${CMAKE_DOWNLOAD_URL}
|
|
|
|
tar -zxf "cmake-${CMAKE_VERSION}.tar.gz"
|
|
|
|
cd "cmake-${CMAKE_VERSION}"
|
|
|
|
./configure > /dev/null
|
|
|
|
make -j2 > /dev/null
|
|
|
|
sudo make install > /dev/null
|
|
|
|
echo "CMake Version: `cmake --version`"
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# install new version binutils
|
|
|
|
BINUTILS_VERSION="2.27"
|
|
|
|
BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.gz"
|
|
|
|
echo "Download ${BINUTILS_URL}"
|
|
|
|
curl -O ${BINUTILS_URL}
|
|
|
|
tar -zxf "binutils-${BINUTILS_VERSION}.tar.gz"
|
|
|
|
cd "binutils-${BINUTILS_VERSION}"
|
|
|
|
./configure > /dev/null
|
|
|
|
make -j2 > /dev/null
|
|
|
|
sudo make install > /dev/null
|
|
|
|
echo "ld Version: `ld --version`"
|
|
|
|
echo "which ld: `which ld`"
|
|
|
|
sudo rm /usr/bin/ld
|
|
|
|
popd
|
2017-12-07 13:34:12 +08:00
|
|
|
echo "Installing linux dependence packages ..."
|
2017-12-04 11:35:31 +08:00
|
|
|
echo -e "y" | bash $COCOS2DX_ROOT/build/install-deps-linux.sh
|
2017-12-07 13:34:12 +08:00
|
|
|
echo "Installing linux dependence packages finished!"
|
2016-09-01 16:25:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function download_deps()
|
|
|
|
{
|
|
|
|
# install dpes
|
|
|
|
pushd $COCOS2DX_ROOT
|
|
|
|
python download-deps.py -r=yes
|
|
|
|
popd
|
2017-12-07 13:34:12 +08:00
|
|
|
echo "Downloading cocos2d-x dependence finished!"
|
2016-09-01 16:25:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_python_module_for_osx()
|
|
|
|
{
|
2018-03-19 09:21:51 +08:00
|
|
|
pip install PyYAML
|
|
|
|
sudo pip install Cheetah
|
2013-05-13 15:18:18 +08:00
|
|
|
}
|
|
|
|
|
2018-03-19 09:21:51 +08:00
|
|
|
function install_latest_python()
|
cmake support win32 ,and support generate&use prebuilt libs (#18683)
* fix win32 prebuilt error, and set cmake as default android native build
* cpp-template support msvc
* add msvc version check
* add -D_USRLUASTATIC, fix lua lib cmake compile error
* fix cpp-empty-test res copy dir, add function needed
* improve msvc res copy
* refactor cmake copy dll logic
* fix cpp-tests compile error
* refactor copy dll temp
* refactor win32 exe using dlls
* js-project compile support cmake using msvc
* improve res mark for win32
* update the way of lua project res mark
* add D_USRLUASTATIC for lua project
* unify RELEASE Release to Release, add CMAKE_CONFIGURATION_TYPES
* improve VS shows targets, add folder
* improve mac/ios res mark
* reduce useless comments
* unify cpp src include variable
* refactor cpp test project package logic
* improve pkg app logic
* start support prebuilt libs for cpp project using cmake
* improve prebuilt libs generate
* expand js/lua support prebuilt libs on mac
* adapt IDE generate libs path
* start do prebuilt for android
* improve the way of using external libs for prebuilt
* prebuilt libs support cpp-empty-test on android studio
* cpp-tests prebuilt libs, and remove useless
* start to improve libs using, to adapt prebuilt
* improve cpp tests prebuilt on android
* prebuilt support lua & js test on android
* prebuilt support cpp&js template
* rename prebuilt variabl, detail androd config
* finish android support prebuilt using cmake
* fix cmake script run in windows error
* reduce variable name length
* improve the way of win32 use dlls to adapt prebuilt
* loosen pick js/lua engine lib condition
* self review and start check linux build
* unify compile option location
* strict copy dlls condition
* improve libs link order
* start redo the way of copy dlls
* unify dlls copy logic
* fix linux res copy error
* update cmake copy file path in linux
* make prebuilt dir if needed, and divide Debug and Release dir
* cmake win32 divide Debug and Release dir well
* comment Lua Template project, for the unfinished lua simulator support
* add simulator cmake file
* start support simulator
* simulator support cmake build on macOS
* fix simulator compile error on win32
* add simulator prebuilt support
* improve mark cocos app macro
* improve cmake template project format
* improve cmake app files format
* fix format improve mistake
* detail cmake readme
* improve readme, useless comments
* add game.rc to template project
* check travis openssl version
* try update travis openssl
* upgrade travis openssl
* change openssl link
* change to upgrade openssl
* re install python with upgrade openssl
* add comment for macro and func, improve variable name
2018-03-08 09:47:57 +08:00
|
|
|
{
|
2018-03-19 09:21:51 +08:00
|
|
|
python -V
|
|
|
|
eval "$(pyenv init -)"
|
|
|
|
pyenv install 2.7.14
|
|
|
|
pyenv global 2.7.14
|
|
|
|
python -V
|
cmake support win32 ,and support generate&use prebuilt libs (#18683)
* fix win32 prebuilt error, and set cmake as default android native build
* cpp-template support msvc
* add msvc version check
* add -D_USRLUASTATIC, fix lua lib cmake compile error
* fix cpp-empty-test res copy dir, add function needed
* improve msvc res copy
* refactor cmake copy dll logic
* fix cpp-tests compile error
* refactor copy dll temp
* refactor win32 exe using dlls
* js-project compile support cmake using msvc
* improve res mark for win32
* update the way of lua project res mark
* add D_USRLUASTATIC for lua project
* unify RELEASE Release to Release, add CMAKE_CONFIGURATION_TYPES
* improve VS shows targets, add folder
* improve mac/ios res mark
* reduce useless comments
* unify cpp src include variable
* refactor cpp test project package logic
* improve pkg app logic
* start support prebuilt libs for cpp project using cmake
* improve prebuilt libs generate
* expand js/lua support prebuilt libs on mac
* adapt IDE generate libs path
* start do prebuilt for android
* improve the way of using external libs for prebuilt
* prebuilt libs support cpp-empty-test on android studio
* cpp-tests prebuilt libs, and remove useless
* start to improve libs using, to adapt prebuilt
* improve cpp tests prebuilt on android
* prebuilt support lua & js test on android
* prebuilt support cpp&js template
* rename prebuilt variabl, detail androd config
* finish android support prebuilt using cmake
* fix cmake script run in windows error
* reduce variable name length
* improve the way of win32 use dlls to adapt prebuilt
* loosen pick js/lua engine lib condition
* self review and start check linux build
* unify compile option location
* strict copy dlls condition
* improve libs link order
* start redo the way of copy dlls
* unify dlls copy logic
* fix linux res copy error
* update cmake copy file path in linux
* make prebuilt dir if needed, and divide Debug and Release dir
* cmake win32 divide Debug and Release dir well
* comment Lua Template project, for the unfinished lua simulator support
* add simulator cmake file
* start support simulator
* simulator support cmake build on macOS
* fix simulator compile error on win32
* add simulator prebuilt support
* improve mark cocos app macro
* improve cmake template project format
* improve cmake app files format
* fix format improve mistake
* detail cmake readme
* improve readme, useless comments
* add game.rc to template project
* check travis openssl version
* try update travis openssl
* upgrade travis openssl
* change openssl link
* change to upgrade openssl
* re install python with upgrade openssl
* add comment for macro and func, improve variable name
2018-03-08 09:47:57 +08:00
|
|
|
}
|
|
|
|
|
2016-09-01 16:25:47 +08:00
|
|
|
# set up environment according os and target
|
|
|
|
function install_environement_for_pull_request()
|
2013-06-25 01:41:48 +08:00
|
|
|
{
|
2017-12-07 13:34:12 +08:00
|
|
|
echo "Building pull request ..."
|
2016-09-01 16:25:47 +08:00
|
|
|
|
|
|
|
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
|
|
|
if [ "$BUILD_TARGET" == "linux" ]; then
|
|
|
|
install_linux_environment
|
|
|
|
fi
|
2013-06-25 01:41:48 +08:00
|
|
|
fi
|
2016-09-01 16:25:47 +08:00
|
|
|
|
|
|
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
2018-03-19 09:21:51 +08:00
|
|
|
install_latest_python
|
2016-09-01 16:25:47 +08:00
|
|
|
install_python_module_for_osx
|
2013-06-25 01:41:48 +08:00
|
|
|
fi
|
2017-12-07 13:34:12 +08:00
|
|
|
|
|
|
|
# use NDK's clang to generate binding codes
|
|
|
|
install_android_ndk
|
|
|
|
download_deps
|
2013-06-25 01:41:48 +08:00
|
|
|
}
|
|
|
|
|
2016-09-01 16:25:47 +08:00
|
|
|
# should generate binding codes & cocos_files.json after merging
|
|
|
|
function install_environement_for_after_merge()
|
|
|
|
{
|
|
|
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
2018-03-19 09:21:51 +08:00
|
|
|
install_latest_python
|
2016-09-01 16:25:47 +08:00
|
|
|
install_python_module_for_osx
|
2014-05-12 21:59:32 +08:00
|
|
|
fi
|
2018-03-15 09:36:27 +08:00
|
|
|
|
|
|
|
echo "Building merge commit ..."
|
|
|
|
install_android_ndk
|
|
|
|
download_deps
|
2016-09-01 16:25:47 +08:00
|
|
|
}
|
2014-05-12 21:59:32 +08:00
|
|
|
|
2018-03-15 09:36:27 +08:00
|
|
|
if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then
|
2018-03-19 09:21:51 +08:00
|
|
|
download_deps
|
2018-03-15 09:36:27 +08:00
|
|
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then
|
|
|
|
download_deps
|
|
|
|
install_linux_environment
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-09-01 16:25:47 +08:00
|
|
|
# build pull request
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
install_environement_for_pull_request
|
|
|
|
fi
|
|
|
|
|
|
|
|
# run after merging
|
|
|
|
# - make cocos robot to send PR to cocos2d-x for new binding codes
|
|
|
|
# - generate cocos_files.json for template
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
2016-09-01 18:54:49 +08:00
|
|
|
# only one job need to send PR, linux virtual machine has better performance
|
2017-12-07 17:52:22 +08:00
|
|
|
if [ $TRAVIS_OS_NAME == "linux" ] && [ x$GEN_BINDING_AND_COCOSFILE == x"true" ]; then
|
2016-09-01 18:54:49 +08:00
|
|
|
install_environement_for_after_merge
|
|
|
|
fi
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|
2017-12-07 13:34:12 +08:00
|
|
|
|
|
|
|
echo "before-install.sh execution finished!"
|