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
|
|
|
LLVM_VERSION=""
|
|
|
|
LLVM_PACKAGE=""
|
|
|
|
LLVM_PACKAGE_SUFFIX=""
|
|
|
|
|
2013-05-13 15:18:18 +08:00
|
|
|
mkdir -p $HOME/bin
|
2013-06-25 01:41:48 +08:00
|
|
|
cd $HOME/bin
|
2013-05-13 15:18:18 +08:00
|
|
|
|
|
|
|
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-06-21 21:27:45 +08:00
|
|
|
LLVM_VERSION="3.3"
|
2013-05-21 17:29:23 +08:00
|
|
|
if [ "$PLATFORM"x = "ios"x ]; then
|
2013-06-21 21:27:45 +08:00
|
|
|
LLVM_PACKAGE="clang+llvm-3.3-x86_64-apple-darwin12"
|
2013-06-21 21:40:21 +08:00
|
|
|
LLVM_PACKAGE_SUFFIX=".tar.gz"
|
2013-06-21 21:27:45 +08:00
|
|
|
else
|
|
|
|
LLVM_PACKAGE="clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu"
|
2013-06-21 21:40:21 +08:00
|
|
|
LLVM_PACKAGE_SUFFIX=".tar.bz2"
|
2013-06-21 21:27:45 +08:00
|
|
|
fi
|
2013-06-25 01:41:48 +08:00
|
|
|
|
2013-06-21 21:27:45 +08:00
|
|
|
# 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}
|
2013-05-21 17:29:23 +08:00
|
|
|
else
|
2013-06-21 21:27:45 +08:00
|
|
|
tar xjf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|
2013-06-25 01:41:48 +08:00
|
|
|
|
2013-05-21 16:13:47 +08:00
|
|
|
# Rename llvm
|
2013-06-21 21:27:45 +08:00
|
|
|
mv ${LLVM_PACKAGE} clang+llvm-${LLVM_VERSION}
|
2013-05-21 16:13:47 +08:00
|
|
|
}
|
|
|
|
|
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-06-25 01:41:48 +08:00
|
|
|
install_nacl_sdk()
|
|
|
|
{
|
|
|
|
# NaCl compilers are built for 32-bit linux so we need to install
|
|
|
|
# the runtime support for this.
|
|
|
|
if [ ! -e "/lib/ld-linux.so.2" ]; then
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install libc6:i386 libstdc++6:i386
|
|
|
|
fi
|
|
|
|
if [ ! -d nacl_sdl ]; then
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
nacl_sdk/naclsdk update --force pepper_canary
|
|
|
|
}
|
|
|
|
|
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-06-25 01:41:48 +08:00
|
|
|
elif [ "$PLATFORM"x = "linux"x ]; then
|
2013-07-16 11:58:08 +08:00
|
|
|
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
2013-07-14 18:31:33 +08:00
|
|
|
# OpenMW team provides SDL2 package.
|
|
|
|
sudo apt-add-repository -y ppa:openmw/build
|
2013-07-05 13:45:37 +08:00
|
|
|
sudo apt-get update
|
2013-07-16 11:58:08 +08:00
|
|
|
sudo apt-get install gcc-4.7 g++-4.7
|
|
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
|
|
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 90 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
|
|
|
|
g++ --version
|
2013-05-13 15:18:18 +08:00
|
|
|
bash $COCOS2DX_ROOT/install-deps-linux.sh
|
2013-08-27 21:52:06 +08:00
|
|
|
install_android_ndk
|
2013-08-27 22:04:08 +08:00
|
|
|
install_llvm
|
2013-06-25 01:41:48 +08:00
|
|
|
elif [ "$PLATFORM"x = "nacl"x ]; then
|
|
|
|
install_nacl_sdk
|
|
|
|
elif [ "$PLATFORM"x = "android"x ]; then
|
2013-05-13 15:18:18 +08:00
|
|
|
install_android_ndk
|
2013-05-21 16:13:47 +08:00
|
|
|
install_llvm
|
2013-06-25 01:41:48 +08:00
|
|
|
elif [ "$PLATFORM"x = "emscripten"x ]; then
|
2013-06-15 12:07:19 +08:00
|
|
|
sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
|
2013-08-27 21:52:06 +08:00
|
|
|
install_android_ndk
|
2013-06-10 21:57:26 +08:00
|
|
|
install_llvm_3_2
|
2013-06-25 01:41:48 +08:00
|
|
|
elif [ "$PLATFORM"x = "ios"x ]; then
|
2013-05-21 16:13:47 +08:00
|
|
|
install_android_ndk
|
|
|
|
install_llvm
|
2013-06-25 01:41:48 +08:00
|
|
|
|
2013-05-21 16:13:47 +08:00
|
|
|
pushd $COCOS2DX_ROOT
|
|
|
|
git submodule add https://github.com/facebook/xctool.git ./xctool
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
popd
|
2013-06-25 01:41:48 +08:00
|
|
|
else
|
|
|
|
echo "Unknown \$PLATFORM: '$PLATFORM'"
|
|
|
|
exit 1
|
2013-05-21 16:13:47 +08:00
|
|
|
fi
|