|
I keep getting asked how to compile Clutter on Win32 now that we have
a native backend so here is some instructions to compile with MinGW
and MSYS on a fresh Windows installation.
First you need to install the MinGW and MSYS packages from
here.
Select the top package called 'Automated MinGW Intaller' and download
the exe of the latest version. Run the executable and install to the
default location. Make sure you DON'T install 'MinGW make' to make
life easier.
Next download the 'MSYS Base System'. Use the .exe installer
from 'Current release' (not the technology preview). Run the
executable and install to the default location. Answer yes to whether
you want to continue with the post install and tell it the location
where you installed MinGW (which should be c:/MinGW).
Next install the 'MSYS supplementary tools'. Again select .exe from
the current release and install it to the default location.
To make downloading the dependencies for Clutter easier, we want to be
able to run the mingw-cross-compile.sh script which will do
some of the leg work automatically. However to do this we first need
some extra utilities.
Make a directory called c:/msys/1.0/clutter-work and another
directory called downloads under that. Go back to the
SourceForge page for MinGW and select the 'User Contributed:
mingwPORT' section. Download the wget tarball to the newly created
downloads folder.
Start MSYS and type the following to install wget.
cd /clutter-work/downloads
tar -jvxf wget-1.9.1-mingwPORT.tar.bz2
cd wget-1.9.1/mingwPORT
mkdir /usr/src
PATH="$PATH":"$PWD" ./mingwPORT.sh
Press enter at each question to just use the default
Next we need to install unzip.exe which we can get from the
GNUWin32 ports. Visit here
and download the 'complete package, except sources'. Install it to the
default location.
Now we can type the following to download and install the clutter
dependencies using the helper script:
cd /clutter-work
wget -O downloads/mingw-cross-compile.sh \
'http://svn.o-hand.com/view/*checkout*/clutter/trunk/clutter/build/mingw/mingw-cross-compile.sh'
PATH="$PATH:/c/Program Files/GnuWin32/bin" sh ./downloads/mingw-cross-compile.sh
Press enter to all of the questions to get the default except the 'Do
you want to download and install Clutter...' questions because these
will try to use SVN which we don't have installed.
Next we need to install pkg-config to get Clutter's configure script
to work. Type the following:
cd /clutter-work/downloads
wget 'http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz'
tar -zvxf pkg-config-0.23.tar.gz
cd pkg-config-0.23
prefix=/clutter-work/clutter-cross
libdir="${prefix}/lib"
includedir="${prefix}/include"
CFLAGS="-g -O2 -Wall -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include" \
LDFLAGS="-L${libdir} -lglib-2.0 -lintl -liconv" \
./configure
make all install
Now we should finally be ready to compile Clutter:
cd /clutter-work/downloads
wget http://www.clutter-project.org/sources/clutter/0.8/clutter-0.8.0.tar.bz2
cd ..
tar -jvxf downloads/clutter-0.8.0.tar.bz2
cd clutter-0.8.0
PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig \
PATH="$PATH:/clutter-work/clutter-cross/bin" \
CFLAGS="-mms-bitfields -I/clutter-work/clutter-cross/include -g -O2 -Wall" \
./configure --prefix=/clutter-work/clutter-cross --with-flavour=win32
make all install
Now to prove that it worked we can run test-actors. Windows needs the
Clutter DLL to be in the system path for this to work so type the
following:
export PATH="$PATH:/clutter-work/clutter-cross/bin"
cd /clutter-work/clutter-0.8.0/tests
.libs/test-actors
If you want to compile a simple app without using autotools, it's
easiest to use the libtool generated in the Clutter source so that it
can work some voodoo with the included libraries. This assumes you've
still got your path set up from the previous test:
libtool --mode=link gcc -Wall -g -o simple-app simple-app.c \
-I/clutter-work/clutter-cross/include \
`PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig pkg-config clutter-0.8 --cflags --libs`
Enjoy!
|