summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt19
-rw-r--r--README29
-rwxr-xr-xpackaging/linux/build.sh152
-rw-r--r--src/base/net_multiplayer.c2
-rw-r--r--src/base/path.h.in17
-rw-r--r--src/screen/screen_browser.c12
-rw-r--r--src/server/publicServer.c9
7 files changed, 144 insertions, 96 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dcb66d5..a876224 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,19 +11,20 @@
# -DWin=1 # build windows port
# -DNLS=1 # enable Gettext NLS
# -DApple=1 # build apple port
-# -CMAKE_INSTALL_PREFIX=/bla/ # install prefix
-# -CMAKE_DATA_PATH=/other/bla/ # install path for data
+# -DCMAKE_INSTALL_PREFIX=/bla/ # install prefix
+# -DCMAKE_DATA_PATH=/other/bla/ # install path for data
+# -DCMAKE_CONF_PATH=/etc # install path for data
+# -DLIB_INSTALL_DIR=/other/bla # install path for data
###############################################################################
-# OUR OWN CODE HACKS (WHEN CODE CLEANUP IS FINISHED REMOVE THIS)
-# ALSO CONTAINS IMPORTANT DEFINITIONS [PREFIX,...]
+# IMPORTANT DEFINITIONS [PREFIX,...]
###############################################################################
-ADD_DEFINITIONS ( -DSUPPORT_NET_UNIX_UDP )
SET ( TUXANCI_VERSION "9999" )
SET ( WORKDIR ${CMAKE_SOURCE_DIR}/src )
# data because some distributions want different data placement
-SET ( CMAKE_DATA_PATH "/usr/local/share/" CACHE PATH "Install path prefix" )
+SET ( CMAKE_CONF_PATH "/etc" CACHE PATH "Config path prefix" )
+SET ( CMAKE_DATA_PATH "/usr/local/share/" CACHE PATH "Data path prefix" )
+SET ( LIB_INSTALL_DIR "/usr/local/share/lib/" CACHE PATH "Library path prefix" )
SET ( CMAKE_INSTALL_PREFIX "/usr/local/" CACHE PATH "Install path prefix" )
-CONFIGURE_FILE ( ${WORKDIR}/base/path.h.in ${WORKDIR}/base/path.h )
###############################################################################
# BASIC PROJECT VALUES
###############################################################################
@@ -133,6 +134,9 @@ IF ( WIN )
SET ( SDLTTF_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/packaging/windows/SDL/include/" )
ENDIF ( NOT Server )
# override basic directory placement
+ SET ( CMAKE_CONF_PATH "../${APPNAME}/etc" CACHE PATH "Config path prefix" )
+ SET ( CMAKE_DATA_PATH "../${APPNAME}/share/" CACHE PATH "Data path prefix" )
+ SET ( CMAKE_INSTALL_PREFIX ".." CACHE PATH "Install path prefix" )
SET ( CMAKE_INSTALL_BINDIR ${APPNAME}/bin )
SET ( CMAKE_INSTALL_LIBDIR ${APPNAME}/lib )
SET ( CMAKE_INSTALL_DATADIR ${APPNAME}/share/ )
@@ -175,6 +179,7 @@ MESSAGE ( "Cflags:${CMAKE_C_FLAGS}" )
MESSAGE ( "CXXflags:${CMAKE_CXX_FLAGS}" )
MESSAGE ( STATUS "<Compiling SRC>" )
MESSAGE ( STATUS "<******************************>" )
+CONFIGURE_FILE ( ${WORKDIR}/base/path.h.in ${WORKDIR}/base/path.h )
ADD_SUBDIRECTORY ( src )
###############################################################################
# DATA INSTALLATION
diff --git a/README b/README
index 19ed75a..34af75f 100644
--- a/README
+++ b/README
@@ -59,12 +59,12 @@ HOWTO COMPILE
(all commands are supposed to be written in tuxanci sources directory)
Building Client
---------------
- $ cmake . -DNO_Audio=1 -DCMAKE_INSTALL_PREFIX=/usr/local/
+ $ cmake .
$ make
# make install
Building Server
--------------
- $ cmake . -DServer=1 -DCMAKE_INSTALL_PREFIX=/usr/local/
+ $ cmake .
$ make
# make install
Removing current install
@@ -80,19 +80,20 @@ HOWTO COMPILE
not specify PREFIX!! There is also known bug when in path to game dir
is space separator -> Compilation will die with error file not found,
you have to place source to some directory with no space in its path.
-
- Option -DNO_AUDIO=1 says we want no audio support for client so change
- if you want so.
-
- Server and client can be both on same computer they use different
- folders.
-
- Cleaning data from previous compilation "$ make clean".
- On Apple use please -DApple=1 variable for cmake.
-
- If you want another prefix than /usr/local/, you can achieve this by
- adding "-DCMAKE_INSTALL_PREFIX=/what/ever/you/want" as cmake argument.
+ # ADDITIONAL OPTIONS FOR CMAKE
+ # -DServer=1 # build server
+ # -DNO_Audio=1 # disable audio
+ # -DDebug=1 # enable debug
+ # -DCMAKE_C_FLAGS=-Wall # modification for CFLAGS
+ # -DWin=1 # build windows port
+ # -DNLS=1 # enable Gettext NLS
+ # -DApple=1 # build apple port
+ # -DCMAKE_INSTALL_PREFIX=/bla/ # install prefix
+ # -DCMAKE_DATA_PATH=/other/bla/ # install path for data
+ # -DCMAKE_CONF_PATH=/etc # install path for data
+ # -DLIB_INSTALL_DIR=/other/bla # install path for data
+
GAME USAGE
==========
diff --git a/packaging/linux/build.sh b/packaging/linux/build.sh
index 397767e..703d1e0 100755
--- a/packaging/linux/build.sh
+++ b/packaging/linux/build.sh
@@ -1,50 +1,120 @@
#!/bin/sh
-
-echo "*** GNU/Linux Binary Packager ***"
-
-if [ ! $1 ]; then
- echo "usage: $0 -v version -s"
- echo "eg.: \"$0 -v 0.4.0 -s\" will compile server without -s compile client"
+# Created by Tomas Chvatal (Scarabeus_IV)
+###############################################################################
+echo "<******************************>"
+echo "<GNU/Linux TUXANCI Binary Packager>"
+echo "<******************************>"
+# This tool is only for tuxanci game developers, don't use it for yourself
+###############################################################################
+# HELP
+###############################################################################
+if [ $1 == "help" ]; then
+ echo "usage: $0 -v version"
+ echo "-v 0.2.5 \"compile version 0.2.5\""
+ echo "!if no version is specified svn version is created!"
+ echo "!This build tool is for 64b version (creates 32b and 64b thought)!"
exit 1
fi
-SRV=""
-SRV_NAM=""
+###############################################################################
+# ARGUMENT PASSING
+###############################################################################
while getopts v:s arg
do
case $arg in
v) VERSION=${OPTARG};;
- s) SRV="-DServer=1"; SRV_NAM="server-";;
- *) echo "no arguments!"; exit 1;;
+ *) VERSION="9999";;
esac
done
-
-INSTALL_DIR="pkgs/tuxanci-${SRV_NAM}${VERSION}-linux"
-BUILD_DIR="../../"
-#SVN='https://opensvn.csie.org/tuxanci_ng/'
-log='linux.log'
-error="Error! See pkgs/${log} for more iformation"
-mkdir -p pkgs/tuxanci-${SRV_NAM}${VERSION}-linux || ( echo $error; exit 1 )
-touch pkgs/${log} || ( echo $error; exit 1 )
-echo "" > pkgs/${log} || ( echo $error; exit 1 )
-
-rm -rfv $INSTALL_DIR $BUILD_DIR > pkgs/"${log}" || ( echo $error; exit 1 )
-
-#echo "* Fetching files from SVN"
-#svn export $SVN $BUILD_DIR >> pkgs/"${log}" || ( echo $error; exit 1 )
-
-echo "* Configuring"
-echo "#define TUXANCI_VERSION \"${VERSION}\"" > $BUILD_DIR/config.h || ( echo $error; exit 1 )
-
-echo "* Compiling"
-prevdir=`pwd`
-cd $BUILD_DIR
-cmake . -DDebug=1 -DPREFIX=\\\"..\\\" -DCMAKE_INSTALL_PREFIX:PATH="${prevdir}/${INSTALL_DIR}" ${SRV} -DLIBDIR=\\\"../lib/\\\" >> "${prevdir}"/pkgs/"${log}" || ( echo $error; exit 1 )
-make >> "${prevdir}"/pkgs/"${log}" || ( echo $error; exit 1 )
-sudo make install >> "${prevdir}"/pkgs/"${log}" || ( echo $error; exit 1 )
-cd $prevdir
-
-echo "* Packaging"
-tar cjf "${INSTALL_DIR}".tar.bz2 $INSTALL_DIR || ( echo $error; exit 1 )
-
-echo "** GNU/Linux binary package is ready!"
-
+###############################################################################
+# VARIABLES
+###############################################################################
+APPNAME="tuxanci"
+SVN="https://opensvn.csie.org/tuxanci_ng/"
+BUNDLE_PREFIX="${HOME}/tuxanci-bundle"
+LOG="${BUNDLE_PREFIX}/linux.log"
+SOURCE="${BUNDLE_PREFIX}/source"
+D="${BUNDLE_PREFIX}/${APPNAME}"
+ARCHS="32b 64b"
+ERROR_MESSAGE="Check ${LOG}, cause i was unable to finish my stuff correctly!"
+CMAKE_PARAMS="-DCMAKE_INSTALL_PREFIX=\"..\""
+###############################################################################
+# PREPARING ENVIROMENT
+###############################################################################
+mkdir -p ${BUNDLE_PREFIX} || ( echo "I was unable to create working directory"; exit 1 )
+touch ${LOG} || ( echo "I was unable to create log file"; exit 1 )
+echo "" > ${LOG} # LOG CLEANUP
+echo "<******************************>"
+echo "<Downloading files from SVN repository>"
+echo "<******************************>"
+svn export $SVN ${SOURCE} >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+for X in ${ARCHS}; do
+if [ ${X} == "32b" ]; then
+ CMAKE_PARAMS="${CMAKE_PARAMS} -DCMAKE_C_FLAGS=-m32"
+fi
+###############################################################################
+# BUILDING CLIENT
+###############################################################################
+echo "<******************************>"
+echo "<Building Client ${X}>"
+echo "<******************************>"
+cd ${SOURCE}
+cmake . ${CMAKE_PARAMS} >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+make >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+make install DESTDIR="${D}_client-${X}/" >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+###############################################################################
+# SRC CLEANUP
+###############################################################################
+rm CMakeCache.txt || ( echo "I was unable to cleanup CMakeCache.txt"; exit 1; )
+make clean
+###############################################################################
+# BUILDING SERVER
+###############################################################################
+echo "<******************************>"
+echo "<Building Server ${X}>"
+echo "<******************************>"
+cd ${SOURCE}
+cmake . ${CMAKE_PARAMS} -DServer=ON >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+make >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+make install DESTDIR="${D}_server-${X}/" >> "${LOG}" || ( echo "${ERROR_MESSAGE}"; exit 1 )
+###############################################################################
+# SRC CLEANUP
+###############################################################################
+rm CMakeCache.txt || ( echo "I was unable to cleanup CMakeCache.txt"; exit 1; )
+make clean
+###############################################################################
+done
+# DESTRUCTION OF SRC
+###############################################################################
+cd ${BUNDLE_PREFIX}
+rm -rf ${SOURCE}
+###############################################################################
+# BUILDING TARS
+###############################################################################
+echo "<******************************>"
+echo "<Creating tar.bz2 archives>"
+echo "<******************************>"
+for X in ${ARCHS}; do
+ for Y in "client server"; do
+ tar cjf "${APPNAME}_${Y}-${X}.tar.bz2" "${APPNAME}_${Y}-${X}/"
+ done
+done
+###############################################################################
+# DESTRUCTION OF UNPACKED BINARIES
+###############################################################################
+for X in ${ARCHS}; do
+ for Y in "client server"; do
+ rm -rf "${APPNAME}_${Y}-${X}/"
+ done
+done
+###############################################################################
+# SHOW WHAT HAVE WE DONE
+###############################################################################
+echo "<******************************>"
+echo "<What have i created :>"
+echo "<******************************>"
+find type -f ./ -maxdepth 1 -print
+echo "<******************************>"
+echo "<******************************>"
+echo "<GNU/Linux binary packages are ready>"
+echo "<******************************>"
+echo "<******************************>"
diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c
index d0732d7..a2ec849 100644
--- a/src/base/net_multiplayer.c
+++ b/src/base/net_multiplayer.c
@@ -12,9 +12,7 @@
#include "net_multiplayer.h"
#include "server.h"
-#ifdef SUPPORT_NET_UNIX_UDP
#include "udp.h"
-#endif
#ifndef PUBLIC_SERVER
#include "screen_setting.h"
diff --git a/src/base/path.h.in b/src/base/path.h.in
index 696ca36..c9f9a53 100644
--- a/src/base/path.h.in
+++ b/src/base/path.h.in
@@ -1,26 +1,21 @@
#ifndef PATH_H
#cmakedefine USE_MAGICK
- #define TUXANCI_VERSION "@TUXANCI_VERSION@"
+ #define TUXANCI_VERSION "@TUXANCI_VERSION@"
#define PATH_H
- #ifndef __WIN32__
- #define PREFIX "@CMAKE_INSTALL_PREFIX@"
- #define PATH_DIR "@CMAKE_DATA_PATH@" "/" APPNAME "/"
- #else
- #define PREFIX ".."
- #define PATH_DIR PREFIX "/share/" APPNAME "/"
- #endif
+ #define PREFIX "@CMAKE_INSTALL_PREFIX@"
+ #define PATH_DIR "@CMAKE_DATA_PATH@" "/" APPNAME "/"
#ifdef PUBLIC_SERVER
#define APPNAME "tuxanci-server"
+ #define SERVER_CONFIG "@CMAKE_CONF_PATH@" "/" APPNAME "/server.conf"
#else
#define APPNAME "tuxanci"
#endif
+ // windows bug
#ifndef __WIN32__
- #define PATH_MODULES PREFIX "/lib/" APPNAME "/"
- #define SERVER_CONFIG "/etc/tuxanci-server/server.conf"
+ #define PATH_MODULES "@LIB_INSTALL_DIR@" "/" APPNAME "/"
#else
#define PATH_MODULES PREFIX "/bin/"
- #define SERVER_CONFIG PREFIX "/etc/tuxanci-server/server.conf"
#endif
#define PATH_IMAGE PATH_DIR "images/"
#define PATH_FONT PATH_DIR "font/"
diff --git a/src/screen/screen_browser.c b/src/screen/screen_browser.c
index bb2f1a7..ae4a7d5 100644
--- a/src/screen/screen_browser.c
+++ b/src/screen/screen_browser.c
@@ -14,7 +14,6 @@
#include "screen.h"
#include "image.h"
-#ifdef SUPPORT_NET_UNIX_UDP
#ifndef __WIN32__
#include <sys/socket.h>
@@ -36,7 +35,6 @@
#include "dns.h"
extern int errno;
-#endif
#ifndef NO_SOUND
#include "music.h"
@@ -204,7 +202,6 @@ server_t *server_getcurr ()
int server_getinfo (server_t *server)
{
-#ifdef SUPPORT_NET_UNIX_UDP
struct sockaddr_in srv;
int mySocket;
@@ -326,10 +323,6 @@ int server_getinfo (server_t *server)
#endif
server->ping = 1000 - (tv.tv_usec/1000);
-#else
- return 0;
-#endif
-
/*
["name: F\n"] >= svn82
"version: svnX\n"
@@ -435,7 +428,6 @@ static int LoadServers ()
char buf[1025];
/* TODO: dodelat TCP makro */
-#ifdef SUPPORT_NET_UNIX_UDP
struct sockaddr_in server;
char *master_server_ip;
@@ -525,10 +517,6 @@ static int LoadServers ()
WSACleanup();
#endif
-#else
- return -1;
-#endif
-
if (len <= 0)
return 0;
diff --git a/src/server/publicServer.c b/src/server/publicServer.c
index 5b96dea..e3df462 100644
--- a/src/server/publicServer.c
+++ b/src/server/publicServer.c
@@ -6,7 +6,6 @@
#include <signal.h>
#include <time.h>
-#ifdef SUPPORT_NET_UNIX_UDP
#ifndef __WIN32
#include <sys/socket.h>
#include <sys/select.h>
@@ -19,7 +18,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#endif
#include "main.h"
#include "list.h"
@@ -45,11 +43,9 @@ static int arenaId;
static arena_t *arena;
static bool_t isSignalEnd;
-#ifdef SUPPORT_NET_UNIX_UDP
extern int errno;
#define __PACKED__ __attribute__ ((__packed__))
-#endif
void countRoundInc()
{
@@ -69,7 +65,6 @@ static int registerPublicServer()
#endif
/* TODO: dodelat TCP makro */
-#ifdef SUPPORT_NET_UNIX_UDP
struct sockaddr_in server;
char *master_server_ip;
@@ -191,10 +186,6 @@ static int registerPublicServer()
closesocket(s);
#endif
-#else
- return -1;
-#endif
-
return 0;
}