Skip to content

Simplify install-deps-linux.sh, tested on Ubuntu 16.04 #19212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 1 addition & 48 deletions build/install-deps-linux.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash

# Change directory to the location of this script
echo "This Shell Script will install dependencies for cocos2d-x"
echo "if you execute this shell more than once it will get errors when building libGLFW.so"
echo -n "Are you continue? (y/n) "
read answer
if echo "$answer" | grep -iq "^y" ;then
Expand All @@ -11,24 +9,13 @@ else
exit
fi

cd $(dirname ${BASH_SOURCE[0]})

if [ ! $(command -v apt-get) ]; then
echo "Not a .deb package system. Please install dependencies manually"
exit 0
fi

#install g++-4.9
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y > /dev/null
sudo apt-get update

DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' gcc-4.9'
DEPENDS+=' g++-4.9'
DEPENDS+=' libzip-dev'
DEPENDS+=' libpng12-dev'
DEPENDS+=' libcurl4-gnutls-dev'
Expand All @@ -39,38 +26,4 @@ DEPENDS+=' libssl-dev'
DEPENDS+=' libgtk-3-dev'
DEPENDS+=' binutils'

MISSING=
echo "Checking for missing packages ..."
for i in $DEPENDS; do
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
MISSING+="$i "
fi
done

if [ -n "$MISSING" ]; then
TXTCOLOR_DEFAULT="\033[0;m"
TXTCOLOR_GREEN="\033[0;32m"
echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT
CUR_APT_VERSION="$(apt --version | grep -o '[0-9].[0-9]')"
REQ_APT_VERSION="1.1"
if [ 1 -ge "$(echo "${CUR_APT_VERSION} >= ${REQ_APT_VERSION}" | bc)" ]
then
sudo apt-get install --allow-change-held-packages $MISSING -y > /dev/null
else
sudo apt-get install --force-yes --yes $MISSING > /dev/null
fi
fi



sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60

echo "Cocos uses GCC Version: `gcc --version`"
echo "Cocos uses G++ Version: `g++ --version`"
echo "Cocos uses ld Version: `ld --version`"
echo "Cocos uses /usr/bin/ld Version: `/usr/bin/ld --version`"

sudo apt-get install --force-yes --yes $DEPENDS > /dev/null
4 changes: 0 additions & 4 deletions tools/travis-scripts/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ function install_android_ndk()

function install_linux_environment()
{
mkdir -p $HOME/bin
pushd $HOME/bin

echo "GCC version: `gcc --version`"
echo "Installing linux dependence packages ..."
echo -e "y" | bash $COCOS2DX_ROOT/build/install-deps-linux.sh
echo "Installing linux dependence packages finished!"
Expand Down
9 changes: 3 additions & 6 deletions tools/travis-scripts/run-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ function do_retry()

function build_linux()
{
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
echo "Building tests ..."
cd $COCOS2DX_ROOT/build
mkdir -p linux-build
cd linux-build
cmake ../..
echo "cpu cores: ${CPU_CORES}"
make -j${CPU_CORES} VERBOSE=1
cmake --build .
}

function build_mac()
Expand Down Expand Up @@ -375,14 +373,13 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
update_cocos_files
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l lua -p my.pack.qqqq cocos_new_test
popd
CPU_CORES=`grep -c ^processor /proc/cpuinfo`

echo "Building tests ..."
cd $COCOS2DX_ROOT/cocos_new_test
mkdir -p linux-build
cd linux-build
cmake ..
echo "cpu cores: ${CPU_CORES}"
make -j${CPU_CORES} VERBOSE=1
cmake --build .
exit 0
fi
if [ $BUILD_TARGET == 'mac_cmake' ]; then
Expand Down