Ceci est une ancienne révision du document !


Compilation du client

Compilation du client sous linux

Compilation dynamique

Pour compiler le client, il faut déjà récupérer les sources sur l’espace téléchargement (sources officielles) ou sur le serveur subversion (en cours de développement).

Il faut ensuite se positionner dans le répertoire NouveauClient/trunk/client_sources, et taper la commande make -f Makefile.linux ce qui va créer le fichier le.x86.linux.bin. Si on veut diminuer la taille de l’exécutable, il suffit de taper la commande strip le.x86.linux.bin

Compilation statique

La première solution, est d’avoir les différentes bibliothèques statiques directement sur la distribution, mais comme c’est un cas assez rare, on va plutôt suivre un autre méthode.

Le principe va être de récupérer les sources des différentes bibliothèques directement sur leur site officiel et de les compiler. Pour simplifier cette partie, voici un script qui va faire le travail tout seul (récupérer les archives et les compiler). Attention ce script n’est pas sécurisé et n’est pas tellement propre, donc faire attention en l’utilisant.

#!/bin/sh

REP_SOURCES="/opt/landes/NouveauClient/trunk/client_sources/"
REP_LIBS="$REP_SOURCES/libs"
OPENAL="openal-soft-1.7.411"
CAL3D="cal3d_0.10.0+0.11.0+rc2"
SDL="SDL-1.2.13"
SDL_IMAGE="SDL_image-1.2.7"
SDL_NET="SDL_net-1.2.7"
VORBIS="libvorbis-1.2.0"
OGG="libogg-1.1.3"
XML="libxml2-2.7.3"
PNG="libpng-1.2.35"
ALSA="alsa-lib-1.0.19"

if [ ! -e "$REP_LIBS" ]; then
    mkdir $REP_LIBS
fi

cd $REP_LIBS

#########################
# Compilation de OpenAL #
#########################
wget http://kcat.strangesoft.net/openal-releases/$OPENAL.tar.bz2
tar xjf $OPENAL.tar.bz2
cd $OPENAL
sed -i 's/SHARED/STATIC/' CMakeLists.txt
cd CMakeConf/
cmake ..
make
cp libopenal.a ../../
cd $REP_LIBS

########################
# Compilation de Cal3D #
########################
wget http://download.gna.org/cal3d/cal3d/gnulinux/debian/dapper/src/$CAL3D.orig.tar.gz
tar xzf $CAL3D.orig.tar.gz
cd cal3d-0.10.0+0.11.0+rc2
./configure --enable-static --disable-shared
make
cp src/cal3d/.libs/libcal3d.a ../
cd $REP_LIBS

######################
# Compilation de SDL #
######################
wget http://www.libsdl.org/release/$SDL.tar.gz
tar xzf $SDL.tar.gz
cd $SDL
./configure --disable-shared --disable-video-directfb
make
cp build/.libs/libSDL.a ../
cd $REP_LIBS

############################
# Compilation de SDL_image #
############################
wget http://www.libsdl.org/projects/SDL_image/release/$SDL_IMAGE.tar.gz
tar xzf $SDL_IMAGE.tar.gz
cd $SDL_IMAGE
./configure --disable-shared
make
cp .libs/libSDL_image.a ../
cd $REP_LIBS

##########################
# Compilation de SDL_net #
##########################
wget http://www.libsdl.org/projects/SDL_net/release/$SDL_NET.tar.gz
tar xzf $SDL_NET.tar.gz
cd $SDL_NET
./configure --disable-shared
make
cp .libs/libSDL_net.a ../
cd $REP_LIBS

#########################
# Compilation de Vorbis #
#########################
wget http://downloads.xiph.org/releases/vorbis/$VORBIS.tar.gz
tar xzf $VORBIS.tar.gz
cd $VORBIS
./configure --disable-shared --enable-static
make
cp lib/.libs/libvorbis.a ../
cp lib/.libs/libvorbisfile.a ../
cd $REP_LIBS

######################
# Compilation de Ogg #
######################
wget http://downloads.xiph.org/releases/ogg/$OGG.tar.gz
tar xzf $OGG.tar.gz
cd $OGG
./configure --disable-shared --enable-static
make
cp src/.libs/libogg.a ../
cd $REP_LIBS

######################
# Compilation de XML #
######################
wget ftp://xmlsoft.org/libxml2/$XML.tar.gz
tar xzf $XML.tar.gz
cd $XML
./configure --disable-shared --enable-static
make
cp .libs/libxml2.a ../
cd $REP_LIBS

######################
# Compilation de PNG #
######################
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/$PNG.tar.bz2
tar xjf $PNG.tar.bz2
cd $PNG
./configure --disable-shared --enable-static
make
cp .libs/libpng.a ../
cd $REP_LIBS

#######################
# Compilation de ALSA #
#######################
wget ftp://ftp.task.gda.pl/pub/linux/misc/alsa/lib/$ALSA.tar.bz2
tar xjf $ALSA.tar.bz2
cd $ALSA
./configure --disable-shared --enable-static
make
cp src/.libs/libasound.a ../
cd $REP_LIBS

Lorsque toutes les bibliothèques sont récupérer, il faut taper la commande make static -f Makefile.linux, ce qui va compiler les sources et créer le fichier le.x86.static.linux.bin. Pour diminuer la taille de l’exécutable, il faut taper la commande strip le.x86.static.linux.bin.