mirror of https://github.com/axmolengine/axmol.git
Fix package installation in make-all-linux-project
There was a bug where missing packages would cause the script to exit. This change also makes several improvements: - script can now be run from anywhere (not only the cocos root) - apt-get is called only once to install all missing packages (this makes output much more informative on first use) - added comment/docs to the top of the script
This commit is contained in:
parent
73c168239c
commit
3b6e2e7f41
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
# This script will perform a clean linux build of all targets in both
|
||||
# debug and release configurations. It will also ensure that all the required
|
||||
# packages are installed. For day-to-day work on the linux port it is
|
||||
# faster/better to simply use 'make' either at the top level or in the subpject
|
||||
# you are working on.
|
||||
|
||||
# Exit of first error.
|
||||
set -e
|
||||
|
||||
TXTCOLOR_DEFAULT="\033[0;m"
|
||||
TXTCOLOR_GREEN="\033[0;32m"
|
||||
|
||||
COCOS2DX_ROOT=`pwd`
|
||||
|
||||
DEPENDS='libx11-dev'
|
||||
DEPENDS+=' libxmu-dev'
|
||||
DEPENDS+=' libglu1-mesa-dev'
|
||||
|
@ -21,16 +21,23 @@ DEPENDS+=' libfontconfig1-dev'
|
|||
DEPENDS+=' libsqlite3-dev'
|
||||
DEPENDS+=' libglew*-dev'
|
||||
|
||||
MISSING=
|
||||
echo "Checking for missing packages ..."
|
||||
for i in $DEPENDS; do
|
||||
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed")
|
||||
echo Checking for $i: $PKG_OK
|
||||
if [ "" == "$PKG_OK" ]; then
|
||||
echo -e $TXTCOLOR_GREEN"No $i. Setting up $i, please enter your password:"$TXTCOLOR_DEFAULT
|
||||
sudo apt-get --force-yes --yes install $i
|
||||
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
|
||||
MISSING+=$i
|
||||
fi
|
||||
done
|
||||
|
||||
cd $COCOS2DX_ROOT
|
||||
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
|
||||
sudo apt-get --force-yes --yes install $MISSING
|
||||
fi
|
||||
|
||||
# Change directory to the location of this script
|
||||
cd $(dirname ${BASH_SOURCE[0]})
|
||||
|
||||
export MAKEFLAGS=-j10
|
||||
|
||||
|
|
Loading…
Reference in New Issue