ClanLib does not provide Linux binaries, and if your distribution does, they may well be out of date (e.g. Ubuntu 10.04's libclanlib-dev is ClanLib 1.0). The recommended way to install ClanLib on Linux is hence to compile it from source, as follows.
Contents |
ClanLib requires a C++ compiler and a number of other libraries; how to install these depends on which Linux distribution you are using. The following command downloads and installs everything required to allow use of all parts of ClanLib. If you have a slow connection and only intend to use some ClanLib modules, you may want to look at the #Module-by-module dependency list instead.
sudo apt-get install automake autoconf autotools-dev m4 libtool libc6-dev linux-libc-dev g++ \ zlib1g zlib1g-dev libpng12-0 libpng12-dev libjpeg62-dev libfreetype6 libfreetype6-dev \ x11proto-xf86vidmode-dev libxxf86vm-dev libfontconfig1-dev libxi-dev libgl1-mesa-dev \ libice-dev libsm-dev libx11-dev libxau-dev libxdmcp-dev libxext-dev libxt-dev mesa-common-dev \ x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xtrans-dev libasound2-dev \ libmikmod2 libmikmod2-dev libvorbis0a libvorbis-dev libogg-dev libpcre3 libpcre3-dev make
Download the latest ClanLib release source archive and extract it. Alternatively, if you want the very latest features and are willing to live with a higher risk of bugs, download the current development source code from the subversion repository.
Open a terminal prompt and change to the ClanLib directory.
Run autogen (only required in the development version):
./autogen.sh
Configure (this gives the standard one, see below for other options):
./configure --prefix=/usr
To get a list of available options, run "./configure --help"
Developers may prefer to add --enable-debug to create debug libraries.
You can force enabling of implementations, or disable some - eg.:
./configure --disable-clanMikMod --enable-clanGL
By default both shared (.so) and static (.a) libraries are built. Unless you want to make a static release, you will probably only want the shared libraries, so can disable the static ones with:
./configure --disable-static
Doing so will reduce the compile size by a half.
Compile (this will take some time):
make
Install:
sudo make install
ClanLib should now be ready for use.
ClanLib includes API reference documentation within its source files, which can be extracted to HTML using:
sudo apt-get install doxygen ./configure --prefix=/usr --enable-docs make html
It will then be found at file:///your ClanLib directory/Documentation/Reference/doxyoutput/html/modules.html
ClanLib also includes a number of examples, which are compiled and run as follows (replace Display/Basic2D with the example category and name):
cd Examples/Display/Basic2D make ./basic2d
A simple makefile used to compile a ClanLib application under Linux could look like this (replace "simple" with the name of your application):
PACKAGES = clanCore-2.2 clanDisplay-2.2 clanApp-2.2 clanGL-2.2 CPPFLAGS = `pkg-config --cflags $(PACKAGES)` LIBS = `pkg-config --libs $(PACKAGES)` OBJS = simple.o all: $(OBJS) g++ -o simple -pthread $(OBJS) $(LIBS) clean: -rm -rf *.o -rm simple
This links against the ClanLib modules required for graphics (2D or 3D) and input. If you use other modules such as networking (clanNetwork), sound (clanSound, and clanVorbis or clanMikmod if you use those formats) or GUI (clanGUI), add these to the PACKAGES line.
automake autoconf autotools-dev m4 libtool libc6-dev linux-libc-dev g++ (g++-4.1 or later and libstdc++6-4.1-dev or later) zlib1g zlib1g-dev
libpng12-0 libpng12-dev libjpeg62-dev libfreetype6 (unless compiled manually) libfreetype6-dev (unless compiled manually) x11proto-xf86vidmode-dev (to enable XF86 VidMode) libxxf86vm-dev (to enable XF86 VidMode) libfontconfig1-dev libxi-dev libgl1-mesa-dev libice-dev libsm-dev libx11-dev libxau-dev libxdmcp-dev libxext-dev libxt-dev mesa-common-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xtrans-dev
This package has moved into a separate clanSDL package.
libasound2-dev (for alsa)
libmikmod2 libmikmod2-dev
libvorbis0a libvorbis-dev libogg-dev
libpcre3 libpcre3-dev