axmol/tools/travis-scripts/before-install.sh

84 lines
2.1 KiB
Bash
Raw Normal View History

#!/bin/bash
# exit this script if any commmand fails
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../..
HOST_NAME=""
mkdir -p $HOME/bin
pushd $HOME/bin
install_android_ndk()
{
# Download android ndk
if [ "$PLATFORM"x = "ios"x ]; then
HOST_NAME="darwin"
else
HOST_NAME="linux"
fi
2013-05-21 16:39:26 +08:00
echo "Download android-ndk-r8e-${HOST_NAME}-x86_64.tar.bz2 ..."
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
# Rename ndk
mv android-ndk-r8e android-ndk
}
install_llvm()
{
if [ "$PLATFORM"x = "ios"x ]; then
HOST_NAME="apple-darwin11"
else
HOST_NAME="linux-ubuntu_12.04"
fi
# Download llvm3.1
2013-05-21 16:39:26 +08:00
echo "Download clang+llvm-3.1-x86_64-${HOST_NAME}.tar.gz"
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
}
if [ "$GEN_JSB"x = "YES"x ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
exit 0
fi
install_android_ndk
install_llvm
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
install_llvm
fi
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
popd