2013-12-26 18:28:21 +01:00
#!/bin/bash
2012-07-12 19:03:37 +00:00
#
2011-12-14 07:40:48 +00:00
# Use this script to install build dependencies on a number of Linux platforms
# ----------------------------------------------------------------------------
2012-07-12 19:03:37 +00:00
# Originally written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# Rewritten by Tom Reynolds <tomreyn@megaglest.org>
# Copyright (c) 2012 Mark Vejvoda, Tom Reynolds under GNU GPL v3.0
2010-04-19 05:39:03 +00:00
2011-11-30 05:10:04 +00:00
2012-07-12 19:03:37 +00:00
LANG = C
2010-04-19 05:39:03 +00:00
2013-12-26 18:28:21 +01:00
SCRIPTDIR = " $( dirname $( readlink -f $0 ) ) "
gitcommit = ` git log -1 --pretty= tformat:"%H" $SCRIPTDIR /../..`
# Load shared functions
. $SCRIPTDIR /mg_shared.sh
2012-07-12 19:03:37 +00:00
# Got root?
if [ ` id -u` 'x' != '0x' ]
then
echo 'This script must be run as root (UID 0).' >& 2
exit 1
fi
2013-12-08 22:03:34 +01:00
# Do you have the 'git' command?
if [ ` which git` 'x' = 'x' ]
2012-07-12 19:03:37 +00:00
then
2013-12-08 22:03:34 +01:00
echo 'Could not find "git", please make sure it is installed.' >& 2
2012-07-12 19:03:37 +00:00
exit 1
2010-06-07 05:32:41 +00:00
fi
2013-12-08 22:03:34 +01:00
# Allow for quiet/silent installs
if [ $1 'x' = '-qx' -o $1 'x' = '--quietx' -o $1 'x' = '--silentx' ]
then
quiet = 1
else
quiet = 0
fi
2013-12-26 18:28:21 +01:00
# Included from shared functions
detect_system
2013-12-08 22:03:34 +01:00
2012-07-12 19:03:37 +00:00
echo 'We have detected the following system:'
echo ' [ ' " $distribution " ' ] [ ' " $release " ' ] [ ' " $codename " ' ] [ ' " $architecture " ' ]'
echo ''
echo 'On supported systems, we will now install build dependencies.'
echo ''
# Until this point you may cancel without any modifications applied
#exit 0
unsupported_distribution ( ) {
echo 'Unsupported Linux distribution.' >& 2
echo ''
echo 'Please report a bug at http://bugs.megaglest.org providing the following information:'
echo '--- snip ---'
2013-12-26 18:28:21 +01:00
echo 'Git revision: ' " $gitcommit "
2012-07-12 19:03:37 +00:00
echo 'LSB support: ' " $lsb "
echo 'Distribution: ' " $distribution "
echo 'Release: ' " $release "
echo 'Codename: ' " $codename "
2013-05-15 03:18:31 +00:00
echo 'Architecture: ' " $architecture "
2012-07-12 19:03:37 +00:00
echo '--- snip ---'
echo ''
echo 'For now, you may want to take a look at the build hints on the MegaGlest wiki at http://wiki.megaglest.org/'
echo 'If you can come up with something which works for you, please report back to us, too. Thanks!'
}
unsupported_release ( ) {
2013-01-25 19:34:10 +00:00
echo 'Unsupported ' " $distribution " ' release.' >& 2
2012-07-12 19:03:37 +00:00
echo ''
echo 'Please report a bug at http://bugs.megaglest.org providing the following information:'
echo '--- snip ---'
2013-12-26 18:28:21 +01:00
echo 'Git revision: ' " $gitcommit "
2012-07-12 19:03:37 +00:00
echo 'LSB support: ' " $lsb "
echo 'Distribution: ' " $distribution "
echo 'Release: ' " $release "
echo 'Codename: ' " $codename "
2013-05-15 03:18:31 +00:00
echo 'Architecture: ' " $architecture "
2012-07-12 19:03:37 +00:00
echo '--- snip ---'
echo ''
2013-01-25 19:34:10 +00:00
if [ " $installcommand " != '' ]
2012-07-12 19:03:37 +00:00
then
echo 'For now, please try this (which works with other ' " $distribution " ' releases) and report back how it works for you:'
2013-01-25 19:34:10 +00:00
echo $installcommand
2012-07-12 19:03:37 +00:00
echo 'Thanks!'
fi
}
error_during_installation ( ) {
echo 'An error occurred while installing build dependencies.' >& 2
echo ''
echo 'Please report a bugs at http://bugs.megaglest.org providing the following information:'
echo '--- snip ---'
2013-12-26 18:28:21 +01:00
echo 'Git revision: ' " $gitcommit "
2012-07-12 19:03:37 +00:00
echo 'LSB support: ' " $lsb "
echo 'Distribution: ' " $distribution "
echo 'Release: ' " $release "
echo 'Codename: ' " $codename "
2013-05-15 03:18:31 +00:00
echo 'Architecture: ' " $architecture "
2012-07-12 19:03:37 +00:00
echo '--- snip ---'
echo ''
echo 'For now, you may want to take a look at the build hints on the MegaGlest wiki at http://wiki.megaglest.org/'
echo 'If you can come up with something which works for you, please report back to us, too. Thanks!'
}
case $distribution in
2013-12-08 22:03:34 +01:00
Debian)
if [ $quiet = 1 ] ; then
APT_OPTIONS = " $APT_OPTIONS -y -q "
fi
2012-07-12 19:03:37 +00:00
case $release in
2013-06-21 14:44:53 +00:00
6.0*| unstable)
2012-07-14 19:44:25 +00:00
# No libvlc-dev since version (1.1.3) in Debian 6.0/Squeeze is incompatible, no libluajit-5.1-dev because it is not available on Debian 6.0/Squeeze, cf. http://glest.org/glest_board/?topic=8460
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libminiupnpc-dev librtmp-dev libgtk2.0-dev libcppunit-dev'
2013-01-25 19:34:10 +00:00
$installcommand
2012-09-25 22:29:24 +00:00
if [ $? != 0 ] ; then
error_during_installation;
echo ''
echo 'Be sure to have the squeeze-backports repository installed, it is required for libminiupnpc-dev.'
exit 1;
fi
2012-07-12 19:03:37 +00:00
; ;
*)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libminiupnpc-dev librtmp-dev libgtk2.0-dev libcppunit-dev'
2012-07-12 19:03:37 +00:00
unsupported_release
exit 1
; ;
esac
; ;
Ubuntu)
2013-12-08 22:03:34 +01:00
if [ $quiet = 1 ] ; then
APT_OPTIONS = " $APT_OPTIONS -y -q "
fi
2012-07-12 19:03:37 +00:00
case $release in
8.04)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libcppunit-dev'
2013-01-25 19:34:10 +00:00
$installcommand
2012-07-12 19:03:37 +00:00
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
2012-07-18 18:36:03 +00:00
10.04)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew1.5-dev libftgl-dev libfribidi-dev libcppunit-dev'
2013-01-25 19:34:10 +00:00
$installcommand
2012-07-18 18:36:03 +00:00
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
2013-10-23 12:34:32 +00:00
11.10| 12.04| 12.10| 13.04| 13.10)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev'
2013-01-25 19:34:10 +00:00
$installcommand
2012-07-12 19:03:37 +00:00
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
*)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev'
2012-07-12 19:03:37 +00:00
unsupported_release
exit 1
; ;
esac
; ;
2012-10-31 14:50:23 +00:00
LinuxMint)
2013-12-08 22:03:34 +01:00
if [ $quiet = 1 ] ; then
APT_OPTIONS = " $APT_OPTIONS -y -q "
fi
2012-10-31 14:50:23 +00:00
case $release in
2013-07-12 10:28:59 +00:00
13| 14| 15)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev'
2013-01-25 19:34:10 +00:00
$installcommand
2012-10-31 14:50:23 +00:00
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
*)
2013-12-08 22:03:34 +01:00
installcommand = 'apt-get install ' " $APT_OPTIONS " ' build-essential cmake libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev'
2012-10-31 14:50:23 +00:00
unsupported_release
exit 1
; ;
esac
; ;
2013-01-07 15:37:48 +00:00
SuSE| SUSE?LINUX| Opensuse)
2012-07-12 19:03:37 +00:00
case $release in
2013-03-05 19:31:09 +00:00
11.2| 11.3| 11.4| 12.1)
2013-12-08 22:03:34 +01:00
installcommand = 'zypper install gcc gcc-c++ cmake libSDL-devel libxerces-c-devel MesaGLw-devel freeglut-devel libvorbis-devel wxGTK-devel lua-devel libjpeg-devel libpng14-devel libcurl-devel openal-soft-devel xorg-x11-libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
2013-01-25 19:34:10 +00:00
$installcommand
2012-07-12 19:03:37 +00:00
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
2013-03-05 19:31:09 +00:00
12.2)
2013-12-08 22:03:34 +01:00
installcommand = 'zypper install gcc gcc-c++ cmake libSDL-devel libxerces-c-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxGTK-devel lua-devel libjpeg-devel libpng14-devel libcurl-devel openal-soft-devel xorg-x11-libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
2013-03-05 19:31:09 +00:00
$installcommand
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
; ;
*)
2013-12-08 22:03:34 +01:00
installcommand = 'zypper install gcc gcc-c++ cmake libSDL-devel libxerces-c-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxGTK-devel lua-devel libjpeg-devel libpng14-devel libcurl-devel openal-soft-devel xorg-x11-libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
2012-07-12 19:03:37 +00:00
unsupported_release
exit 1
; ;
esac
; ;
Fedora)
case $release in
2013-07-05 16:30:27 +00:00
13| 14| 15| 16| 17| 18)
2013-06-22 18:08:35 +00:00
installcommand = 'yum groupinstall development-tools'
2013-01-25 19:34:10 +00:00
$installcommand
if [ $? != 0 ] ; then error_during_installation; exit 1; fi
2013-06-22 18:08:35 +00:00
2013-12-08 22:03:34 +01:00
installcommand = 'yum install cmake SDL-devel xerces-c-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
2013-06-22 18:08:35 +00:00
$installcommand
2012-07-12 19:03:37 +00:00
; ;
*)
2013-12-08 22:03:34 +01:00
installcommand = 'yum groupinstall "Development Tools"; yum install cmake SDL-devel xerces-c-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
2012-07-12 19:03:37 +00:00
unsupported_release
exit 1
; ;
esac
; ;
2012-07-14 19:44:25 +00:00
archlinux)
case $release in
rolling)
unsupported_release
exit 1
; ;
esac
; ;
2012-07-12 19:03:37 +00:00
# Redhat)
#
# ;;
#
# Mandrake|Mandriva)
#
# ;;
*)
unsupported_distribution
exit 1
; ;
esac
echo ''
echo 'Installation of build dependencies complete.'