与afreez一起学习DirectFB之:编译最小的DirectFB

摘要

本文介绍了怎样生成一个最小(或接近最小)的DirectFB,以及相关的测试用例的安装和测试,对编译中的参数MMX,SSE,SDL,VNC的概念给出了较为详细的介绍

---------------------------------------------------------------------------------------------------------------------
声明:
  此文为原创,欢迎转载,转载请保留如下信息
  作者:聂飞(afreez)
  联系方式:[email protected] (欢迎与作者交流)
  初次发布时间:2006-05-25
  不经本人同意,不得用语商业或赢利性质目的,否则,作者有权追究相关责任!
---------------------------------------------------------------------------------------------------------------------


实验平台:
FC5(Fedora Core5)

DirectFB-0.9.24(目前最新版本为0.9.25,为了开发的稳定性,选择0.9.24版本)

下载源码:
下载DirectFB-0.9.24.tar.gz源码开发包,下载地址为:[url]http://www.directfb.org/index.php?path=Main%2FDownloads&page=4[/url];

下载测试用例DirectFB-examples-0.9.23.tar.gz:源码包,下载地址为:

[url]http://www.directfb.org/index.php?path=Main%2FDownloads&page=4[/url];

当然,也可以下载最新的安装和测试版本。

安装DirectFB-0.9.24
本例中将会在/usr目录下建立软件安装目录和测试用例目录,首先建立这两个目录

$mkdir /usr/miniDirectFB

$mkdir /usr/miniExample

假设DirectFB-0.9.24.tar.gz下载到本地机器的位置为home目录,解压并进入该包

$tar xvf DirectFB-0.9.24.tar.gz

$cd DirectFB-0.9.24

运行配置脚本,生成makefile文件

$./configure --prefix=/usr/miniDirectFB --enable-mmx=no --enable-sse=no --enable-sdl=no --enable-gif=no --enable-jpeg=no --with-gfxdrivers='none' --with-inputdrivers='none' --without-tools --disable-fast-install --disable-libtool-lock --enable-png=no --enable-video4linux=no --disable-debug --disable-trace --enable-freetype=no

注意,上面的参数和configure命令在同一行,各参数的含义详见后面附录部分。编译完成后的输出结果参照后面的附录。



$make clean;make

$make install



修改/etc/ld.so.conf文件,加入你所安装的DirectFB库文件的位置,此例为

/usr/ miniDirectFB/lib;

$vi /etc/ld.so.conf

添加usr/ miniDirectFB/lib

保存退出

$ldconfig

Ldconfig命令使得你刚加入的参数起作用,详细可以参考相关资料。

安装测试用例
假设DirectFB-examples-0.9.23.tar.gz下载到本地机器的位置为home目录,解压并进入该包

$tar xvf DirectFB-examples-0.9.23.tar.gz

$cd DirectFB-examples-0.9.23

设置pkgconfig的目录(参考你的DirectFB安装目录)

$export PKG_CONFIG_PATH=/usr/miniDirectFB/lib/pkgconfig

编译安装测试用例:

$./configure �Cprefix=/usr/miniExample

$make clean;make

$make install

安装完毕

测试
切换到一个终端下,设置相应的环境变量:

$export LD_LIBRARY_PATH=/usr/miniDirectFB/lib

运行测试用例

$df_bltload

$df_cpuload

$df_dioload

注意,这里运行的每一个例子,你都无法通过鼠标键盘正常退出,因为,我们生成的是一个最小(或者接近最小)的DirectFB,在configure中我们去掉了对输入设备的支持;当然,其它的例子我们基本上都不能运行,因为他们都需要输入或者gfxdrivers的支持,我们也去掉了,不过,看起来很简洁,可以更方便我们对DirectFB的认识。安装的测试用例可以在你安装的目录里找到,本例中为:

/usr/miniExample/bin



附录1 编译完成后,configure的输出结果
Build options:

Version             0.9.24

Install prefix         /usr/miniDirectFB

