安装GTK on DirectFB

参考:http://www.directfb.org/wiki/index.php/Projects:GTK_on_DirectFB

 

GTK-DFB Requirements

Other than a recent DirectFB version ( you need DirectFB >= 0.9.25 ), a complete GTK-DFB environment is composed by the following libraries (system libraries like libc are of course needed but are not listed here):

  • GTK+ - The GTK+ library which includes the GTK-DFB backend
  • Cairo - The 2D vectorial drawing library that GTK relies upon starting from version 2.8.0
  • Pango - GTK+ font rendering library
  • GLib - A Library that extends libc functions
  • ATK - GTK+ accessibility toolkit

Notice that the while Glib and ATK are indipendent from the windowing system underlying GTK+, so you don't need to recompile them and stock òibraries provided by your distribution will do.

 

Building the Requirements

First, make sure you have DirectFB ( >=0.9.25 ), ATK ( >=1.0.1 ) and Glib ( >=2.13.1 ) installed togheter with all the development stuff.

 

注:需要首先安装DirectFB,参考http://shangweixiao.spaces.live.com/blog/cns!A228238F05698C9E!558.entry

 

Then open a new terminal and set up the following variables:

 

export PREFIX=/home/xxx/gtkdfb     注:这里建议装到你的home下吧,比较方便。

export LD_LIBRARY_PATH=$PREFIX/lib 注:这里还需要指定你DirectFB的安装路径,可以这样写:export LD_LIBRARY_PATH=/home/xxx/gtkdfb/lib:/home/xxx/DirectFB-1.1.1/lib

export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig注:再加上DirectFB的的pkgconfigexport PKG_CONFIG_PATH=/home/xxx/gtkdfb/lib/pkgconfig:/home/xxx/DirectFB-1.1.1/lib/pkgconfig

export CFLAGS="-g"注:加上这个,你就可以在GDB中调试GTK了。

 

This allows to install GTK-DFB runtime-libraries and developement files in a place (/usr/gtkdfb in this case) where they don't mess up with the standard set of GTK+ libraries.

 

Next, get cairo and build it with the DirectFB backend enabled:

mkdir -p $PREFIX/src

cd $PREFIX/src

wget http://cairographics.org/releases/cairo-1.4.6.tar.gz 注:这里注意一下版本,这个版本比较旧了,如果编译不过了换个新版本试试。Linux上版本依赖很厉害!以下有同样问题。

tar -xvzf cairo-1.4.6.tar.gz

cd cairo-1.4.6

sh configure --prefix=$PREFIX --enable-directfb --disable-xlib --disable-win32 注:在Linux系统上 --disable-win32 纯属多余,并且建议取消掉--disable-xlib 否则某些GTK程序可能会编译不过。

make

make install

 

Do the same for PanGO 注:这个没有什么问题,注意一下版本就行。

wget http://ftp.acc.umu.se/pub/GNOME/sources/pango/x.y/pango-x.y.z.tar.bz2

tar -xvjf pango-x.y.z.tar.bz2

cd pango-x.y.z

./configure --prefix=$PREFIX --without-x

make

make install

 

Building GTK-DFB

You can now build GTK-DFB

cd $PREFIX/src

wget http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.10/gtk+-2.10.13.tar.bz2  注:如果可以的话,用个稍微新点的版本吧。

tar -xvjf gtk+-2.10.13.tar.bz2

cd gtk+

./configure --prefix=$PREFIX --with-gdktarget=directfb --without-x

make

make install

 

Hey presto! If everything went according to plan, you have compiled GTK-DFB, congratulations!

 

Testing

To see if it worked, try running (*as root*, unless you've compiled DFB with a specific option which allows unprivileged users to access the framebuffer):

 

export LD_LIBRARY_PATH=/usr/gtkdfb/lib

/usr/gtkdfb/bin/gtk-demo

 

注意:请保持在一个终端或者XTerminal里执行以上命令。否则前面设置的全局变量可能会有问题。

 

另:官方网站在最后介绍了“Compiling applications against GTK-DFB - the GIMP”,这里提示注意一下,如果GIMP到最后连接不过,提示说找不到XXX函数,请尝试换个GIMP或者GTK版本试试。比如GIMP 2.4.0就在GTK 2.10.13上连接不过。

 

Good Luck^_^

你可能感兴趣的:(安装GTK on DirectFB)