west.logan wrote:
There
It's a worthy cause.
Thank you kind sir
I've just tested the script on Xubuntu 10.10 which uses sudo and it works as expected.
#!/bin/bash
#------------------------------------------------------------------------------
# DROD: Architect's Edition 1.6 CVS build script v1 (c) Thunor 2011 GNU GPL v3
#
# This script will download DROD: Architect's Edition 1.6 from CVS, metakit
# 2.4.9.7 and fmod 3.75 and compile and install them on *nix.
#
# Everything is downloaded to and built within $HOME/Source/drod-ae.
# metakit is installed to /usr/lib and /usr/include.
# fmod is installed to /usr/lib and /usr/include/fmod.
# drod-ae is installed to $HOME/Games/drod-ae.
#
# If the above destinations don't suit you then modify the variables directly
# below this header.
#
# Also, installing into the system requires superuser privileges, but I don't
# know if you're using su or sudo, so set-up USE_SU and USE_SUDO below.
#------------------------------------------------------------------------------
# These few variables are user-configurable.
DROD_SRC="$HOME/Source/drod-ae"
METAKIT_PREFIX=/usr
FMOD_PREFIX=/usr
DROD_DEST='$(HOME)/Games/drod-ae'
# Comment out the one that you don't use.
USE_SU=su
#USE_SUDO=sudo
# If the user is already root then ignore USE_SU and USE_SUDO.
if [ $USER = root ]; then USE_SU=; USE_SUDO=; fi
#------------------------------------------------------------------------------
# Create the build folder, download and check for the necessary files.
#------------------------------------------------------------------------------
mkdir -p "$DROD_SRC"
cd "$DROD_SRC"
wget -nc -c http://equi4.com/pub/mk/metakit-2.4.9.7.tar.gz
wget -nc -c http://www.fmod.org/files/fmod3/fmodapi375linux.tar.gz
wget -nc -c http://drod.cvs.sourceforge.net/viewvc/drod/?view=tar -O drod-ae.tar.gz
wget -nc -c "http://gcc.gnu.org/cgi-bin/cvsweb.cgi/~checkout~/gcc/libstdc++-v3/include/ext/pod_char_traits.h?rev=1.4&content-type=text/plain" -O pod_char_traits.h
if [ ! -e metakit-2.4.9.7.tar.gz ]; then echo "ERROR: metakit-2.4.9.7.tar.gz not found"; exit; fi
if [ ! -e fmodapi375linux.tar.gz ]; then echo "ERROR: fmodapi375linux.tar.gz not found"; exit; fi
if [ ! -e drod-ae.tar.gz ]; then echo "ERROR: drod-ae.tar.gz not found"; exit; fi
if [ ! -e pod_char_traits.h ]; then echo "ERROR: pod_char_traits.h not found"; exit; fi
#------------------------------------------------------------------------------
# Compile and install metakit-2.4.9.7.
#------------------------------------------------------------------------------
cd "$DROD_SRC"
tar xzvf metakit-2.4.9.7.tar.gz
cd metakit-2.4.9.7/builds
../unix/configure --prefix=$METAKIT_PREFIX
make
echo "*** You may be required to type your superuser password here: ***";
if [ -n "$USE_SU" ]; then su; fi
$USE_SUDO make install
if [ -n "$USE_SU" ]; then exit; fi
#------------------------------------------------------------------------------
# Compile and install fmodapi375linux.
#------------------------------------------------------------------------------
cd "$DROD_SRC"
tar xzvf fmodapi375linux.tar.gz
cd fmodapi375linux/api
echo "*** You may be required to type your superuser password here: ***";
if [ -n "$USE_SU" ]; then su; fi
$USE_SUDO cp libfmod-3.75.so $FMOD_PREFIX/lib/
$USE_SUDO mkdir $FMOD_PREFIX/include/fmod
$USE_SUDO cp inc/* $FMOD_PREFIX/include/fmod
$USE_SUDO ldconfig
if [ -n "$USE_SU" ]; then exit; fi
#------------------------------------------------------------------------------
# Extract and fix drod-ae's source files.
#------------------------------------------------------------------------------
cd "$DROD_SRC"
tar xzvf drod-ae.tar.gz
mkdir drod/Caravel/ext
cp pod_char_traits.h drod/Caravel/ext/
sed -i 's/#include <string>/#include <cstring>/' drod/Caravel/ext/pod_char_traits.h
sed -i 's/# include <fcntl.h>/# include <fcntl.h>\n# include <cstdlib>\n# include <limits.h>/' drod/Caravel/BackEndLib/Files.cpp
sed -i 's/# include <ctype.h>/# include <ctype.h>\n# include <cstdio>/' drod/Caravel/BackEndLib/IniFile.cpp
sed -i 's/#include \"Wchar.h\"/#include <cstdlib>\n#include <cstdio>\n#include \"Wchar.h\"/' drod/Caravel/BackEndLib/Wchar.cpp
sed -i 's/^#include <fmod.h>/#include <fmod\/fmod.h>/' drod/Caravel/FrontEndLib/Sound.h
sed -i 's|const int X_OK |//const int X_OK |' drod/Caravel/FrontEndLib/Screen.cpp
#------------------------------------------------------------------------------
# Tweak the Config file, compile and install drod-ae.
#------------------------------------------------------------------------------
cd "$DROD_SRC"
sed -i 's/INSTALL_TYPE = local/INSTALL_TYPE = one/' drod/Caravel/Master/Linux/Config
sed -i "s|prefix = opt/games/drod|prefix = $DROD_DEST|" drod/Caravel/Master/Linux/Config
sed -i 's/LIBRARY_FMOD=fmod-3.74.1/LIBRARY_FMOD=fmod-3.75/' drod/Caravel/Master/Linux/Config
sed -i 's/INST_DAT_DIRS = -m 0775 -g games/INST_DAT_DIRS = -m 0775/' drod/Caravel/Master/Linux/Config
sed -i 's/INST_DAT_FILES = -m 0664 -g games/INST_DAT_FILES = -m 0664/' drod/Caravel/Master/Linux/Config
cd drod/Caravel/Master/Linux
make drod-custom
make install
#------------------------------------------------------------------------------
# Tidy-up from any previous installation so that the correct data path is set.
#------------------------------------------------------------------------------
rm ~/.caravel/drod-1_6/DataPath.txt
I've noticed that the code above is being rendered with an extra semi-colon after the last double-quote on the wget pod_char_traits.h line (I've just diffed it), so if you're going to use it then I recommend you download the
attachment.
[Last edited by Thunor at 05-05-2011 10:48 PM]