Skip to content

Commit 03dd8d9

Browse files
crazyhappygamedrelaptop
authored andcommitted
Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (#19212)
* Simplify install-deps-linux.sh * Cleanup
1 parent bcb1f48 commit 03dd8d9

File tree

3 files changed

+4
-58
lines changed

3 files changed

+4
-58
lines changed

build/install-deps-linux.sh

+1-48
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/bash
22

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

14-
cd $(dirname ${BASH_SOURCE[0]})
15-
16-
if [ ! $(command -v apt-get) ]; then
17-
echo "Not a .deb package system. Please install dependencies manually"
18-
exit 0
19-
fi
20-
21-
#install g++-4.9
22-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y > /dev/null
2312
sudo apt-get update
2413

2514
DEPENDS='libx11-dev'
2615
DEPENDS+=' libxmu-dev'
2716
DEPENDS+=' libglu1-mesa-dev'
2817
DEPENDS+=' libgl2ps-dev'
2918
DEPENDS+=' libxi-dev'
30-
DEPENDS+=' gcc-4.9'
31-
DEPENDS+=' g++-4.9'
3219
DEPENDS+=' libzip-dev'
3320
DEPENDS+=' libpng12-dev'
3421
DEPENDS+=' libcurl4-gnutls-dev'
@@ -39,38 +26,4 @@ DEPENDS+=' libssl-dev'
3926
DEPENDS+=' libgtk-3-dev'
4027
DEPENDS+=' binutils'
4128

42-
MISSING=
43-
echo "Checking for missing packages ..."
44-
for i in $DEPENDS; do
45-
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
46-
MISSING+="$i "
47-
fi
48-
done
49-
50-
if [ -n "$MISSING" ]; then
51-
TXTCOLOR_DEFAULT="\033[0;m"
52-
TXTCOLOR_GREEN="\033[0;32m"
53-
echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT
54-
CUR_APT_VERSION="$(apt --version | grep -o '[0-9].[0-9]')"
55-
REQ_APT_VERSION="1.1"
56-
if [ 1 -ge "$(echo "${CUR_APT_VERSION} >= ${REQ_APT_VERSION}" | bc)" ]
57-
then
58-
sudo apt-get install --allow-change-held-packages $MISSING -y > /dev/null
59-
else
60-
sudo apt-get install --force-yes --yes $MISSING > /dev/null
61-
fi
62-
fi
63-
64-
65-
66-
sudo update-alternatives --remove-all gcc
67-
sudo update-alternatives --remove-all g++
68-
69-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60
70-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60
71-
72-
echo "Cocos uses GCC Version: `gcc --version`"
73-
echo "Cocos uses G++ Version: `g++ --version`"
74-
echo "Cocos uses ld Version: `ld --version`"
75-
echo "Cocos uses /usr/bin/ld Version: `/usr/bin/ld --version`"
76-
29+
sudo apt-get install --force-yes --yes $DEPENDS > /dev/null

tools/travis-scripts/before-install.sh

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ function install_android_ndk()
2424

2525
function install_linux_environment()
2626
{
27-
mkdir -p $HOME/bin
28-
pushd $HOME/bin
29-
30-
echo "GCC version: `gcc --version`"
3127
echo "Installing linux dependence packages ..."
3228
echo -e "y" | bash $COCOS2DX_ROOT/build/install-deps-linux.sh
3329
echo "Installing linux dependence packages finished!"

tools/travis-scripts/run-script.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ function do_retry()
2929

3030
function build_linux()
3131
{
32-
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
3332
echo "Building tests ..."
3433
cd $COCOS2DX_ROOT/build
3534
mkdir -p linux-build
3635
cd linux-build
3736
cmake ../..
38-
echo "cpu cores: ${CPU_CORES}"
39-
make -j${CPU_CORES} VERBOSE=1
37+
cmake --build .
4038
}
4139

4240
function build_mac()
@@ -375,14 +373,13 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
375373
update_cocos_files
376374
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l lua -p my.pack.qqqq cocos_new_test
377375
popd
378-
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
376+
379377
echo "Building tests ..."
380378
cd $COCOS2DX_ROOT/cocos_new_test
381379
mkdir -p linux-build
382380
cd linux-build
383381
cmake ..
384-
echo "cpu cores: ${CPU_CORES}"
385-
make -j${CPU_CORES} VERBOSE=1
382+
cmake --build .
386383
exit 0
387384
fi
388385
if [ $BUILD_TARGET == 'mac_cmake' ]; then

0 commit comments

Comments
 (0)