Ok, I have created a new script for compiling both windows and linux builds on a linux machine. It runs more like a console application than a script that just performs one job. I will continue to work on this and add features/fixes if/when needed.
This script depends on Jaybird’s comment on naming dll’s properly.
Anyhow, here it is, just let me know if If anything needs to be added (or comments if I am doing this wrong, thanks).
Instructions on use:
- Copy to file of your choice (ie: compile.sh)
- Place file in a location in yur PATH for easier access (ie: /usr/local/bin)
- Be sure to replace the paths near the top of the script to what fits you. The server and client paths are not important unless you run a server for testing purposes locally.
- Open terminal and type 'sh ’
# Enemy Territory Compilation Script v1.2.2
# Written by =>ETK<=Elite
BASE_PATH="/usr/local/games/etkmod-1.0.0"
BUILD_PATH=$BASE_PATH/src
BIN_PATH=$BASE_PATH/bin
PAK_PATH=$BASE_PATH/pak
PAK_FILE="etkmod-1.0.0"
SERVER_OS="linux"
SERVER_PATH="/usr/local/games/enemy-territory/27960/etkmod"
CLIENT_PATH="/home/*****/.etwolf/etkmod"
title()
{
echo ""
echo "Enemy Territory Compilation Script v1.2.2 by =>ETK<= Elite"
}
check_root()
{
if [ "$UID" != "0" ]; then
echo "Must be root"
exit
fi
}
check_paths()
{
if [ ! -d $BASE_PATH ]; then
echo "ERROR: $BASE_PATH does not exist"
exit
fi
if [ ! -d $BUILD_PATH ]; then
echo "ERROR: $BUILD_PATH does not exist"
exit
fi
}
general_actions()
{
echo ""
echo "Please select an action to perform:"
echo " 1 - clean old builds"
echo " 2 - build linux module(s)"
echo " 3 - build win32 module(s)"
echo " 4 - build all modules for release"
echo " 5 - create pak file"
echo " 6 - install files on server"
echo " 7 - install files on client"
echo " 8 - list files in $BIN_PATH"
echo " 9 - list files in $PAK_PATH"
echo " 0 - exit"
read ga_answer
case $ga_answer in
"0") exit;;
"1") clean;;
"2") linux_actions;;
"3") win32_actions;;
"4") build_all_release;;
"5") create_pak;;
"6") install_server;;
"7") install_client;;
"8") list_bin;;
"9") list_pak;;
*) general_actions;;
esac
}
clean()
{
echo ""
echo "Cleaning old builds..."
cd $BUILD_PATH
scons -c
general_actions
}
linux_actions()
{
echo ""
echo "Which linux module(s) would you like to build?"
echo " 1 - build all modules for release"
echo " 2 - build qagame module for release"
echo " 3 - build cgame module for release"
echo " 4 - build ui module for release"
echo " 5 - return to previous screen"
read la_answer
case $la_answer in
"1") linux_build_all_final;;
"2") linux_build_qagame_final;;
"3") linux_build_cgame_final;;
"4") linux_build_ui_final;;
"5") general_actions;;
*) linux_actions;;
esac
general_actions
}
win32_actions()
{
echo ""
echo "Which win32 module(s) would you like to build?"
echo " 1 - build all modules for release"
echo " 2 - build qagame module for release"
echo " 3 - build cgame module for release"
echo " 4 - build ui module for release"
echo " 5 - return to previous screen"
read la_answer
case $la_answer in
"1") win32_build_all_final;;
"2") win32_build_qagame_final;;
"3") win32_build_cgame_final;;
"4") win32_build_ui_final;;
"5") general_actions;;
*) win32_actions;;
esac
general_actions
}
linux_build_qagame_final()
{
echo ""
echo "Cleaning old linux qagame modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f qagame.mp.i386.so ]; then
rm qagame.mp.i386.so
fi
cd $BUILD_PATH
scons -c
echo "Building qagame.mp.i386.so..."
scons CC=gcc CXX=g++ BUILD=release DEDICATED=1 TARGET_GAME=1 TARGET_CGAME=0 TARGET_UI=0 COPYBINS=1
}
linux_build_cgame_final()
{
echo ""
echo "Cleaning old linux cgame modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f cgame.mp.i386.so ]; then
rm cgame.mp.i386.so
fi
cd $BUILD_PATH
scons -c
echo "Building cgame.mp.i386.so..."
scons CC=gcc CXX=g++ BUILD=release DEDICATED=0 TARGET_GAME=0 TARGET_CGAME=1 TARGET_UI=0 COPYBINS=1
}
linux_build_ui_final()
{
echo ""
echo "Cleaning old linux ui modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f ui.mp.i386.so ]; then
rm ui.mp.i386.so
fi
cd $BUILD_PATH
scons -c
echo "Building ui.mp.i386.so..."
scons CC=gcc CXX=g++ BUILD=release DEDICATED=0 TARGET_GAME=0 TARGET_CGAME=0 TARGET_UI=1 COPYBINS=1
}
linux_build_all_final()
{
linux_build_qagame_final
linux_build_cgame_final
linux_build_ui_final
general_actions
}
win32_build_qagame_final()
{
echo ""
echo "Cleaning old win32 qagame modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f qagame_mp_x86.dll ]; then
rm qagame_mp_x86.dll
fi
cd $BUILD_PATH
scons -c
echo "Building qagame_mp_x86.dll..."
scons CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ BUILD=release DEDICATED=1 TARGET_GAME=1 TARGET_CGAME=0 TARGET_UI=0 COPYBINS=1
}
win32_build_cgame_final()
{
echo ""
echo "Cleaning old win32 cgame modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f cgame_mp_x86.dll ]; then
rm cgame_mp_x86.dll
fi
cd $BUILD_PATH
scons -c
echo "Building cgame_mp_x86.dll..."
scons CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ BUILD=release DEDICATED=0 TARGET_GAME=0 TARGET_CGAME=1 TARGET_UI=0 COPYBINS=1
}
win32_build_ui_final()
{
echo ""
echo "Cleaning old win32 ui modules..."
if [ ! -d $BIN_PATH ]; then
mkdir $BIN_PATH
fi
cd $BIN_PATH
if [ -f ui_mp_x86.dll ]; then
rm ui_mp_x86.dll
fi
cd $BUILD_PATH
scons -c
echo "Building ui_mp_x86.dll..."
scons CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ BUILD=release DEDICATED=0 TARGET_GAME=0 TARGET_CGAME=0 TARGET_UI=1 COPYBINS=1
}
win32_build_all_final()
{
win32_build_qagame_final
win32_build_cgame_final
win32_build_ui_final
general_actions
}
build_all_release()
{
linux_build_qagame_final
linux_build_cgame_final
linux_build_ui_final
win32_build_qagame_final
win32_build_cgame_final
win32_build_ui_final
general_actions
}
create_pak()
{
echo ""
echo "Creating pak..."
if [ ! -d $PAK_PATH ]; then
mkdir $PAK_PATH
fi
cd $PAK_PATH
if [ -f $PAK_FILE.pk3 ]; then
rm $PAK_FILE.pk3
fi
cd $BIN_PATH
if [ -f cgame.mp.i386.so ]; then
cp cgame.mp.i386.so $PAK_PATH
else
echo "ERROR: cgame.mp.i386.so does not exist in $BIN_PATH"
general_actions
fi
if [ -f cgame_mp_x86.dll ]; then
cp cgame_mp_x86.dll $PAK_PATH
else
echo "ERROR: cgame_mp_x86.dll does not exist in $BIN_PATH"
general_actions
fi
if [ -f ui.mp.i386.so ]; then
cp ui.mp.i386.so $PAK_PATH
else
echo "ERROR: ui.mp.i386.so does not exist in $BIN_PATH"
general_actions
fi
if [ -f ui_mp_x86.dll ]; then
cp ui_mp_x86.dll $PAK_PATH
else
echo "ERROR: ui_mp_x86.dll does not exist in $BIN_PATH"
general_actions
fi
cd $PAK_PATH
zip -r $PAK_FILE.zip *
mv $PAK_FILE.zip $PAK_FILE.pk3
general_actions
}
install_server()
{
echo ""
echo "Installing files on server..."
if [ $SERVER_OS = "linux" ]; then
cd $SERVER_PATH
if [ -f qagame.mp.i386.so ]; then
rm -f qagame.mp.i386.so
fi
cd $BIN_PATH
if [ -f qagame.mp.i386.so ]; then
cp qagame.mp.i386.so $SERVER_PATH
else
echo "ERROR: qagame.mp.i386.so does not exist in $BIN_PATH"
general_actions
fi
else
cd $SERVER_PATH
if [ -f qagame_mp_x86.dll ]; then
rm -f qagame_mp_x86.dll
fi
cd $BIN_PATH
if [ -f qagame_mp_x86.dll ]; then
cp qagame_mp_x86.dll $SERVER_PATH
else
echo "ERROR: qagame_mp_x86.dll does not exist in $BIN_PATH"
general_actions
fi
fi
if [ -d $PAK_PATH ]; then
cd $PAK_PATH
if [ -f $PAK_FILE.pk3 ]; then
cp $PAK_FILE.pk3 $SERVER_PATH
else
echo "ERROR: $PAK_FILE.pk3 does not exist"
fi
else
echo "ERROR: $PAK_FILE.pk3 does not exist"
fi
general_actions
}
install_client()
{
echo ""
echo "Installing files on client..."
if [ -d $PAK_PATH ]; then
cd $PAK_PATH
if [ -f $PAK_FILE.pk3 ]; then
cp $PAK_FILE.pk3 $CLIENT_PATH
else
echo "ERROR: $PAK_FILE.pk3 does not exist"
fi
else
echo "ERROR: $PAK_FILE.pk3 does not exist"
fi
general_actions
}
list_bin()
{
echo ""
echo "Contents of $BIN_PATH:"
dir $BIN_PATH
general_actions
}
list_pak()
{
echo ""
echo "Contents of $PAK_PATH:"
dir $PAK_PATH
general_actions
}
title
check_root
check_paths
general_actions