Build shared libs       yes

Build static libs       no

Module directory       ${exec_prefix}/lib/directfb-0.9.24

CPPFLAGS             -D_REENTRANT

CFLAGS             -Wall -O3 -ffast-math -pipe -D_GNU_SOURCE -Werror-implicit-function-declaration

LDFLAGS            

LIBS               -ldl -lpthread



Misc options:

Multi Application Core   no

Voodoo (network support) no

Debug mode           no

Trace support         no

MMX support           no

SSE support           no

zlib compression       no

sysfs support         no



Building Core Systems:

Linux FBDev support     yes

X11 support           no

OSX support           no

SDL support           no

VNC support           no



Building WM Modules:

Default             yes

UniQuE             no



Building Tools         no



Building Image Providers:

GIF               no

JPEG               no

MPEG2 I-Frame         yes

PNG               no



Building Video Providers:

Video4Linux           no (v2: no)



Building Font implementations:

FreeType2          

Default font         yes



Building Graphics Drivers:

3Dfx Voodoo           no

ATI Mach64           no

ATI Radeon           no

ATI Rage 128         no

ATI R200             no

Intel i810           no

Intel i830           no

Matrox             no

NeoMagic             no

NSC Geode           no

nVidia             no

S3 Savage           no

SiS 315             no

TVIA CyberPro         no

VIA CLE266           no

VIA UniChrome         no



Building Input Drivers:

DBox2 Remote         no

DreamBox Remote       no

ELO Touchscreen       no

H3600 Touchscreen       no

Joystick             no

Keyboard             no

Linux Input           no

LiRC               no

MuTouch touchscreen     no

PS/2 Mouse           no

Serial Mouse         no

SonyPI Jogdial         no

ucb1x00 Touchscreen     no

WM97xx Touchscreen     no

附录2 安装后生成的共享库列表为
libdirect-0.9.so.24.0.0

libdirectfb-0.9.so.24.0.0

libfusion-0.9.so.24

libdirectfbwm_default.so

libdirectfb_fbdev.so

libidirectfbimageprovider_mpeg2.so

libidirectfbfont_default.so

libidirectfbvideoprovider_v4l.so

附录三 使用rpm命令参看DirectFB的依赖关系
rpm -qpR directfb-0.9.24-8.rhfc5.at.i386.rpm

warning: directfb-0.9.24-8.rhfc5.at.i386.rpm: Header V3 DSA signature: NOKEY, key ID 66534c2b

libSDL-1.2.so.0

libc.so.6

libc.so.6(GLIBC_2.0)

libc.so.6(GLIBC_2.1)

libc.so.6(GLIBC_2.1.3)

libc.so.6(GLIBC_2.3)

libc.so.6(GLIBC_2.3.4)

libc.so.6(GLIBC_2.4)

libdirect-0.9.so.24

libdirectfb-0.9.so.24

libdl.so.2

libdl.so.2(GLIBC_2.1)

libfreetype.so.6

libfusion-0.9.so.24

libjpeg.so.62

libm.so.6

libpng12.so.0

libpthread.so.0

libpthread.so.0(GLIBC_2.0)

libpthread.so.0(GLIBC_2.1)

libpthread.so.0(GLIBC_2.3.2)

libz.so.1

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1



附录四 configure参数说明
<!--[if !supportLists]-->l     <!--[endif]-->--prefix=设定安装的目录,默认为/usr/local

<!--[if !supportLists]-->l     <!--[endif]-->--enable-mmx=的含义参照如下的解释:

MMX(MultiMedia Extensions),多媒体扩展指令集。是在Intel微处理器和其它与x86兼容的微处理器中包含57个多媒体指令的一个集合。支持MMX的微处理器可以处理许多常见的多媒体操作,例如信号处理(DSP digital signal processing)就常用一个单独的声卡或显卡来处理。然而,只有调用MMX指令的软件――所谓的支持MMX的软件――才能发挥MMX指令集的优势。

