移植SDL运行库到ARM11(s3c6410)上

1.libconv库的编译

# cd /opt/mini6410/games 
# mkdir output

# tar xvzf /tmp/libiconv-1.13.1.tar.gz   
# cd libiconv-1.13.1 
# ./configure --host=arm-linux --prefix=/opt/mini6410/games/output 
# make 
# make install

这个编译过程一般不会有什么问题

 

2.SDL库的编译

 

# cd /opt/mini6410/games 
# tar xvzf /tmp/SDL-1.2.14.tar.gz 
# cd SDL-1.2.14 
# ./configure --prefix=/opt/mini6410/games/output --disable-video-nanox -disable-video-qtopia
--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 --enable-joystick --enable-input-tslib 
--enable-video-fbcon --host=arm-linux --build=i386 
# make 
# make install

这个过程要注意,有可能会提示-lpulse没有找到,如果有这个提示请链接库到你lpulse库下,例如你的lpulse库在usr/lib目录下则在链接库时添加-L/usr/lib,其他错误可以更改相应的头文件或者相应代码

 

/src/audio/pulse/SDL_pulseaudio.c:33:30: fatal error: pulse/pulseaudio.h: No such file or directory
在makefile文件中添加(EXTRA_CFLAGS = -I./include) -I /usr/include


/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
错误: #error "Never use directly; 
用include 代替"

In file included from /usr/include/fcntl.h:41:0,
                 from ./src/video/fbcon/SDL_fbevents.c:31:
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1
/../../../../arm-none-linux-gnueabi/include/bits/stat.h:20:3: 
error: #error "Never include directly; use instead."
分别修改fcntl.h和SDL_fbevents.c中的头文件include 为include

 

3.编译SDL_image库

 

编译此库时一定要保证lpulse库被编译

# cd /opt/mini6410/games 
# tar xvzf /tmp/SDL_image-1.2.8.tar.gz 
# cd SDL_image-1.2.8 
# ./configure  --enable-shared  --enable-static  --host=arm-linux  --build=i386 
--prefix=/opt/mini6410/games/output  --enable-bmp  --enable-gif  --enable-jpg 
--enable-png   --enable-tif  --enable-pnm  --enable-xpm 
--disable-sdltest   SDL_CFLAGS="-I/opt/mini6410/games/output/include" 
SDL_LIBS="-L/opt/mini6410/games/output/lib  -lSDL" 
LIBPNG_CFLAGS="-I/opt/mini6410/games/output/include" 
LIBPNG_LIBS="-L/opt/mini6410/games/output/lib  -lpng" 
CPPFLAGS="-I/opt/mini6410/games/output/include/SDL  -I/opt/mini6410/games/output/include/"
LDFLAGS="-L/opt/mini6410/games/output/lib -ljpeg -lts -lpng -liconv" 
# make   
# make install

 

 

4.SDL_ttf的编译

# cd /opt/mini6410/games 
# tar xvzf /tmp/SDL_ttf-2.0.9.tar.gz 
# cd SDL_ttf-2.0.9 
# ./configure --host=arm-linux --prefix=/opt/mini6410/games/output --enable-shared --enable-static
--disable-sdltest 
--with-freetype-prefix=/opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/sys-root/usr/
--with-sdl-prefix=/opt/mini6410/games/output/ CFLAG="-I/opt/mini6410/games/output/include"
LDFLAGS="-L/opt/mini6410/games/output/lib -lSDL -lts -liconv -lfreetype"

在编译之前手工修改 Makefile,去掉OpenGL 相关处理: 
# vi Makefile 
 
定位到 123 行,将以下内容中的“-I/usr/include -DHAVE_OPENGL”删除(红色字体部分): 
CFLAGS = -g -O2 -I/usr/include/freetype2 -I/opt/mini6410/games/output/include/SDL
-D_GNU_SOURCE=1 -D_REENTRANT   -I/usr/include -DHAVE_OPENGL 
 
再定位到 143 行,将: 
GL_LIBS =   -L/usr/lib -lGL 
改成 
GL_LIBS = 
 再定位到 266 行,将: 
glfont_LDADD = libSDL_ttf.la   -L/usr/lib -lGL -lm 
改成 
glfont_LDADD = libSDL_ttf.la -lm 
 
清空源代码文件  glfont.c 中的源代码  (先删除,再用 vi 创建): 
# rm glfont.c.-f 
# vi glfont.c 
 
在 vi 编辑器中输入以下内容并保存: 
void main() {} 
 

# make   
# make install

5. 编译SDL_mixer库 
 # cd /opt/mini6410/games 
# tar xvzf /tmp/SDL_mixer-1.2.9.tar.gz 
# cd SDL_mixer-1.2.9 
# ./configure  --enable-music-mp3-mad-gpl  --enable-music-mp3=no  --host=arm-linux
--prefix=/opt/mini6410/games/output  --with-sdl-prefix=/opt/mini6410/games/output  --enable-shared
--enable-static 
# make 
# make install 
 

通过以下命令打包 SDL 类库和其它相关的类: 
# cd /opt/mini6410/games/output/ 
# tar cvzf sdl_setup.tar.gz bin lib share 
 
将 sdl_setup.tar.gz 拷贝到开发板上,在根目
录进行解压: 
@# cd / 
@# tar xvzf /sdcard/sdl_setup.tar.gz

 

这样SDL库就更新完了

转自:https://blog.csdn.net/a343981218/article/details/8056008

你可能感兴趣的:(linux)