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-05-13 15:18:18 +08:00
|
|
|
mkdir -p $HOME/bin
|
|
|
|
pushd $HOME/bin
|
|
|
|
|
|
|
|
|
|
|
|
install_android_ndk()
|
|
|
|
{
|
|
|
|
# Download android ndk
|
2013-05-21 17:29:23 +08:00
|
|
|
if [ "$PLATFORM"x = "ios"x ]; then
|
2013-05-21 16:13:47 +08:00
|
|
|
HOST_NAME="darwin"
|
2013-05-21 17:29:23 +08:00
|
|
|
else
|
|
|
|
HOST_NAME="linux"
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|
2013-05-21 16:39:26 +08:00
|
|
|
echo "Download android-ndk-r8e-${HOST_NAME}-x86_64.tar.bz2 ..."
|
2013-05-21 16:13:47 +08:00
|
|
|
curl -O http://dl.google.com/android/ndk/android-ndk-r8e-${HOST_NAME}-x86_64.tar.bz2
|
|
|
|
echo "Decompress android-ndk-r8e-${HOST_NAME}-x86_64.tar.bz2 ..."
|
|
|
|
tar xjf android-ndk-r8e-${HOST_NAME}-x86_64.tar.bz2
|
2013-05-13 15:18:18 +08:00
|
|
|
# Rename ndk
|
|
|
|
mv android-ndk-r8e android-ndk
|
|
|
|
}
|
|
|
|
|
2013-05-21 16:13:47 +08:00
|
|
|
install_llvm()
|
|
|
|
{
|
2013-05-21 17:29:23 +08:00
|
|
|
if [ "$PLATFORM"x = "ios"x ]; then
|
2013-05-21 16:13:47 +08:00
|
|
|
HOST_NAME="apple-darwin11"
|
2013-05-21 17:29:23 +08:00
|
|
|
else
|
|
|
|
HOST_NAME="linux-ubuntu_12.04"
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|
|
|
|
# Download llvm3.1
|
2013-05-21 16:39:26 +08:00
|
|
|
echo "Download clang+llvm-3.1-x86_64-${HOST_NAME}.tar.gz"
|
2013-05-21 16:13:47 +08:00
|
|
|
curl -O http://llvm.org/releases/3.1/clang+llvm-3.1-x86_64-${HOST_NAME}.tar.gz
|
|
|
|
echo "Decompress clang+llvm-3.1-x86_64-${HOST_NAME}.tar.gz ..."
|
|
|
|
tar xzf clang+llvm-3.1-x86_64-${HOST_NAME}.tar.gz
|
|
|
|
# Rename llvm
|
|
|
|
mv clang+llvm-3.1-x86_64-${HOST_NAME} clang+llvm-3.1
|
|
|
|
}
|
|
|
|
|
2013-06-10 21:57:26 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2013-05-13 15:18:18 +08:00
|
|
|
if [ "$GEN_JSB"x = "YES"x ]; then
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
install_android_ndk
|
2013-05-21 16:13:47 +08:00
|
|
|
install_llvm
|
2013-05-13 15:18:18 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$PLATFORM"x = "linux"x ]; then
|
|
|
|
bash $COCOS2DX_ROOT/install-deps-linux.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$PLATFORM"x = "nacl"x ]; then
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install libc6:i386
|
|
|
|
echo "Download nacl_sdk ..."
|
|
|
|
wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip
|
|
|
|
echo "Decompress nacl_sdk.zip"
|
|
|
|
unzip nacl_sdk.zip
|
|
|
|
nacl_sdk/naclsdk update --force pepper_canary
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$PLATFORM"x = "android"x ]; then
|
|
|
|
install_android_ndk
|
2013-05-21 16:13:47 +08:00
|
|
|
install_llvm
|
2013-05-13 15:18:18 +08:00
|
|
|
fi
|
|
|
|
|
2013-06-10 21:57:26 +08:00
|
|
|
if [ "$PLATFORM"x = "emscripten"x ]; then
|
|
|
|
install_llvm_3_2
|
|
|
|
fi
|
|
|
|
|
2013-05-21 16:13:47 +08:00
|
|
|
if [ "$PLATFORM"x = "ios"x ]; then
|
|
|
|
install_android_ndk
|
|
|
|
install_llvm
|
|
|
|
|
|
|
|
pushd $COCOS2DX_ROOT
|
|
|
|
git submodule add https://github.com/facebook/xctool.git ./xctool
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
popd
|
|
|
|
fi
|
2013-05-13 15:18:18 +08:00
|
|
|
|
|
|
|
popd
|