最新版的freetype源码在http://freetype.org下载,编译freetype需要的harfbuzz最新版源码、以及最新版的DBUS、fontconfig源码可以在http://www.freedesktop.org/wiki/software下载
普通的编译选项可在任一个shell中进入解压后的源码目录,然后用 ./configure –help 命令查询。
- ./configure参数选项
在shell中直接编译某些模块——比如DBUS——将产生各种各样的错误,正确的编译方法是使用交叉编译选项,即用如下的命令执行配置:
./configure --enable-shared=yes --enable-static=yes --host=<hostname> --build=<targetname>
其中的<hostname>
和<targetname>
在不同的shell下应取不同的值:
对MINGW32 shell,<hostname>=i686-w64-mingw32
,<targetname>=i686-pc-msys
对MINGW64 shell,<hostname>=x86_64-w64-mingw32
,<targetname>==x86_64-pc-msys
对MSYS2 shell,因本人未能在其上成功的编译DBUS,因此无法给出正确的值。
除了DBUS,上面的参数选项对fontconfig、freetype、harfbuzz也可用。
各模块编译方法
- DBUS、fontconfig
按给出的./configure参数选项执行./configure,然后make即可成功编译。 - freetype、harfbuzz
根据源码中的编译说明,由于freetype和harfbuzz互为依赖,无法直接一次编译成功,需要按如下步骤执行编译:
(1). 先指定无harfbuzz选项编译freetype:./configure --enable-shared=yes --enable-static=yes --host= --build= --without-harfbuzz && make && make install
(2). 再编译harfbuzz:./configure --enable-shared=yes --enable-static=yes --host= --build= && make && make install
(3). 最后按正常选项编译freetype:./configure --enable-shared=yes --enable-static=yes --host= --build= && make && make instal
上面的步骤中,除第一步编译freetype时需要增加–without-harfbuzz选项外,其他步骤的编译均使用相同的./configure选项。
另外,如果MSYS2中下载的有glib-2.0,建议在编译harfbuzz时增加选项--without-glib --with-gobject=yes
- DBUS、fontconfig