arm Linux平台下SDL及扩展库的移植

  参考文章:http://blog.csdn.net/kof98765/article/details/18264859

  SDL(Simple DirectMedia Layer)是一个自由的跨平台的多媒体开发包,适用于 游戏、游戏SDK、演示软件、模拟器、MPEG播放器和其他应用软件。
  基于SDL库目前已提供丰富的函数库,非常方便开发者使用。常用的如下:
    1、SDL_Image:提供显示多种格式的图像显示接口,它支持bmp,png,jpeg,gif,tiff等.
    2、SDL_Draw:提供画点线圆等几何图形的接口.
    3、SDL_ttf:提供显示TTF文字的接口.
    4、SDL_mixer:提供播放各种声音文件的接口.
    5、SDL_net:提供网络通信的接口.

1、SDL的移植

  下载地址 http://www.libsdl.org/download-1.2.php 。使用版本:SDL-1.2.15.tar.gz。

1.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-pulseaudio --disable-video-nanox \
-disable-video-qtopia --disable-static --enable-shared --disable-video-photon --disable-video-ggi \
--disable-video-svga --disable-video-aalib --disable-video-dummy --disable-video-dga --disable-arts \
--disable-esd --disable-alsa --disable-video-x11 --disable-nasm --disable-joystick --disable-input-tslib \
-enable-video-fbcon --host=arm-linux
1.2 编译
$ make
1.3 安装
$ make install

  

2、libjpeg的移植

  libjpeg是一个用c语言编写支持jpeg解码、编码的库。下载地址:http://linux.softpedia.com/get/Programming/Libraries/libjpeg-160.shtml 。使用版本:jpegsrc.v9.tar.gz。

2.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--host=arm-linux cc=arm-linux-gcc
2.2 编译
$ make
2.3 安装
$ make install

  

3、libconv的移植

  libiconv库为需要做转换的程序,实现了一个字符编码到另一个字符编码的转换。下载地址 http://www.gnu.org/software/libiconv/#downloading 。使用版本:libiconv-1.9.2.tar.gz。

3.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--with-libiconv-prefix=/home/horo/arm/software/sdl_arm \
--host=arm-linux cc=arm-linux-gcc
3.2 编译
$ make
3.3 安装
$ make install

  

4、libpng的移植

  libpng是多种应用程序所使用的解析PNG图形格式的函数库。下载地址 http://www.libpng.org/pub/png/libpng.html 。使用版本:libpng-1.6.34.tar.xz。

4.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--host=arm-linux cc=arm-linux-gcc
4.2 编译
$ make
4.3 安装
$ make install

  

5、SDL_image的移植

  SDL_image是用于处理图形文件的开源函数库,依赖SDL、libpng、libjpeg。下载地址 http://www.libsdl.org/projects/SDL_image/ 。使用版本:SDL_image-1.2.12.tar.gz。

5.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux --disable-static \
--enable-shared --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/SDL  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib
5.2 编译
$ make
5.3 安装
$ make install

  

6、SDL_gfx的移植

  图形库,也就是传统的一些图形操作,几个基本的功能包括了缩放,旋转,几何图形绘制,FPS控制。依赖SDL。下载地址 http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.22.tar.gz 。使用版本:SDL_gfx-2.0.22.tar.gz

6.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/SDL  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib --host=arm-linux  --enable-mmx=no
6.2 编译
$ make
6.3 安装
$ make install

  

7、SDL_ttf的移植

  SDL_ttf是让应用程序能渲染汉字的扩展库,依赖SDL、freetype、libiconv。下载地址 http://www.libsdl.org/projects/SDL_ttf/ 。使用版本:SDL_ttf-2.0.11.tar.gz。
  
  freetype是矢量字库处理工具,下载地址http://www.linuxfromscratch.org/blfs/view/6.2.0/general/freetype2.html 。使用版本:freetype-2.1.10.tar.bz2。安装SDL_tty之前必须先安装freetype。

7.1 配置

freetype

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static \
--enable-shared --host=arm-linux

SDL_ttf

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--disable-sdltest --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
--with-freetype-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/ \
LDFLAGS="-L/home/horo/arm/software/sdl_arm/lib -liconv" --host=arm-linux

  修改Makefile,去掉OpenGL相关处理(我编译的时候没有遇到前三种情况,可能和版本有关):
    1、删除CFLAGS中的-I/usr/include -DHAVE_OPENGL
    2、将GL_LIBS = -L/usr/lib -lGL修改为GL_LIBS =
    3、将glfont_LDADD = libSDL_ttf.la -L/usr/lib -lGL -lm修改成glfont_LDADD = libSDL_ttf.la -lm
    4、将glfont.c.全部清空,修改为int main(int argc ,char **argv) { return 0;}

7.2 编译
$ make
7.3 安装
$ make install

  

8、SDL_mixer的移植

  SDL2_mixer对于音频的处理,依赖SDL、libmad、libmikmod。下载地址:http://www.libsdl.org/projects/SDL_mixer/ 。使用版本:SDL_mixer-1.2.12.tar.gz。

  libmad是一个开源mp3解码库,其对mp3解码算法做了很多优化,性能较好。安装SDL_mixer前先安装libmad。下载地址:http://www.linuxfromscratch.org/blfs/view/6.3/multimedia/libmad.html 。使用版本:libmad-0.15.1b.tar.gz。

libmikmod是SDL_mixer所依赖的对MID格式的音频的支持的底层库。安装SDL_mixer前先安装libmikmod。下载地址http://mikmod.sourceforge.net/ 。使用版本:libmikmod-3.3.11.tar.gz。

8.1 配置

libmad

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux

  修改Makefile,删除CFLAGS中的-fforce-mem。gcc3.4或者更高版本已经将其删除。
libmikmod

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux

SDL_mixer

$ ./configure --prefix=/home/horo/arm/software/sdl_arm --disable-static --enable-shared \
--disable-sdltest --with-sdl-prefix=/home/horo/arm/software/sdl_arm \
--with-freetype-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include/ \
LDFLAGS="-L/home/horo/arm/software/sdl_arm/lib -liconv" --host=arm-linux
8.2 编译
$ make
8.3 安装
$ make install

  

9、SDL_net的移植

  SDL_net用于网络通信,依赖SDL。下载地址http://www.libsdl.org/projects/SDL_net/ 。使用版本:SDL_net-1.2.8.tar.gz。

9.1 配置
$ ./configure --prefix=/home/horo/arm/software/sdl_arm --host=arm-linux \
--with-sdl-prefix=/home/horo/arm/software/sdl_arm \
CPPFLAGS=-I/home/horo/arm/software/sdl_arm/include  \
LDFLAGS=-L/home/horo/arm/software/sdl_arm/lib
9.2 编译
$ make
9.3 安装
$ make install

  
  
  至此,将SDL及其部分扩展库安装到/home/horo/arm/software/sdl_arm目录下,将目录下的所有文件拷贝到开发板中。

猜你喜欢

转载自blog.csdn.net/horotororensu/article/details/78551627