MMX技术用于加快多媒体和通信应用的运行速度。该技术加入了新的指令和数据类型,使应用达到更高水平的性能。它充分利用了许多多媒体和通信算法中固有的并行计算能力,同时还完全兼容现有的操作系统和应用。英特尔开发的最早期SIMD指令集,可以增强浮点和多媒体运算的速度。

英文解释:Short for Multimedia Extensions, a set of 57 multimedia instructions built into Intel microprocessors and other x86-compatible microprocessors. MMX-enabled microprocessors can handle many common multimedia operations, such as digital signal processing (DSP), that are normally handled by a separate sound or video card. However, only software especially written to call MMX instructions -- so-called MMX-enabled software -- can take advantage of the MMX instruction set.

<!--[if !supportLists]-->l     <!--[endif]-->--enable-sse=的含义参照如下的解释:

sse为PentiumIII级别以上的cpu启用SSE指令集优化支持;

Streaming SIMD Extensions(SSE)和Streaming SIMD Extensions 2(SSE2)指令集,它们对Intel (R) 4的处理器有效用;

Intel (R) Pentium 4处理器根据Intel (R) NetBurst TM 微架构(microarchitecture)。此架构从它的前一代(predecessors)提供新的强化,包括对SIMD(Single Instruction Multiple Data)执行技术的改善。SIMD在具MMX技术的Pentium处理器首次被介绍,在Pentium III处理器家族扩充成包含更多在Streaming SIMD Extensions (SSE)的数据集,而今天Pentium 4处理器则以Streaming SIMD Extensions (SSE) 包含了更多(的资料集)。
  为了Interl NetBurst微架构发展的主要特性是从Pentium III处理器的P6微架构找到的指令集的扩充,以引入在双精度浮点数数据元素上的运算。此架构以它平行处理更多运算的能力,支持更多的数据,且更有效率。
本文件的目标在于提供给不识此道者一堂SSE和SSE2的「速成课(crash course)」,让你能快速地到达能开始在你的应用程序中实作SSE程序代码的水平。

详细请参考:[url]http://blog.sina.com.tw/jiing/article.php?pbgid=872&entryid=13877[/url]

<!--[if !supportLists]-->l     <!--[endif]-->Sdl简介

Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."

SDL supports Linux, Windows, Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported.

SDL is written in C, but works with C++ natively, and has bindings to several other languages, including Ada, C#, Eiffel, Erlang, Euphoria, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, Pike, Pliant, Python, Ruby, and Smalltalk.

SDL is distributed under GNU LGPL version 2. This license allows you to use SDL freely in commercial programs as long as you link with the dynamic library.

详细请参照:[url]http://www.libsdl.org/index.php[/url]

<!--[if !supportLists]-->l     <!--[endif]-->VNC简介

virtual network computing

Through the use of software VNC, acronym for virtual network computing, makes it possible to interact with a computer from any computer or mobile device on the Internet. VNC software provides cross-platform support allowing remote control between different types of computers. To use VNC you must have a network TCP/IP connection, a VNC server and a VNC viewer to connect to the computer running the VNC server. The open source version of VNC has been freely available since 1998, and more than 20 million copies of the software have been downloaded.



详细请参照:

[url]http://www.webopedia.com/TERM/v/virtual_network_computing.html[/url]

其它配置信息,请参照安装目录里的README 和INSTALL文件里的说明。

参考文献(reference)
<!--[if !supportLists]-->1.     <!--[endif]-->安装目录里的README 和INSTALL

<!--[if !supportLists]-->2.     <!--[endif]-->[url]http://blog.sina.com.tw/jiing/article.php?pbgid=872&entryid=13877[/url]

<!--[if !supportLists]-->3.     <!--[endif]-->[url]http://www.libsdl.org/index.php[/url]

<!--[if !supportLists]-->4.     <!--[endif]-->[url]http://www.webopedia.com/TERM/v/virtual_network_computing.html[/url]

你可能感兴趣的:(职场,休闲)