I would recommend that you have pkg-config installed,
you
don't need it
to build ClanLib but some games might need it, and if pkg-config was
not installed before ClanLib was build, those games might not compile.
You should be able to obtain pkg-config through your
distribution's pakage manager.
As of this writing, you need to get the latest ClanLib 0.7 via CVS to compile under MinGW32 (note that I've yet to hear from anyone getting the libs to work on MinGW32 with MSYS on win32, but a MinGW32 cross compile on GNU/Linux works).
To get ClanLib via CVS, follow the instructions at http://clanlib.org/cvs.html. Checkout the Libs/ClanLib-0.7 module.
To build ClanLib from the CVS source, you need to have automake 1.5b
or
greater (1.8 or above will not work currently. Question for clanlib
mantainers: should they work??) and
autoconf 2.50 or greater. You should be able to get a recent enough
version of these tools via your distribution's package management tool.
Once you are sure that you have both of
those, run ./autogen.sh in the clanlib source folder
(i.e. checkout_dir/Libs/ClanLib-0.7), now you are ready
to run cross-configure.sh and cross-make.sh
to cross compile ClanLib.
As of this writing, you need to get the latest ClanLib 0.7 via CVS to compile under MinGW32, when ClanLib 0.7.7 is released, you should be able to get a release tarball (or zip) via the ClanLib website. All you need to do is untar/unzip the file and you will be ready to build ClanLib.
Before we start, there is a decision you need to make about where you want to build ClanLib. You can build it in the source directories or in a seperate set of directories known as the "object" directories. The advantage of build it in the source directory is that it is simpler to set up, the disadvantage is that you cannot use the same sources for different builds. The "object" directories method has the advantage of being able to use the same sources to build ClanLib for different compilers. Lets say you now build ClanLib under cross compiled MinGW32, using the "object" directories method, you can build your native linux ClanLib using the same source as well (under different "object" directories). If you want to try building ClanLib with maybe icc rather than gcc, you can do so in yet another set of "object" directories.
cross-configure.sh in the the top source
directory ( i.e. clanlib/Libs/ClanLib-0.7) with all the
options you want that you would usually pass to a configure
script. (see section titled Configure Options below
for more details)cross-make.sh to buildcross-make.sh install to install clanlib/Libs/ClanLib-0.7 . I created
a directory called mingw32-obj for my MinGW32 cross
compile build of ClanLib. So my top object directory is clanlib/Libs/ClanLib-0.7/mingw32-obj.
cross-configure.sh in the newly created
directory ( i.e. clanlib/Libs/ClanLib-0.7/mingw32-obj)
with all the options you want that you would usually pass to a configure
script. (see section titled "Configure Options" below for more details)
cross-make.sh in the same directory (
i.e. clanlib/Libs/ClanLib-0.7/mingw32-obj) to build.cross-make.sh install in the same
directory ( i.e. clanlib/Libs/ClanLib-0.7/mingw32-obj) to
install. ../configure in the newly created
directory with all the options you want (See step 2 in Building
In "Object" Directories for more details).make in the same directory to build.make install in the same directory to install.When you cross compile, many of the configure tests will not be run (sadly). Which means you will need to expicitly enable/disable most of the options, even optional ones. So for example if you did not compile libOGG and libVorbis you will need to add --disable-clanVorbis so that clanVorbis will not be build. For MinGW32 cross compile, I would recommend using:
cross-configure.sh use_directx8=1 --enable-static --disable-shared --disable-clanSDL --disable-docs.
| --prefix | directory
you want to install in
for the cross compile this should be For example if you installed your cross tools in Note that my modified version of the |
| --enable-asm386 --disable-asm386 | Enable 386 assembly |
| --enable-dyn | Enable dynamic loading
Does not work for MinGW32 I think, not sure about this |
| --enable-docs --disable-docs | Build ClanLib documentation |
| --enable-clanDisplay --disable-clanDisplay | Build clanDisplay module. Must have! |
| --enable-clanSDL --disable-clanSDL | Build clanSDL module (not
recommended) Require: libSDL
To build clanSDL, you need to do some tricks half way through the build process to get it to generate a file (the binary generated by libtool required by clanSDL is a win32 binary, so you have to manually compile that as a linux binary and restart the build process). I would recommend you disable clanSDL for cross compile. |
| --enable-clanGL --disable-clanGL | Build clanGL module. Must have! Unless you want to use only clanSDL ... Require: opengl libs (part of mingw32 win32 package) |
| --enable-clanSound --disable-clanSound | Build clanSound module (recommended) Require: DirectInput8 |
| --enable-clanNetwork --disable-clanNetwork | Build clanNetwork module (recommended) Require: win32 headers (part of mingw32 win32 package) |
| --enable-clanGUI --disable-clanGUI | Build clanGUI module. Must have! |
| --enable-clanMikMod --disable-clanMikMod | Build clanMikMod module (optional) Require: libMikMod |
| --enable-clanVorbis --disable-clanVorbis | Build clanVorbis module (optional) Require: libOGG and libVorbis |
| --enable-shared --disable-shared --enable-static --disable-static | Build as shared or static ClanLib on win32 works best when build as static, I think there is no support for shared (DLL) builds. So for the cross compile I would recommend --enable-static --disable-shared. Note that a linux build would probably be using shared rather than static (that's the linux default), and compiling as static will have some linking issues when compiling clalib base apps. |
| --with-extra-includes | Add extra include paths
You can add your directx 8 header path See above
about Note that my modified version of the |
| CXXFLAGS | C++ compiler flags
add |
Building programs using the cross compiler is more or less just
replacing make with cross-make.sh and ./configure
with cross-configure.sh.
Remember that if you are
building libraries to be used in the cross compile, you have to use the
cross compile prefix (same as the prefix above).
Also note that if you are using pkg-config to detect the
cross compiled clanlib you need to declare the enviroment variable PKG_CONFIG_PATH
and set it to /path-to-your/cross-tools/dir/i586-mingw32msvc/lib/pkgconfig
where /path-to-your/cross-tools/dir/i586-mingw32msvc is
your cross compile prefix. My modified version if the cross-configure.sh
and cross-make.sh scripts does this already, so if you
are using those scripts to build, you do not need to pass them in.