Add an environment variable to give the developer an option to disable apt-get usage

After the introduction of the "set -e" option, the build script fails on non debian/ubuntu linux distributions.

This is a quick fix to allow the users of distros other than debian/ubuntu to build the library, not a definitive solution.
The COCOS2DX_USEAPT environment variable can be set in the user shell config or used directly in
the command line: COCOS2DX_USEAPT=false ./make-all-linux-project.sh
This commit is contained in:
Roger Zanoni 2013-03-15 12:17:28 -04:00
parent 2fbd09fe27
commit 83d9dd33c2
1 changed files with 28 additions and 24 deletions

View File

@ -8,32 +8,36 @@
# Exit of first error.
set -e
DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' libglfw-dev'
DEPENDS+=' g++'
DEPENDS+=' libzip-dev'
DEPENDS+=' libcurl4-gnutls-dev'
DEPENDS+=' libfontconfig1-dev'
DEPENDS+=' libsqlite3-dev'
DEPENDS+=' libglew*-dev'
[ -z "$COCOS2DX_USEAPT" ] && COCOS2DX_USEAPT=true
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 "
if $COCOS2DX_USEAPT; then
DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' libglfw-dev'
DEPENDS+=' g++'
DEPENDS+=' libzip-dev'
DEPENDS+=' libcurl4-gnutls-dev'
DEPENDS+=' libfontconfig1-dev'
DEPENDS+=' libsqlite3-dev'
DEPENDS+=' libglew*-dev'
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
sudo apt-get --force-yes --yes install $MISSING
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
sudo apt-get --force-yes --yes install $MISSING
fi
# Change directory to the location of this script