标签:
在移植游戏之前, 我们首先需要将 SDL/SDL_mixer/SDL_ttf/SDL_image 这四个库移植到 Tiny6410 上, 另外还需要 iconv 库。
libiconv-1.13.1.tar.gz Iconv 库 下载:http://ftp.gnu.org/pub/gnu/libiconv/
SDL-1.2.14.tar.gz SDL 库 http://www.libsdl.org/download-1.2.php
SDL_image-1.2.8.tar.gz SDL_image 库 http://www.libsdl.org/projects/SDL_image/release/
SDL_ttf-2.0.9.tar.gz SDL_ttf 库 http://www.libsdl.org/projects/SDL_ttf/release/
SDL_mixer-1.2.9.tar.gz SDL_mixer 库 http://www.libsdl.org/projects/SDL_mixer/release/
在 /opt/mini6410 目录下创建目录 games 来作为我们本次移植工作的工作目录,输入以下命令创建:
# mkdir –p /opt/mini6410/games
再在 games 目录下创建一个 output 目录,用来存放编译生成的可执行文件或者类库等:
# cd /opt/mini6410/games
# mkdir output
编译iconv库
# 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
编译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
编译SDL_image库
# 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
在这里会提示报错信息
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log‘ for more details.
打开config.log文件会在在最低部看到出错的地方 这里我们安装这几个库就行了
apt-get install libjpeg-dev apt-get install libts-dev apt-get install libpng-dev
编译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"
和上一个一样在编译的时候也会报错 安装库
apt-get install libSDL-dev apt-get install libfreetype6-dev
在编译之前手工修改 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
标签:
原文地址:http://www.cnblogs.com/ynxf/p/5483655.html