一,建立MSYS环境
1, 下载MinGW并安装(MinGW-5.1.6.exe),假设安装目录为:c:\MinGW;
2, 下载MSYS并安装(MSYS-1.0.11.exe),在安装过程中会要求给出MinGW路径,输入c:\MinGW,MSYS路径为:c:\msys\1.0;
3, 安装wget工具,可以用来在MinGW中获取软件包;
4, 下载安装msysDTK-1.0.1.exe
二,配置clutter环境
1, 启动MSYS并在根目录下建立clutter_work文件夹,作为clutter的工作目录;
2, 下载脚本mingw-cross-compile.sh并执行,会下载并安装clutter依赖库;
cd /clutter_work
mkdir downloads
mkdir clutter-cross
wget -O downloads/mingw-cross-compile.sh \ http://git.clutter-project.org/clutter/plain/build/mingw/mingw-cross-compile.sh
export PATH="$PATH:/c/Program Files/GnuWin32/bin"
sh ./downloads/mingw-cross-compile.sh
3,下载并安装pkg-config工具:
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
./configure 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"
Make
Make install
三,编译和执行clutter (clutter-1.4.2)
1, 下载clutter-1.4.2到/clutter_work/downloads下并解压到/clutter_work下;
cd /clutter-work/downloads
wget http://source.clutter-project.org/sources/clutter/1.4/clutter-1.4.2.tar.gz
cd ..
tar -jvxf downloads/clutter-1.2.12.tar.bz2
2,进入clutter-1.4.2目录进行configure和compile:
cd clutter-1.4.2
./configure --prefix=/clutter_work/clutter-cross --with-flavour=win32 --with-json=internal 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"
make
make install
3,如果不出什么问题,就可以在tests目录下找.exe的文件执行,有些测试程序是可以执行的。
四,将clutter编译后的静态库转换为windows适用的DLL库
在有些clutter版本编译后直接生成DLL库,但有些旧版本却只能生成.a静态库libclutter-win32-1.0.a,可以在MSYS中安装a2dll工具,利用以下命令却可生成DLL库文件:
a2dll libclutter-win32-1.0.a -L/clutter_work/clutter-cross/lib/ -lopengl32 -lgdi32 -lwinmm -lglib-2.0 -lpango-1.0 -lgobject-2.0 -latk-1.0 -lcairo -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -llibpng -lgmodule-2.0 -lgdk_pixbuf-2.0 -lintl –relink
Ref: http://wiki.clutter-project.org/wiki/BuildingClutterOnWindows